import{S as gi,i as _i,s as bi,e as a,k as u,w as m,t as p,M as wi,c as i,d as t,m as h,a as r,x as d,h as f,b as s,N as eo,G as o,g as l,y as v,L as yi,q as g,o as _,B as b,v as $i}from"../../chunks/vendor-hf-doc-builder.js";import{I as ye}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as ot}from"../../chunks/CodeBlock-hf-doc-builder.js";function xi(ba){let x,at,E,q,Ce,Y,to,He,oo,it,$e,ao,nt,D,xe,wa,io,F,no,J,ro,so,rt,c,lo,V,po,fo,Q,uo,ho,X,co,mo,st,k,j,Re,K,vo,Ge,go,lt,N,Ee,ya,_o,ke,bo,Z,wo,pt,Ae,yo,ft,Pe,$o,ut,A,M,Be,ee,xo,Le,Eo,ht,O,ko,te,Ao,Po,ct,oe,Io,ae,Ie,$a,mt,ie,To,ne,Te,xa,dt,z,So,re,qo,Do,vt,P,C,We,se,jo,Ue,No,gt,w,Mo,Ye,Oo,zo,le,Co,Ho,_t,I,H,Fe,pe,Ro,Je,Go,bt,Se,Bo,wt,fe,yt,R,Lo,ue,Wo,Uo,$t,he,xt,T,G,Ve,ce,Yo,Qe,Fo,Et,y,Jo,Xe,Vo,Qo,me,Xo,Ko,kt,B,Zo,de,ea,ta,At,qe,oa,Pt,ve,It,De,aa,Tt,St,qt,L,ia,ge,na,ra,Dt,je,sa,jt,_e,Nt,Ne,la,Mt,S,W,Ke,be,pa,Ze,fa,Ot,$,ua,et,ha,ca,tt,ma,da,zt,we,Ct;return Y=new ye({}),K=new ye({}),ee=new ye({}),se=new ye({}),pe=new ye({}),fe=new ot({props:{code:"pip install diffusers[training] accelerate transformers",highlighted:"pip install diffusers[training] accelerate transformers"}}),he=new ot({props:{code:"accelerate config",highlighted:"accelerate config"}}),ce=new ye({}),ve=new ot({props:{code:"huggingface-cli login",highlighted:"huggingface-cli login"}}),_e=new ot({props:{code:`export MODEL_NAME="runwayml/stable-diffusion-v1-5"
export DATA_DIR="path-to-dir-containing-images"

accelerate launch textual_inversion.py \\
  --pretrained_model_name_or_path=$MODEL_NAME \\
  --train_data_dir=$DATA_DIR \\
  --learnable_property="object" \\
  --placeholder_token="<cat-toy>" --initializer_token="toy" \\
  --resolution=512 \\
  --train_batch_size=1 \\
  --gradient_accumulation_steps=4 \\
  --max_train_steps=3000 \\
  --learning_rate=5.0e-04 --scale_lr \\
  --lr_scheduler="constant" \\
  --lr_warmup_steps=0 \\
  --output_dir="textual_inversion_cat"`,highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
<span class="hljs-built_in">export</span> DATA_DIR=<span class="hljs-string">&quot;path-to-dir-containing-images&quot;</span>

accelerate launch textual_inversion.py \\
  --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span> \\
  --train_data_dir=<span class="hljs-variable">$DATA_DIR</span> \\
  --learnable_property=<span class="hljs-string">&quot;object&quot;</span> \\
  --placeholder_token=<span class="hljs-string">&quot;&lt;cat-toy&gt;&quot;</span> --initializer_token=<span class="hljs-string">&quot;toy&quot;</span> \\
  --resolution=512 \\
  --train_batch_size=1 \\
  --gradient_accumulation_steps=4 \\
  --max_train_steps=3000 \\
  --learning_rate=5.0e-04 --scale_lr \\
  --lr_scheduler=<span class="hljs-string">&quot;constant&quot;</span> \\
  --lr_warmup_steps=0 \\
  --output_dir=<span class="hljs-string">&quot;textual_inversion_cat&quot;</span>`}}),be=new ye({}),we=new ot({props:{code:`from diffusers import StableDiffusionPipeline

model_id = "path-to-your-trained-model"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda")

prompt = "A <cat-toy> backpack"

image = pipe(prompt, num_inference_steps=50, guidance_scale=7.5).images[0]

image.save("cat-backpack.png")`,highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline

model_id = <span class="hljs-string">&quot;path-to-your-trained-model&quot;</span>
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)

prompt = <span class="hljs-string">&quot;A &lt;cat-toy&gt; backpack&quot;</span>

image = pipe(prompt, num_inference_steps=<span class="hljs-number">50</span>, guidance_scale=<span class="hljs-number">7.5</span>).images[<span class="hljs-number">0</span>]

image.save(<span class="hljs-string">&quot;cat-backpack.png&quot;</span>)`}}),{c(){x=a("meta"),at=u(),E=a("h1"),q=a("a"),Ce=a("span"),m(Y.$$.fragment),to=u(),He=a("span"),oo=p("Textual Inversion"),it=u(),$e=a("p"),ao=p("Textual Inversion is a technique for capturing novel concepts from a small number of example images in a way that can later be used to control text-to-image pipelines. It does so by learning new \u2018words\u2019 in the embedding space of the pipeline\u2019s text encoder. These special words can then be used within text prompts to achieve very fine-grained control of the resulting images."),nt=u(),D=a("p"),xe=a("img"),io=u(),F=a("em"),no=p("By using just 3-5 images you can teach new concepts to a model such as Stable Diffusion for personalized image generation ("),J=a("a"),ro=p("image source"),so=p(")."),rt=u(),c=a("p"),lo=p("This technique was introduced in "),V=a("a"),po=p("An Image is Worth One Word: Personalizing Text-to-Image Generation using Textual Inversion"),fo=p(". The paper demonstrated the concept using a "),Q=a("a"),uo=p("latent diffusion model"),ho=p(" but the idea has since been applied to other variants such as "),X=a("a"),co=p("Stable Diffusion"),mo=p("."),st=u(),k=a("h2"),j=a("a"),Re=a("span"),m(K.$$.fragment),vo=u(),Ge=a("span"),go=p("How It Works"),lt=u(),N=a("p"),Ee=a("img"),_o=u(),ke=a("em"),bo=p("Architecture Overview from the "),Z=a("a"),wo=p("textual inversion blog post"),pt=u(),Ae=a("p"),yo=p("Before a text prompt can be used in a diffusion model, it must first be processed into a numerical representation. This typically involves tokenizing the text, converting each token to an embedding and then feeding those embeddings through a model (typically a transformer) whose output will be used as the conditioning for the diffusion model."),ft=u(),Pe=a("p"),$o=p("Textual inversion learns a new token embedding (v* in the diagram above). A prompt (that includes a token which will be mapped to this new embedding) is used in conjunction with a noised version of one or more training images as inputs to the generator model, which attempts to predict the denoised version of the image. The embedding is optimized based on how well the model does at this task - an embedding that better captures the object or style shown by the training images will give more useful information to the diffusion model and thus result in a lower denoising loss. After many steps (typically several thousand) with a variety of prompt and image variants the learned embedding should hopefully capture the essence of the new concept being taught."),ut=u(),A=a("h2"),M=a("a"),Be=a("span"),m(ee.$$.fragment),xo=u(),Le=a("span"),Eo=p("Usage"),ht=u(),O=a("p"),ko=p("To train your own textual inversions, see the "),te=a("a"),Ao=p("example script here"),Po=p("."),ct=u(),oe=a("p"),Io=p(`There is also a notebook for training:
`),ae=a("a"),Ie=a("img"),mt=u(),ie=a("p"),To=p(`And one for inference:
`),ne=a("a"),Te=a("img"),dt=u(),z=a("p"),So=p("In addition to using concepts you have trained yourself, there is a community-created collection of trained textual inversions in the new "),re=a("a"),qo=p("Stable Diffusion public concepts library"),Do=p(" which you can also use from the inference notebook above. Over time this will hopefully grow into a useful resource as more examples are added."),vt=u(),P=a("h2"),C=a("a"),We=a("span"),m(se.$$.fragment),jo=u(),Ue=a("span"),No=p("Example: Running locally"),gt=u(),w=a("p"),Mo=p("The "),Ye=a("code"),Oo=p("textual_inversion.py"),zo=p(" script "),le=a("a"),Co=p("here"),Ho=p(" shows how to implement the training procedure and adapt it for stable diffusion."),_t=u(),I=a("h3"),H=a("a"),Fe=a("span"),m(pe.$$.fragment),Ro=u(),Je=a("span"),Go=p("Installing the dependencies"),bt=u(),Se=a("p"),Bo=p("Before running the scripts, make sure to install the library\u2019s training dependencies."),wt=u(),m(fe.$$.fragment),yt=u(),R=a("p"),Lo=p("And initialize an "),ue=a("a"),Wo=p("\u{1F917}Accelerate"),Uo=p(" environment with:"),$t=u(),m(he.$$.fragment),xt=u(),T=a("h3"),G=a("a"),Ve=a("span"),m(ce.$$.fragment),Yo=u(),Qe=a("span"),Fo=p("Cat toy example"),Et=u(),y=a("p"),Jo=p("You need to accept the model license before downloading or using the weights. In this example we\u2019ll use model version "),Xe=a("code"),Vo=p("v1-4"),Qo=p(", so you\u2019ll need to visit "),me=a("a"),Xo=p("its card"),Ko=p(", read the license and tick the checkbox if you agree."),kt=u(),B=a("p"),Zo=p("You have to be a registered user in \u{1F917} Hugging Face Hub, and you\u2019ll also need to use an access token for the code to work. For more information on access tokens, please refer to "),de=a("a"),ea=p("this section of the documentation"),ta=p("."),At=u(),qe=a("p"),oa=p("Run the following command to authenticate your token"),Pt=u(),m(ve.$$.fragment),It=u(),De=a("p"),aa=p("If you have already cloned the repo, then you won\u2019t need to go through these steps."),Tt=u(),St=a("br"),qt=u(),L=a("p"),ia=p("Now let\u2019s get our dataset.Download 3-4 images from "),ge=a("a"),na=p("here"),ra=p(" and save them in a directory. This will be our training data."),Dt=u(),je=a("p"),sa=p("And launch the training using"),jt=u(),m(_e.$$.fragment),Nt=u(),Ne=a("p"),la=p("A full training run takes ~1 hour on one V100 GPU."),Mt=u(),S=a("h3"),W=a("a"),Ke=a("span"),m(be.$$.fragment),pa=u(),Ze=a("span"),fa=p("Inference"),Ot=u(),$=a("p"),ua=p("Once you have trained a model using above command, the inference can be done simply using the "),et=a("code"),ha=p("StableDiffusionPipeline"),ca=p(". Make sure to include the "),tt=a("code"),ma=p("placeholder_token"),da=p(" in your prompt."),zt=u(),m(we.$$.fragment),this.h()},l(e){const n=wi('[data-svelte="svelte-1phssyn"]',document.head);x=i(n,"META",{name:!0,content:!0}),n.forEach(t),at=h(e),E=i(e,"H1",{class:!0});var Ht=r(E);q=i(Ht,"A",{id:!0,class:!0,href:!0});var Ea=r(q);Ce=i(Ea,"SPAN",{});var ka=r(Ce);d(Y.$$.fragment,ka),ka.forEach(t),Ea.forEach(t),to=h(Ht),He=i(Ht,"SPAN",{});var Aa=r(He);oo=f(Aa,"Textual Inversion"),Aa.forEach(t),Ht.forEach(t),it=h(e),$e=i(e,"P",{});var Pa=r($e);ao=f(Pa,"Textual Inversion is a technique for capturing novel concepts from a small number of example images in a way that can later be used to control text-to-image pipelines. It does so by learning new \u2018words\u2019 in the embedding space of the pipeline\u2019s text encoder. These special words can then be used within text prompts to achieve very fine-grained control of the resulting images."),Pa.forEach(t),nt=h(e),D=i(e,"P",{});var Rt=r(D);xe=i(Rt,"IMG",{src:!0,alt:!0}),io=h(Rt),F=i(Rt,"EM",{});var Gt=r(F);no=f(Gt,"By using just 3-5 images you can teach new concepts to a model such as Stable Diffusion for personalized image generation ("),J=i(Gt,"A",{href:!0,rel:!0});var Ia=r(J);ro=f(Ia,"image source"),Ia.forEach(t),so=f(Gt,")."),Gt.forEach(t),Rt.forEach(t),rt=h(e),c=i(e,"P",{});var U=r(c);lo=f(U,"This technique was introduced in "),V=i(U,"A",{href:!0,rel:!0});var Ta=r(V);po=f(Ta,"An Image is Worth One Word: Personalizing Text-to-Image Generation using Textual Inversion"),Ta.forEach(t),fo=f(U,". The paper demonstrated the concept using a "),Q=i(U,"A",{href:!0,rel:!0});var Sa=r(Q);uo=f(Sa,"latent diffusion model"),Sa.forEach(t),ho=f(U," but the idea has since been applied to other variants such as "),X=i(U,"A",{href:!0,rel:!0});var qa=r(X);co=f(qa,"Stable Diffusion"),qa.forEach(t),mo=f(U,"."),U.forEach(t),st=h(e),k=i(e,"H2",{class:!0});var Bt=r(k);j=i(Bt,"A",{id:!0,class:!0,href:!0});var Da=r(j);Re=i(Da,"SPAN",{});var ja=r(Re);d(K.$$.fragment,ja),ja.forEach(t),Da.forEach(t),vo=h(Bt),Ge=i(Bt,"SPAN",{});var Na=r(Ge);go=f(Na,"How It Works"),Na.forEach(t),Bt.forEach(t),lt=h(e),N=i(e,"P",{});var Lt=r(N);Ee=i(Lt,"IMG",{src:!0,alt:!0}),_o=h(Lt),ke=i(Lt,"EM",{});var va=r(ke);bo=f(va,"Architecture Overview from the "),Z=i(va,"A",{href:!0,rel:!0});var Ma=r(Z);wo=f(Ma,"textual inversion blog post"),Ma.forEach(t),va.forEach(t),Lt.forEach(t),pt=h(e),Ae=i(e,"P",{});var Oa=r(Ae);yo=f(Oa,"Before a text prompt can be used in a diffusion model, it must first be processed into a numerical representation. This typically involves tokenizing the text, converting each token to an embedding and then feeding those embeddings through a model (typically a transformer) whose output will be used as the conditioning for the diffusion model."),Oa.forEach(t),ft=h(e),Pe=i(e,"P",{});var za=r(Pe);$o=f(za,"Textual inversion learns a new token embedding (v* in the diagram above). A prompt (that includes a token which will be mapped to this new embedding) is used in conjunction with a noised version of one or more training images as inputs to the generator model, which attempts to predict the denoised version of the image. The embedding is optimized based on how well the model does at this task - an embedding that better captures the object or style shown by the training images will give more useful information to the diffusion model and thus result in a lower denoising loss. After many steps (typically several thousand) with a variety of prompt and image variants the learned embedding should hopefully capture the essence of the new concept being taught."),za.forEach(t),ut=h(e),A=i(e,"H2",{class:!0});var Wt=r(A);M=i(Wt,"A",{id:!0,class:!0,href:!0});var Ca=r(M);Be=i(Ca,"SPAN",{});var Ha=r(Be);d(ee.$$.fragment,Ha),Ha.forEach(t),Ca.forEach(t),xo=h(Wt),Le=i(Wt,"SPAN",{});var Ra=r(Le);Eo=f(Ra,"Usage"),Ra.forEach(t),Wt.forEach(t),ht=h(e),O=i(e,"P",{});var Ut=r(O);ko=f(Ut,"To train your own textual inversions, see the "),te=i(Ut,"A",{href:!0,rel:!0});var Ga=r(te);Ao=f(Ga,"example script here"),Ga.forEach(t),Po=f(Ut,"."),Ut.forEach(t),ct=h(e),oe=i(e,"P",{});var ga=r(oe);Io=f(ga,`There is also a notebook for training:
`),ae=i(ga,"A",{href:!0,rel:!0});var Ba=r(ae);Ie=i(Ba,"IMG",{src:!0,alt:!0}),Ba.forEach(t),ga.forEach(t),mt=h(e),ie=i(e,"P",{});var _a=r(ie);To=f(_a,`And one for inference:
`),ne=i(_a,"A",{href:!0,rel:!0});var La=r(ne);Te=i(La,"IMG",{src:!0,alt:!0}),La.forEach(t),_a.forEach(t),dt=h(e),z=i(e,"P",{});var Yt=r(z);So=f(Yt,"In addition to using concepts you have trained yourself, there is a community-created collection of trained textual inversions in the new "),re=i(Yt,"A",{href:!0,rel:!0});var Wa=r(re);qo=f(Wa,"Stable Diffusion public concepts library"),Wa.forEach(t),Do=f(Yt," which you can also use from the inference notebook above. Over time this will hopefully grow into a useful resource as more examples are added."),Yt.forEach(t),vt=h(e),P=i(e,"H2",{class:!0});var Ft=r(P);C=i(Ft,"A",{id:!0,class:!0,href:!0});var Ua=r(C);We=i(Ua,"SPAN",{});var Ya=r(We);d(se.$$.fragment,Ya),Ya.forEach(t),Ua.forEach(t),jo=h(Ft),Ue=i(Ft,"SPAN",{});var Fa=r(Ue);No=f(Fa,"Example: Running locally"),Fa.forEach(t),Ft.forEach(t),gt=h(e),w=i(e,"P",{});var Me=r(w);Mo=f(Me,"The "),Ye=i(Me,"CODE",{});var Ja=r(Ye);Oo=f(Ja,"textual_inversion.py"),Ja.forEach(t),zo=f(Me," script "),le=i(Me,"A",{href:!0,rel:!0});var Va=r(le);Co=f(Va,"here"),Va.forEach(t),Ho=f(Me," shows how to implement the training procedure and adapt it for stable diffusion."),Me.forEach(t),_t=h(e),I=i(e,"H3",{class:!0});var Jt=r(I);H=i(Jt,"A",{id:!0,class:!0,href:!0});var Qa=r(H);Fe=i(Qa,"SPAN",{});var Xa=r(Fe);d(pe.$$.fragment,Xa),Xa.forEach(t),Qa.forEach(t),Ro=h(Jt),Je=i(Jt,"SPAN",{});var Ka=r(Je);Go=f(Ka,"Installing the dependencies"),Ka.forEach(t),Jt.forEach(t),bt=h(e),Se=i(e,"P",{});var Za=r(Se);Bo=f(Za,"Before running the scripts, make sure to install the library\u2019s training dependencies."),Za.forEach(t),wt=h(e),d(fe.$$.fragment,e),yt=h(e),R=i(e,"P",{});var Vt=r(R);Lo=f(Vt,"And initialize an "),ue=i(Vt,"A",{href:!0,rel:!0});var ei=r(ue);Wo=f(ei,"\u{1F917}Accelerate"),ei.forEach(t),Uo=f(Vt," environment with:"),Vt.forEach(t),$t=h(e),d(he.$$.fragment,e),xt=h(e),T=i(e,"H3",{class:!0});var Qt=r(T);G=i(Qt,"A",{id:!0,class:!0,href:!0});var ti=r(G);Ve=i(ti,"SPAN",{});var oi=r(Ve);d(ce.$$.fragment,oi),oi.forEach(t),ti.forEach(t),Yo=h(Qt),Qe=i(Qt,"SPAN",{});var ai=r(Qe);Fo=f(ai,"Cat toy example"),ai.forEach(t),Qt.forEach(t),Et=h(e),y=i(e,"P",{});var Oe=r(y);Jo=f(Oe,"You need to accept the model license before downloading or using the weights. In this example we\u2019ll use model version "),Xe=i(Oe,"CODE",{});var ii=r(Xe);Vo=f(ii,"v1-4"),ii.forEach(t),Qo=f(Oe,", so you\u2019ll need to visit "),me=i(Oe,"A",{href:!0,rel:!0});var ni=r(me);Xo=f(ni,"its card"),ni.forEach(t),Ko=f(Oe,", read the license and tick the checkbox if you agree."),Oe.forEach(t),kt=h(e),B=i(e,"P",{});var Xt=r(B);Zo=f(Xt,"You have to be a registered user in \u{1F917} Hugging Face Hub, and you\u2019ll also need to use an access token for the code to work. For more information on access tokens, please refer to "),de=i(Xt,"A",{href:!0,rel:!0});var ri=r(de);ea=f(ri,"this section of the documentation"),ri.forEach(t),ta=f(Xt,"."),Xt.forEach(t),At=h(e),qe=i(e,"P",{});var si=r(qe);oa=f(si,"Run the following command to authenticate your token"),si.forEach(t),Pt=h(e),d(ve.$$.fragment,e),It=h(e),De=i(e,"P",{});var li=r(De);aa=f(li,"If you have already cloned the repo, then you won\u2019t need to go through these steps."),li.forEach(t),Tt=h(e),St=i(e,"BR",{}),qt=h(e),L=i(e,"P",{});var Kt=r(L);ia=f(Kt,"Now let\u2019s get our dataset.Download 3-4 images from "),ge=i(Kt,"A",{href:!0,rel:!0});var pi=r(ge);na=f(pi,"here"),pi.forEach(t),ra=f(Kt," and save them in a directory. This will be our training data."),Kt.forEach(t),Dt=h(e),je=i(e,"P",{});var fi=r(je);sa=f(fi,"And launch the training using"),fi.forEach(t),jt=h(e),d(_e.$$.fragment,e),Nt=h(e),Ne=i(e,"P",{});var ui=r(Ne);la=f(ui,"A full training run takes ~1 hour on one V100 GPU."),ui.forEach(t),Mt=h(e),S=i(e,"H3",{class:!0});var Zt=r(S);W=i(Zt,"A",{id:!0,class:!0,href:!0});var hi=r(W);Ke=i(hi,"SPAN",{});var ci=r(Ke);d(be.$$.fragment,ci),ci.forEach(t),hi.forEach(t),pa=h(Zt),Ze=i(Zt,"SPAN",{});var mi=r(Ze);fa=f(mi,"Inference"),mi.forEach(t),Zt.forEach(t),Ot=h(e),$=i(e,"P",{});var ze=r($);ua=f(ze,"Once you have trained a model using above command, the inference can be done simply using the "),et=i(ze,"CODE",{});var di=r(et);ha=f(di,"StableDiffusionPipeline"),di.forEach(t),ca=f(ze,". Make sure to include the "),tt=i(ze,"CODE",{});var vi=r(tt);ma=f(vi,"placeholder_token"),vi.forEach(t),da=f(ze," in your prompt."),ze.forEach(t),zt=h(e),d(we.$$.fragment,e),this.h()},h(){s(x,"name","hf:doc:metadata"),s(x,"content",JSON.stringify(Ei)),s(q,"id","textual-inversion"),s(q,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),s(q,"href","#textual-inversion"),s(E,"class","relative group"),eo(xe.src,wa="https://textual-inversion.github.io/static/images/editing/colorful_teapot.JPG")||s(xe,"src",wa),s(xe,"alt","Textual Inversion example"),s(J,"href","https://github.com/rinongal/textual_inversion"),s(J,"rel","nofollow"),s(V,"href","https://arxiv.org/abs/2208.01618"),s(V,"rel","nofollow"),s(Q,"href","https://github.com/CompVis/latent-diffusion"),s(Q,"rel","nofollow"),s(X,"href","https://huggingface.co/docs/diffusers/main/en/conceptual/stable_diffusion"),s(X,"rel","nofollow"),s(j,"id","how-it-works"),s(j,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),s(j,"href","#how-it-works"),s(k,"class","relative group"),eo(Ee.src,ya="https://textual-inversion.github.io/static/images/training/training.JPG")||s(Ee,"src",ya),s(Ee,"alt","Diagram from the paper showing overview"),s(Z,"href","https://textual-inversion.github.io/"),s(Z,"rel","nofollow"),s(M,"id","usage"),s(M,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),s(M,"href","#usage"),s(A,"class","relative group"),s(te,"href","https://github.com/huggingface/diffusers/tree/main/examples/textual_inversion"),s(te,"rel","nofollow"),eo(Ie.src,$a="https://colab.research.google.com/assets/colab-badge.svg")||s(Ie,"src",$a),s(Ie,"alt","Open In Colab"),s(ae,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/sd_textual_inversion_training.ipynb"),s(ae,"rel","nofollow"),eo(Te.src,xa="https://colab.research.google.com/assets/colab-badge.svg")||s(Te,"src",xa),s(Te,"alt","Open In Colab"),s(ne,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/stable_conceptualizer_inference.ipynb"),s(ne,"rel","nofollow"),s(re,"href","https://huggingface.co/sd-concepts-library"),s(re,"rel","nofollow"),s(C,"id","example-running-locally"),s(C,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),s(C,"href","#example-running-locally"),s(P,"class","relative group"),s(le,"href","https://github.com/huggingface/diffusers/blob/main/examples/textual_inversion"),s(le,"rel","nofollow"),s(H,"id","installing-the-dependencies"),s(H,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),s(H,"href","#installing-the-dependencies"),s(I,"class","relative group"),s(ue,"href","https://github.com/huggingface/accelerate/"),s(ue,"rel","nofollow"),s(G,"id","cat-toy-example"),s(G,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),s(G,"href","#cat-toy-example"),s(T,"class","relative group"),s(me,"href","https://huggingface.co/CompVis/stable-diffusion-v1-4"),s(me,"rel","nofollow"),s(de,"href","https://huggingface.co/docs/hub/security-tokens"),s(de,"rel","nofollow"),s(ge,"href","https://drive.google.com/drive/folders/1fmJMs25nxS_rSNqS5hTcRdLem_YQXbq5"),s(ge,"rel","nofollow"),s(W,"id","inference"),s(W,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),s(W,"href","#inference"),s(S,"class","relative group")},m(e,n){o(document.head,x),l(e,at,n),l(e,E,n),o(E,q),o(q,Ce),v(Y,Ce,null),o(E,to),o(E,He),o(He,oo),l(e,it,n),l(e,$e,n),o($e,ao),l(e,nt,n),l(e,D,n),o(D,xe),o(D,io),o(D,F),o(F,no),o(F,J),o(J,ro),o(F,so),l(e,rt,n),l(e,c,n),o(c,lo),o(c,V),o(V,po),o(c,fo),o(c,Q),o(Q,uo),o(c,ho),o(c,X),o(X,co),o(c,mo),l(e,st,n),l(e,k,n),o(k,j),o(j,Re),v(K,Re,null),o(k,vo),o(k,Ge),o(Ge,go),l(e,lt,n),l(e,N,n),o(N,Ee),o(N,_o),o(N,ke),o(ke,bo),o(ke,Z),o(Z,wo),l(e,pt,n),l(e,Ae,n),o(Ae,yo),l(e,ft,n),l(e,Pe,n),o(Pe,$o),l(e,ut,n),l(e,A,n),o(A,M),o(M,Be),v(ee,Be,null),o(A,xo),o(A,Le),o(Le,Eo),l(e,ht,n),l(e,O,n),o(O,ko),o(O,te),o(te,Ao),o(O,Po),l(e,ct,n),l(e,oe,n),o(oe,Io),o(oe,ae),o(ae,Ie),l(e,mt,n),l(e,ie,n),o(ie,To),o(ie,ne),o(ne,Te),l(e,dt,n),l(e,z,n),o(z,So),o(z,re),o(re,qo),o(z,Do),l(e,vt,n),l(e,P,n),o(P,C),o(C,We),v(se,We,null),o(P,jo),o(P,Ue),o(Ue,No),l(e,gt,n),l(e,w,n),o(w,Mo),o(w,Ye),o(Ye,Oo),o(w,zo),o(w,le),o(le,Co),o(w,Ho),l(e,_t,n),l(e,I,n),o(I,H),o(H,Fe),v(pe,Fe,null),o(I,Ro),o(I,Je),o(Je,Go),l(e,bt,n),l(e,Se,n),o(Se,Bo),l(e,wt,n),v(fe,e,n),l(e,yt,n),l(e,R,n),o(R,Lo),o(R,ue),o(ue,Wo),o(R,Uo),l(e,$t,n),v(he,e,n),l(e,xt,n),l(e,T,n),o(T,G),o(G,Ve),v(ce,Ve,null),o(T,Yo),o(T,Qe),o(Qe,Fo),l(e,Et,n),l(e,y,n),o(y,Jo),o(y,Xe),o(Xe,Vo),o(y,Qo),o(y,me),o(me,Xo),o(y,Ko),l(e,kt,n),l(e,B,n),o(B,Zo),o(B,de),o(de,ea),o(B,ta),l(e,At,n),l(e,qe,n),o(qe,oa),l(e,Pt,n),v(ve,e,n),l(e,It,n),l(e,De,n),o(De,aa),l(e,Tt,n),l(e,St,n),l(e,qt,n),l(e,L,n),o(L,ia),o(L,ge),o(ge,na),o(L,ra),l(e,Dt,n),l(e,je,n),o(je,sa),l(e,jt,n),v(_e,e,n),l(e,Nt,n),l(e,Ne,n),o(Ne,la),l(e,Mt,n),l(e,S,n),o(S,W),o(W,Ke),v(be,Ke,null),o(S,pa),o(S,Ze),o(Ze,fa),l(e,Ot,n),l(e,$,n),o($,ua),o($,et),o(et,ha),o($,ca),o($,tt),o(tt,ma),o($,da),l(e,zt,n),v(we,e,n),Ct=!0},p:yi,i(e){Ct||(g(Y.$$.fragment,e),g(K.$$.fragment,e),g(ee.$$.fragment,e),g(se.$$.fragment,e),g(pe.$$.fragment,e),g(fe.$$.fragment,e),g(he.$$.fragment,e),g(ce.$$.fragment,e),g(ve.$$.fragment,e),g(_e.$$.fragment,e),g(be.$$.fragment,e),g(we.$$.fragment,e),Ct=!0)},o(e){_(Y.$$.fragment,e),_(K.$$.fragment,e),_(ee.$$.fragment,e),_(se.$$.fragment,e),_(pe.$$.fragment,e),_(fe.$$.fragment,e),_(he.$$.fragment,e),_(ce.$$.fragment,e),_(ve.$$.fragment,e),_(_e.$$.fragment,e),_(be.$$.fragment,e),_(we.$$.fragment,e),Ct=!1},d(e){t(x),e&&t(at),e&&t(E),b(Y),e&&t(it),e&&t($e),e&&t(nt),e&&t(D),e&&t(rt),e&&t(c),e&&t(st),e&&t(k),b(K),e&&t(lt),e&&t(N),e&&t(pt),e&&t(Ae),e&&t(ft),e&&t(Pe),e&&t(ut),e&&t(A),b(ee),e&&t(ht),e&&t(O),e&&t(ct),e&&t(oe),e&&t(mt),e&&t(ie),e&&t(dt),e&&t(z),e&&t(vt),e&&t(P),b(se),e&&t(gt),e&&t(w),e&&t(_t),e&&t(I),b(pe),e&&t(bt),e&&t(Se),e&&t(wt),b(fe,e),e&&t(yt),e&&t(R),e&&t($t),b(he,e),e&&t(xt),e&&t(T),b(ce),e&&t(Et),e&&t(y),e&&t(kt),e&&t(B),e&&t(At),e&&t(qe),e&&t(Pt),b(ve,e),e&&t(It),e&&t(De),e&&t(Tt),e&&t(St),e&&t(qt),e&&t(L),e&&t(Dt),e&&t(je),e&&t(jt),b(_e,e),e&&t(Nt),e&&t(Ne),e&&t(Mt),e&&t(S),b(be),e&&t(Ot),e&&t($),e&&t(zt),b(we,e)}}}const Ei={local:"textual-inversion",sections:[{local:"how-it-works",title:"How It Works"},{local:"usage",title:"Usage"},{local:"example-running-locally",sections:[{local:"installing-the-dependencies",title:"Installing the dependencies"},{local:"cat-toy-example",title:"Cat toy example"},{local:"inference",title:"Inference"}],title:"Example: Running locally "}],title:"Textual Inversion"};function ki(ba){return $i(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ti extends gi{constructor(x){super();_i(this,x,ki,xi,bi,{})}}export{Ti as default,Ei as metadata};
