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Ul,_o,Ml,Wl,lt,Zl,Bl,nt,Fl,Hl,N,Eo,st,yo,Jl,jl,bo,zl,Vl,it,Xl,Yl,ft,Ql,Kl,$,xo,dt,wo,en,tn,To,on,rn,ht,an,ln,ct,nn,sn,G,Do,ut,ko,fn,dn,Ao,hn,cn,pt,un,pn,mt,mn,vn,P,Io,vt,So,gn,_n,Ro,En,yn,gt,bn,xn,_t,wn,nr,U,j,Oo,ge,Tn,No,Dn,sr,m,kn,$o,An,In,Go,Sn,Rn,Po,On,Nn,_e,$n,Gn,Co,Pn,Cn,Ee,Ln,qn,Lo,Un,Mn,ir,M,z,qo,ye,Wn,Uo,Zn,fr,V,Bn,Mo,Fn,Hn,dr,be,hr,Et,Jn,cr,xe,ur;return ie=new ts({}),ge=new ts({}),ye=new ts({}),be=new kf({props:{code:"Z2l0JTIwY2xvbmUlMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZodWdnaW5nZmFjZSUyRmRpZmZ1c2VycyUwQWNkJTIwZGlmZnVzZXJzJTBBcGlwJTIwaW5zdGFsbCUyMC4=",highlighted:`git <span class="hljs-built_in">clone</span> https://github.com/huggingface/diffusers
<span class="hljs-built_in">cd</span> diffusers
pip install .`}}),xe=new kf({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1yJTIwcmVxdWlyZW1lbnRzLnR4dA==",highlighted:"pip install -r requirements.txt"}}),{c(){L=o("meta"),Vo=f(),q=o("h1"),W=o("a"),yt=o("span"),Bo(ie.$$.fragment),br=f(),bt=o("span"),xr=l("\u{1F9E8} Diffusers Training Examples"),Xo=f(),Z=o("p"),wr=l("Diffusers training examples are a collection of scripts to demonstrate how to effectively use the "),xt=o("code"),Tr=l("diffusers"),Dr=l(` library
for a variety of use cases.`),Yo=f(),T=o("p"),wt=o("strong"),kr=l("Note"),Ar=l(": If you are looking for "),Tt=o("strong"),Ir=l("official"),Sr=l(" examples on how to use "),Dt=o("code"),Rr=l("diffusers"),Or=l(` for inference,
please have a look at `),fe=o("a"),Nr=l("src/diffusers/pipelines"),Qo=f(),x=o("p"),$r=l("Our examples aspire to be "),kt=o("strong"),Gr=l("self-contained"),Pr=l(", "),At=o("strong"),Cr=l("easy-to-tweak"),Lr=l(", "),It=o("strong"),qr=l("beginner-friendly"),Ur=l(" and for "),St=o("strong"),Mr=l("one-purpose-only"),Wr=l(`.
More specifically, this means:`),Ko=f(),D=o("ul"),v=o("li"),Rt=o("strong"),Zr=l("Self-contained"),Br=l(": An example script shall only depend on \u201Cpip-install-able\u201D Python packages that can be found in a "),Ot=o("code"),Fr=l("requirements.txt"),Hr=l(" file. Example scripts shall "),Nt=o("strong"),Jr=l("not"),jr=l(" depend on any local files. This means that one can simply download an example script, "),$t=o("em"),zr=l("e.g."),Vr=f(),de=o("a"),Xr=l("train_unconditional.py"),Yr=l(", install the required dependencies, "),Gt=o("em"),Qr=l("e.g."),Kr=f(),he=o("a"),ea=l("requirements.txt"),ta=l(" and execute the example script."),oa=f(),we=o("li"),Pt=o("strong"),ra=l("Easy-to-tweak"),aa=l(": While we strive to present as many use cases as possible, the example scripts are just that - examples. It is expected that they won\u2019t work out-of-the box on your specific problem and that you will be required to change a few lines of code to adapt them to your needs. To help you with that, most of the examples fully expose the preprocessing of the data and the training loop to allow you to tweak and edit them as required."),la=f(),B=o("li"),Ct=o("strong"),na=l("Beginner-friendly"),sa=l(": We do not aim for providing state-of-the-art training scripts for the newest models, but rather examples that can be used as a way to better understand diffusion models and how to use them with the "),Lt=o("code"),ia=l("diffusers"),fa=l(" library. We often purposefully leave out certain state-of-the-art methods if we consider them too complex for beginners."),da=f(),F=o("li"),qt=o("strong"),ha=l("One-purpose-only"),ca=l(`: Examples should show one task and one task only. Even if a task is from a modeling
point of view very similar, `),Ut=o("em"),ua=l("e.g."),pa=l(" image super-resolution and image modification tend to use the same model and training method, we want examples to showcase only one task to keep them as readable and easy-to-understand as possible."),er=f(),g=o("p"),ma=l("We provide "),Mt=o("strong"),va=l("official"),ga=l(` examples that cover the most popular tasks of diffusion models.
`),Wt=o("em"),_a=l("Official"),Ea=l(" examples are "),Zt=o("strong"),ya=l("actively"),ba=l(" maintained by the "),Bt=o("code"),xa=l("diffusers"),wa=l(` maintainers and we try to rigorously follow our example philosophy as defined above.
If you feel like another important example should exist, we are more than happy to welcome a `),ce=o("a"),Ta=l("Feature Request"),Da=l(" or directly a "),ue=o("a"),ka=l("Pull Request"),Aa=l(" from you!"),tr=f(),Te=o("p"),Ia=l("Training examples show how to pretrain or fine-tune diffusion models for a variety of tasks. Currently we support:"),or=f(),u=o("ul"),Ft=o("li"),De=o("a"),Sa=l("Unconditional Training"),Ra=f(),ke=o("li"),Ae=o("a"),Oa=l("Text-to-Image Training"),Ht=o("sup"),Na=l("*"),$a=f(),Jt=o("li"),Ie=o("a"),Ga=l("Text Inversion"),Pa=f(),Se=o("li"),Re=o("a"),Ca=l("Dreambooth"),jt=o("sup"),La=l("*"),qa=f(),Oe=o("li"),Ne=o("a"),Ua=l("LoRA Support"),zt=o("sup"),Ma=l("*"),Wa=f(),$e=o("li"),Ge=o("a"),Za=l("ControlNet"),Vt=o("sup"),Ba=l("*"),Fa=f(),Pe=o("li"),Ce=o("a"),Ha=l("InstructPix2Pix"),Xt=o("sup"),Ja=l("*"),ja=f(),Yt=o("li"),Le=o("a"),za=l("Custom Diffusion"),Va=f(),qe=o("li"),Ue=o("a"),Xa=l("T2I-Adapters"),Qt=o("sup"),Ya=l("*"),rr=f(),Me=o("sup"),Qa=l("*"),ar=l(`: Supports [Stable Diffusion XL](../api/pipelines/stable_diffusion/stable_diffusion_xl).
`),H=o("p"),Ka=l("If possible, please "),We=o("a"),el=l("install xFormers"),tl=l(" for memory efficient attention. This could help make your training faster and less memory intensive."),lr=f(),J=o("table"),Kt=o("thead"),k=o("tr"),eo=o("th"),ol=l("Task"),rl=f(),to=o("th"),al=l("\u{1F917} Accelerate"),ll=f(),Ze=o("th"),nl=l("\u{1F917} Datasets"),sl=f(),Be=o("th"),il=l("Colab"),fl=f(),p=o("tbody"),A=o("tr"),oo=o("td"),Fe=o("a"),ro=o("strong"),dl=l("Unconditional Image Generation"),hl=f(),ao=o("td"),cl=l("\u2705"),ul=f(),He=o("td"),pl=l("\u2705"),ml=f(),Je=o("td"),pe=o("a"),je=o("img"),vl=f(),I=o("tr"),lo=o("td"),ze=o("a"),no=o("strong"),gl=l("Text-to-Image fine-tuning"),_l=f(),so=o("td"),El=l("\u2705"),yl=f(),Ve=o("td"),bl=l("\u2705"),xl=f(),io=o("td"),wl=f(),S=o("tr"),fo=o("td"),Xe=o("a"),ho=o("strong"),Tl=l("Textual Inversion"),Dl=f(),co=o("td"),kl=l("\u2705"),Al=f(),Ye=o("td"),Il=l("-"),Sl=f(),Qe=o("td"),me=o("a"),Ke=o("img"),Rl=f(),R=o("tr"),uo=o("td"),et=o("a"),po=o("strong"),Ol=l("Dreambooth"),Nl=f(),mo=o("td"),$l=l("\u2705"),Gl=f(),tt=o("td"),Pl=l("-"),Cl=f(),ot=o("td"),ve=o("a"),rt=o("img"),Ll=f(),O=o("tr"),vo=o("td"),at=o("a"),go=o("strong"),ql=l("Training with LoRA"),Ul=f(),_o=o("td"),Ml=l("\u2705"),Wl=f(),lt=o("td"),Zl=l("-"),Bl=f(),nt=o("td"),Fl=l("-"),Hl=f(),N=o("tr"),Eo=o("td"),st=o("a"),yo=o("strong"),Jl=l("ControlNet"),jl=f(),bo=o("td"),zl=l("\u2705"),Vl=f(),it=o("td"),Xl=l("\u2705"),Yl=f(),ft=o("td"),Ql=l("-"),Kl=f(),$=o("tr"),xo=o("td"),dt=o("a"),wo=o("strong"),en=l("InstructPix2Pix"),tn=f(),To=o("td"),on=l("\u2705"),rn=f(),ht=o("td"),an=l("\u2705"),ln=f(),ct=o("td"),nn=l("-"),sn=f(),G=o("tr"),Do=o("td"),ut=o("a"),ko=o("strong"),fn=l("Custom Diffusion"),dn=f(),Ao=o("td"),hn=l("\u2705"),cn=f(),pt=o("td"),un=l("\u2705"),pn=f(),mt=o("td"),mn=l("-"),vn=f(),P=o("tr"),Io=o("td"),vt=o("a"),So=o("strong"),gn=l("T2I Adapters"),_n=f(),Ro=o("td"),En=l("\u2705"),yn=f(),gt=o("td"),bn=l("\u2705"),xn=f(),_t=o("td"),wn=l("-"),nr=f(),U=o("h2"),j=o("a"),Oo=o("span"),Bo(ge.$$.fragment),Tn=f(),No=o("span"),Dn=l("Community"),sr=f(),m=o("p"),kn=l("In addition, we provide "),$o=o("strong"),An=l("community"),In=l(` examples, which are examples added and maintained by our community.
Community examples can consist of both `),Go=o("em"),Sn=l("training"),Rn=l(" examples or "),Po=o("em"),On=l("inference"),Nn=l(` pipelines.
For such examples, we are more lenient regarding the philosophy defined above and also cannot guarantee to provide maintenance for every issue.
Examples that are useful for the community, but are either not yet deemed popular or not yet following our above philosophy should go into the `),_e=o("a"),$n=l("community examples"),Gn=l(` folder. The community folder therefore includes training examples and inference pipelines.
`),Co=o("strong"),Pn=l("Note"),Cn=l(": Community examples can be a "),Ee=o("a"),Ln=l("great first contribution"),qn=l(" to show to the community how you like to use "),Lo=o("code"),Un=l("diffusers"),Mn=l(" \u{1FA84}."),ir=f(),M=o("h2"),z=o("a"),qo=o("span"),Bo(ye.$$.fragment),Wn=f(),Uo=o("span"),Zn=l("Important note"),fr=f(),V=o("p"),Bn=l("To make sure you can successfully run the latest versions of the example scripts, you have to "),Mo=o("strong"),Fn=l("install the library from source"),Hn=l(" and install some example-specific requirements. To do this, execute the following steps in a new virtual environment:"),dr=f(),Bo(be.$$.fragment),hr=f(),Et=o("p"),Jn=l("Then cd in the example folder of your choice and run"),cr=f(),Bo(xe.$$.fragment),this.h()},l(s){const h=Rf('[data-svelte="svelte-1phssyn"]',document.head);L=r(h,"META",{name:!0,content:!0}),h.forEach(t),Vo=d(s),q=r(s,"H1",{class:!0});var pr=a(q);W=r(pr,"A",{id:!0,class:!0,href:!0});var ns=a(W);yt=r(ns,"SPAN",{});var ss=a(yt);Fo(ie.$$.fragment,ss),ss.forEach(t),ns.forEach(t),br=d(pr),bt=r(pr,"SPAN",{});var is=a(bt);xr=n(is,"\u{1F9E8} Diffusers Training Examples"),is.forEach(t),pr.forEach(t),Xo=d(s),Z=r(s,"P",{});var mr=a(Z);wr=n(mr,"Diffusers training examples are a collection of scripts to demonstrate how to effectively use the "),xt=r(mr,"CODE",{});var fs=a(xt);Tr=n(fs,"diffusers"),fs.forEach(t),Dr=n(mr,` library
for a variety of use cases.`),mr.forEach(t),Yo=d(s),T=r(s,"P",{});var X=a(T);wt=r(X,"STRONG",{});var ds=a(wt);kr=n(ds,"Note"),ds.forEach(t),Ar=n(X,": If you are looking for "),Tt=r(X,"STRONG",{});var hs=a(Tt);Ir=n(hs,"official"),hs.forEach(t),Sr=n(X," examples on how to use "),Dt=r(X,"CODE",{});var cs=a(Dt);Rr=n(cs,"diffusers"),cs.forEach(t),Or=n(X,` for inference,
please have a look at `),fe=r(X,"A",{href:!0,rel:!0});var us=a(fe);Nr=n(us,"src/diffusers/pipelines"),us.forEach(t),X.forEach(t),Qo=d(s),x=r(s,"P",{});var C=a(x);$r=n(C,"Our examples aspire to be "),kt=r(C,"STRONG",{});var ps=a(kt);Gr=n(ps,"self-contained"),ps.forEach(t),Pr=n(C,", "),At=r(C,"STRONG",{});var ms=a(At);Cr=n(ms,"easy-to-tweak"),ms.forEach(t),Lr=n(C,", "),It=r(C,"STRONG",{});var vs=a(It);qr=n(vs,"beginner-friendly"),vs.forEach(t),Ur=n(C," and for "),St=r(C,"STRONG",{});var gs=a(St);Mr=n(gs,"one-purpose-only"),gs.forEach(t),Wr=n(C,`.
More specifically, this means:`),C.forEach(t),Ko=d(s),D=r(s,"UL",{});var Y=a(D);v=r(Y,"LI",{});var b=a(v);Rt=r(b,"STRONG",{});var _s=a(Rt);Zr=n(_s,"Self-contained"),_s.forEach(t),Br=n(b,": An example script shall only depend on \u201Cpip-install-able\u201D Python packages that can be found in a "),Ot=r(b,"CODE",{});var Es=a(Ot);Fr=n(Es,"requirements.txt"),Es.forEach(t),Hr=n(b," file. Example scripts shall "),Nt=r(b,"STRONG",{});var ys=a(Nt);Jr=n(ys,"not"),ys.forEach(t),jr=n(b," depend on any local files. This means that one can simply download an example script, "),$t=r(b,"EM",{});var bs=a($t);zr=n(bs,"e.g."),bs.forEach(t),Vr=d(b),de=r(b,"A",{href:!0,rel:!0});var xs=a(de);Xr=n(xs,"train_unconditional.py"),xs.forEach(t),Yr=n(b,", install the required dependencies, "),Gt=r(b,"EM",{});var ws=a(Gt);Qr=n(ws,"e.g."),ws.forEach(t),Kr=d(b),he=r(b,"A",{href:!0,rel:!0});var Ts=a(he);ea=n(Ts,"requirements.txt"),Ts.forEach(t),ta=n(b," and execute the example script."),b.forEach(t),oa=d(Y),we=r(Y,"LI",{});var jn=a(we);Pt=r(jn,"STRONG",{});var Ds=a(Pt);ra=n(Ds,"Easy-to-tweak"),Ds.forEach(t),aa=n(jn,": While we strive to present as many use cases as possible, the example scripts are just that - examples. It is expected that they won\u2019t work out-of-the box on your specific problem and that you will be required to change a few lines of code to adapt them to your needs. To help you with that, most of the examples fully expose the preprocessing of the data and the training loop to allow you to tweak and edit them as required."),jn.forEach(t),la=d(Y),B=r(Y,"LI",{});var Wo=a(B);Ct=r(Wo,"STRONG",{});var ks=a(Ct);na=n(ks,"Beginner-friendly"),ks.forEach(t),sa=n(Wo,": We do not aim for providing state-of-the-art training scripts for the newest models, but rather examples that can be used as a way to better understand diffusion models and how to use them with the "),Lt=r(Wo,"CODE",{});var As=a(Lt);ia=n(As,"diffusers"),As.forEach(t),fa=n(Wo," library. We often purposefully leave out certain state-of-the-art methods if we consider them too complex for beginners."),Wo.forEach(t),da=d(Y),F=r(Y,"LI",{});var Zo=a(F);qt=r(Zo,"STRONG",{});var Is=a(qt);ha=n(Is,"One-purpose-only"),Is.forEach(t),ca=n(Zo,`: Examples should show one task and one task only. Even if a task is from a modeling
point of view very similar, `),Ut=r(Zo,"EM",{});var Ss=a(Ut);ua=n(Ss,"e.g."),Ss.forEach(t),pa=n(Zo," image super-resolution and image modification tend to use the same model and training method, we want examples to showcase only one task to keep them as readable and easy-to-understand as possible."),Zo.forEach(t),Y.forEach(t),er=d(s),g=r(s,"P",{});var w=a(g);ma=n(w,"We provide "),Mt=r(w,"STRONG",{});var Rs=a(Mt);va=n(Rs,"official"),Rs.forEach(t),ga=n(w,` examples that cover the most popular tasks of diffusion models.
`),Wt=r(w,"EM",{});var Os=a(Wt);_a=n(Os,"Official"),Os.forEach(t),Ea=n(w," examples are "),Zt=r(w,"STRONG",{});var Ns=a(Zt);ya=n(Ns,"actively"),Ns.forEach(t),ba=n(w," maintained by the "),Bt=r(w,"CODE",{});var $s=a(Bt);xa=n($s,"diffusers"),$s.forEach(t),wa=n(w,` maintainers and we try to rigorously follow our example philosophy as defined above.
If you feel like another important example should exist, we are more than happy to welcome a `),ce=r(w,"A",{href:!0,rel:!0});var Gs=a(ce);Ta=n(Gs,"Feature Request"),Gs.forEach(t),Da=n(w," or directly a "),ue=r(w,"A",{href:!0,rel:!0});var Ps=a(ue);ka=n(Ps,"Pull Request"),Ps.forEach(t),Aa=n(w," from you!"),w.forEach(t),tr=d(s),Te=r(s,"P",{});var Cs=a(Te);Ia=n(Cs,"Training examples show how to pretrain or fine-tune diffusion models for a variety of tasks. Currently we support:"),Cs.forEach(t),or=d(s),u=r(s,"UL",{});var _=a(u);Ft=r(_,"LI",{});var Ls=a(Ft);De=r(Ls,"A",{href:!0});var qs=a(De);Sa=n(qs,"Unconditional Training"),qs.forEach(t),Ls.forEach(t),Ra=d(_),ke=r(_,"LI",{});var zn=a(ke);Ae=r(zn,"A",{href:!0});var Us=a(Ae);Oa=n(Us,"Text-to-Image Training"),Us.forEach(t),Ht=r(zn,"SUP",{});var Ms=a(Ht);Na=n(Ms,"*"),Ms.forEach(t),zn.forEach(t),$a=d(_),Jt=r(_,"LI",{});var Ws=a(Jt);Ie=r(Ws,"A",{href:!0});var Zs=a(Ie);Ga=n(Zs,"Text Inversion"),Zs.forEach(t),Ws.forEach(t),Pa=d(_),Se=r(_,"LI",{});var Vn=a(Se);Re=r(Vn,"A",{href:!0});var Bs=a(Re);Ca=n(Bs,"Dreambooth"),Bs.forEach(t),jt=r(Vn,"SUP",{});var Fs=a(jt);La=n(Fs,"*"),Fs.forEach(t),Vn.forEach(t),qa=d(_),Oe=r(_,"LI",{});var Xn=a(Oe);Ne=r(Xn,"A",{href:!0});var Hs=a(Ne);Ua=n(Hs,"LoRA Support"),Hs.forEach(t),zt=r(Xn,"SUP",{});var Js=a(zt);Ma=n(Js,"*"),Js.forEach(t),Xn.forEach(t),Wa=d(_),$e=r(_,"LI",{});var Yn=a($e);Ge=r(Yn,"A",{href:!0});var js=a(Ge);Za=n(js,"ControlNet"),js.forEach(t),Vt=r(Yn,"SUP",{});var zs=a(Vt);Ba=n(zs,"*"),zs.forEach(t),Yn.forEach(t),Fa=d(_),Pe=r(_,"LI",{});var Qn=a(Pe);Ce=r(Qn,"A",{href:!0});var Vs=a(Ce);Ha=n(Vs,"InstructPix2Pix"),Vs.forEach(t),Xt=r(Qn,"SUP",{});var Xs=a(Xt);Ja=n(Xs,"*"),Xs.forEach(t),Qn.forEach(t),ja=d(_),Yt=r(_,"LI",{});var Ys=a(Yt);Le=r(Ys,"A",{href:!0});var Qs=a(Le);za=n(Qs,"Custom Diffusion"),Qs.forEach(t),Ys.forEach(t),Va=d(_),qe=r(_,"LI",{});var Kn=a(qe);Ue=r(Kn,"A",{href:!0});var Ks=a(Ue);Xa=n(Ks,"T2I-Adapters"),Ks.forEach(t),Qt=r(Kn,"SUP",{});var ei=a(Qt);Ya=n(ei,"*"),ei.forEach(t),Kn.forEach(t),_.forEach(t),rr=d(s),Me=r(s,"SUP",{});var ti=a(Me);Qa=n(ti,"*"),ti.forEach(t),ar=n(s,`: Supports [Stable Diffusion XL](../api/pipelines/stable_diffusion/stable_diffusion_xl).
`),H=r(s,"P",{});var vr=a(H);Ka=n(vr,"If possible, please "),We=r(vr,"A",{href:!0});var oi=a(We);el=n(oi,"install xFormers"),oi.forEach(t),tl=n(vr," for memory efficient attention. This could help make your training faster and less memory intensive."),vr.forEach(t),lr=d(s),J=r(s,"TABLE",{});var gr=a(J);Kt=r(gr,"THEAD",{});var ri=a(Kt);k=r(ri,"TR",{});var Q=a(k);eo=r(Q,"TH",{});var ai=a(eo);ol=n(ai,"Task"),ai.forEach(t),rl=d(Q),to=r(Q,"TH",{});var li=a(to);al=n(li,"\u{1F917} Accelerate"),li.forEach(t),ll=d(Q),Ze=r(Q,"TH",{align:!0});var ni=a(Ze);nl=n(ni,"\u{1F917} Datasets"),ni.forEach(t),sl=d(Q),Be=r(Q,"TH",{align:!0});var si=a(Be);il=n(si,"Colab"),si.forEach(t),Q.forEach(t),ri.forEach(t),fl=d(gr),p=r(gr,"TBODY",{});var E=a(p);A=r(E,"TR",{});var K=a(A);oo=r(K,"TD",{});var ii=a(oo);Fe=r(ii,"A",{href:!0});var fi=a(Fe);ro=r(fi,"STRONG",{});var di=a(ro);dl=n(di,"Unconditional Image Generation"),di.forEach(t),fi.forEach(t),ii.forEach(t),hl=d(K),ao=r(K,"TD",{});var hi=a(ao);cl=n(hi,"\u2705"),hi.forEach(t),ul=d(K),He=r(K,"TD",{align:!0});var ci=a(He);pl=n(ci,"\u2705"),ci.forEach(t),ml=d(K),Je=r(K,"TD",{align:!0});var ui=a(Je);pe=r(ui,"A",{href:!0,rel:!0});var pi=a(pe);je=r(pi,"IMG",{src:!0,alt:!0}),pi.forEach(t),ui.forEach(t),K.forEach(t),vl=d(E),I=r(E,"TR",{});var ee=a(I);lo=r(ee,"TD",{});var mi=a(lo);ze=r(mi,"A",{href:!0});var vi=a(ze);no=r(vi,"STRONG",{});var gi=a(no);gl=n(gi,"Text-to-Image fine-tuning"),gi.forEach(t),vi.forEach(t),mi.forEach(t),_l=d(ee),so=r(ee,"TD",{});var _i=a(so);El=n(_i,"\u2705"),_i.forEach(t),yl=d(ee),Ve=r(ee,"TD",{align:!0});var Ei=a(Ve);bl=n(Ei,"\u2705"),Ei.forEach(t),xl=d(ee),io=r(ee,"TD",{align:!0}),a(io).forEach(t),ee.forEach(t),wl=d(E),S=r(E,"TR",{});var te=a(S);fo=r(te,"TD",{});var yi=a(fo);Xe=r(yi,"A",{href:!0});var bi=a(Xe);ho=r(bi,"STRONG",{});var xi=a(ho);Tl=n(xi,"Textual Inversion"),xi.forEach(t),bi.forEach(t),yi.forEach(t),Dl=d(te),co=r(te,"TD",{});var wi=a(co);kl=n(wi,"\u2705"),wi.forEach(t),Al=d(te),Ye=r(te,"TD",{align:!0});var Ti=a(Ye);Il=n(Ti,"-"),Ti.forEach(t),Sl=d(te),Qe=r(te,"TD",{align:!0});var Di=a(Qe);me=r(Di,"A",{href:!0,rel:!0});var ki=a(me);Ke=r(ki,"IMG",{src:!0,alt:!0}),ki.forEach(t),Di.forEach(t),te.forEach(t),Rl=d(E),R=r(E,"TR",{});var oe=a(R);uo=r(oe,"TD",{});var Ai=a(uo);et=r(Ai,"A",{href:!0});var Ii=a(et);po=r(Ii,"STRONG",{});var Si=a(po);Ol=n(Si,"Dreambooth"),Si.forEach(t),Ii.forEach(t),Ai.forEach(t),Nl=d(oe),mo=r(oe,"TD",{});var Ri=a(mo);$l=n(Ri,"\u2705"),Ri.forEach(t),Gl=d(oe),tt=r(oe,"TD",{align:!0});var Oi=a(tt);Pl=n(Oi,"-"),Oi.forEach(t),Cl=d(oe),ot=r(oe,"TD",{align:!0});var Ni=a(ot);ve=r(Ni,"A",{href:!0,rel:!0});var $i=a(ve);rt=r($i,"IMG",{src:!0,alt:!0}),$i.forEach(t),Ni.forEach(t),oe.forEach(t),Ll=d(E),O=r(E,"TR",{});var re=a(O);vo=r(re,"TD",{});var Gi=a(vo);at=r(Gi,"A",{href:!0});var Pi=a(at);go=r(Pi,"STRONG",{});var Ci=a(go);ql=n(Ci,"Training with LoRA"),Ci.forEach(t),Pi.forEach(t),Gi.forEach(t),Ul=d(re),_o=r(re,"TD",{});var Li=a(_o);Ml=n(Li,"\u2705"),Li.forEach(t),Wl=d(re),lt=r(re,"TD",{align:!0});var qi=a(lt);Zl=n(qi,"-"),qi.forEach(t),Bl=d(re),nt=r(re,"TD",{align:!0});var Ui=a(nt);Fl=n(Ui,"-"),Ui.forEach(t),re.forEach(t),Hl=d(E),N=r(E,"TR",{});var ae=a(N);Eo=r(ae,"TD",{});var Mi=a(Eo);st=r(Mi,"A",{href:!0});var Wi=a(st);yo=r(Wi,"STRONG",{});var Zi=a(yo);Jl=n(Zi,"ControlNet"),Zi.forEach(t),Wi.forEach(t),Mi.forEach(t),jl=d(ae),bo=r(ae,"TD",{});var Bi=a(bo);zl=n(Bi,"\u2705"),Bi.forEach(t),Vl=d(ae),it=r(ae,"TD",{align:!0});var Fi=a(it);Xl=n(Fi,"\u2705"),Fi.forEach(t),Yl=d(ae),ft=r(ae,"TD",{align:!0});var Hi=a(ft);Ql=n(Hi,"-"),Hi.forEach(t),ae.forEach(t),Kl=d(E),$=r(E,"TR",{});var le=a($);xo=r(le,"TD",{});var Ji=a(xo);dt=r(Ji,"A",{href:!0});var ji=a(dt);wo=r(ji,"STRONG",{});var zi=a(wo);en=n(zi,"InstructPix2Pix"),zi.forEach(t),ji.forEach(t),Ji.forEach(t),tn=d(le),To=r(le,"TD",{});var Vi=a(To);on=n(Vi,"\u2705"),Vi.forEach(t),rn=d(le),ht=r(le,"TD",{align:!0});var Xi=a(ht);an=n(Xi,"\u2705"),Xi.forEach(t),ln=d(le),ct=r(le,"TD",{align:!0});var Yi=a(ct);nn=n(Yi,"-"),Yi.forEach(t),le.forEach(t),sn=d(E),G=r(E,"TR",{});var ne=a(G);Do=r(ne,"TD",{});var Qi=a(Do);ut=r(Qi,"A",{href:!0});var Ki=a(ut);ko=r(Ki,"STRONG",{});var ef=a(ko);fn=n(ef,"Custom Diffusion"),ef.forEach(t),Ki.forEach(t),Qi.forEach(t),dn=d(ne),Ao=r(ne,"TD",{});var tf=a(Ao);hn=n(tf,"\u2705"),tf.forEach(t),cn=d(ne),pt=r(ne,"TD",{align:!0});var of=a(pt);un=n(of,"\u2705"),of.forEach(t),pn=d(ne),mt=r(ne,"TD",{align:!0});var rf=a(mt);mn=n(rf,"-"),rf.forEach(t),ne.forEach(t),vn=d(E),P=r(E,"TR",{});var se=a(P);Io=r(se,"TD",{});var af=a(Io);vt=r(af,"A",{href:!0});var lf=a(vt);So=r(lf,"STRONG",{});var nf=a(So);gn=n(nf,"T2I Adapters"),nf.forEach(t),lf.forEach(t),af.forEach(t),_n=d(se),Ro=r(se,"TD",{});var sf=a(Ro);En=n(sf,"\u2705"),sf.forEach(t),yn=d(se),gt=r(se,"TD",{align:!0});var ff=a(gt);bn=n(ff,"\u2705"),ff.forEach(t),xn=d(se),_t=r(se,"TD",{align:!0});var df=a(_t);wn=n(df,"-"),df.forEach(t),se.forEach(t),E.forEach(t),gr.forEach(t),nr=d(s),U=r(s,"H2",{class:!0});var _r=a(U);j=r(_r,"A",{id:!0,class:!0,href:!0});var hf=a(j);Oo=r(hf,"SPAN",{});var cf=a(Oo);Fo(ge.$$.fragment,cf),cf.forEach(t),hf.forEach(t),Tn=d(_r),No=r(_r,"SPAN",{});var uf=a(No);Dn=n(uf,"Community"),uf.forEach(t),_r.forEach(t),sr=d(s),m=r(s,"P",{});var y=a(m);kn=n(y,"In addition, we provide "),$o=r(y,"STRONG",{});var pf=a($o);An=n(pf,"community"),pf.forEach(t),In=n(y,` examples, which are examples added and maintained by our community.
Community examples can consist of both `),Go=r(y,"EM",{});var mf=a(Go);Sn=n(mf,"training"),mf.forEach(t),Rn=n(y," examples or "),Po=r(y,"EM",{});var vf=a(Po);On=n(vf,"inference"),vf.forEach(t),Nn=n(y,` pipelines.
For such examples, we are more lenient regarding the philosophy defined above and also cannot guarantee to provide maintenance for every issue.
Examples that are useful for the community, but are either not yet deemed popular or not yet following our above philosophy should go into the `),_e=r(y,"A",{href:!0,rel:!0});var gf=a(_e);$n=n(gf,"community examples"),gf.forEach(t),Gn=n(y,` folder. The community folder therefore includes training examples and inference pipelines.
`),Co=r(y,"STRONG",{});var _f=a(Co);Pn=n(_f,"Note"),_f.forEach(t),Cn=n(y,": Community examples can be a "),Ee=r(y,"A",{href:!0,rel:!0});var Ef=a(Ee);Ln=n(Ef,"great first contribution"),Ef.forEach(t),qn=n(y," to show to the community how you like to use "),Lo=r(y,"CODE",{});var yf=a(Lo);Un=n(yf,"diffusers"),yf.forEach(t),Mn=n(y," \u{1FA84}."),y.forEach(t),ir=d(s),M=r(s,"H2",{class:!0});var Er=a(M);z=r(Er,"A",{id:!0,class:!0,href:!0});var bf=a(z);qo=r(bf,"SPAN",{});var xf=a(qo);Fo(ye.$$.fragment,xf),xf.forEach(t),bf.forEach(t),Wn=d(Er),Uo=r(Er,"SPAN",{});var wf=a(Uo);Zn=n(wf,"Important note"),wf.forEach(t),Er.forEach(t),fr=d(s),V=r(s,"P",{});var yr=a(V);Bn=n(yr,"To make sure you can successfully run the latest versions of the example scripts, you have to "),Mo=r(yr,"STRONG",{});var Tf=a(Mo);Fn=n(Tf,"install the library from source"),Tf.forEach(t),Hn=n(yr," and install some example-specific requirements. To do this, execute the following steps in a new virtual environment:"),yr.forEach(t),dr=d(s),Fo(be.$$.fragment,s),hr=d(s),Et=r(s,"P",{});var Df=a(Et);Jn=n(Df,"Then cd in the example folder of your choice and run"),Df.forEach(t),cr=d(s),Fo(xe.$$.fragment,s),this.h()},h(){i(L,"name","hf:doc:metadata"),i(L,"content",JSON.stringify(Gf)),i(W,"id","diffusers-training-examples"),i(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"),i(W,"href","#diffusers-training-examples"),i(q,"class","relative group"),i(fe,"href","https://github.com/huggingface/diffusers/tree/main/src/diffusers/pipelines"),i(fe,"rel","nofollow"),i(de,"href","https://github.com/huggingface/diffusers/blob/main/examples/unconditional_image_generation/train_unconditional.py"),i(de,"rel","nofollow"),i(he,"href","https://github.com/huggingface/diffusers/blob/main/examples/unconditional_image_generation/requirements.txt"),i(he,"rel","nofollow"),i(ce,"href","https://github.com/huggingface/diffusers/issues/new?assignees=&labels=&template=feature_request.md&title="),i(ce,"rel","nofollow"),i(ue,"href","https://github.com/huggingface/diffusers/compare"),i(ue,"rel","nofollow"),i(De,"href","./unconditional_training"),i(Ae,"href","./text2image"),i(Ie,"href","./text_inversion"),i(Re,"href","./dreambooth"),i(Ne,"href","./lora"),i(Ge,"href","./controlnet"),i(Ce,"href","./instructpix2pix"),i(Le,"href","./custom_diffusion"),i(Ue,"href","./t2i_adapters"),i(We,"href","../optimization/xformers"),i(Ze,"align","center"),i(Be,"align","center"),i(Fe,"href","./unconditional_training"),i(He,"align","center"),es(je.src,rs="https://colab.research.google.com/assets/colab-badge.svg")||i(je,"src",rs),i(je,"alt","Open In Colab"),i(pe,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/training_example.ipynb"),i(pe,"rel","nofollow"),i(Je,"align","center"),i(ze,"href","./text2image"),i(Ve,"align","center"),i(io,"align","center"),i(Xe,"href","./text_inversion"),i(Ye,"align","center"),es(Ke.src,as="https://colab.research.google.com/assets/colab-badge.svg")||i(Ke,"src",as),i(Ke,"alt","Open In Colab"),i(me,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/sd_textual_inversion_training.ipynb"),i(me,"rel","nofollow"),i(Qe,"align","center"),i(et,"href","./dreambooth"),i(tt,"align","center"),es(rt.src,ls="https://colab.research.google.com/assets/colab-badge.svg")||i(rt,"src",ls),i(rt,"alt","Open In Colab"),i(ve,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/sd_dreambooth_training.ipynb"),i(ve,"rel","nofollow"),i(ot,"align","center"),i(at,"href","./lora"),i(lt,"align","center"),i(nt,"align","center"),i(st,"href","./controlnet"),i(it,"align","center"),i(ft,"align","center"),i(dt,"href","./instructpix2pix"),i(ht,"align","center"),i(ct,"align","center"),i(ut,"href","./custom_diffusion"),i(pt,"align","center"),i(mt,"align","center"),i(vt,"href","./t2i_adapters"),i(gt,"align","center"),i(_t,"align","center"),i(j,"id","community"),i(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"),i(j,"href","#community"),i(U,"class","relative group"),i(_e,"href","https://github.com/huggingface/diffusers/tree/main/examples/community"),i(_e,"rel","nofollow"),i(Ee,"href","https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22"),i(Ee,"rel","nofollow"),i(z,"id","important-note"),i(z,"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"),i(z,"href","#important-note"),i(M,"class","relative group")},m(s,h){e(document.head,L),c(s,Vo,h),c(s,q,h),e(q,W),e(W,yt),Ho(ie,yt,null),e(q,br),e(q,bt),e(bt,xr),c(s,Xo,h),c(s,Z,h),e(Z,wr),e(Z,xt),e(xt,Tr),e(Z,Dr),c(s,Yo,h),c(s,T,h),e(T,wt),e(wt,kr),e(T,Ar),e(T,Tt),e(Tt,Ir),e(T,Sr),e(T,Dt),e(Dt,Rr),e(T,Or),e(T,fe),e(fe,Nr),c(s,Qo,h),c(s,x,h),e(x,$r),e(x,kt),e(kt,Gr),e(x,Pr),e(x,At),e(At,Cr),e(x,Lr),e(x,It),e(It,qr),e(x,Ur),e(x,St),e(St,Mr),e(x,Wr),c(s,Ko,h),c(s,D,h),e(D,v),e(v,Rt),e(Rt,Zr),e(v,Br),e(v,Ot),e(Ot,Fr),e(v,Hr),e(v,Nt),e(Nt,Jr),e(v,jr),e(v,$t),e($t,zr),e(v,Vr),e(v,de),e(de,Xr),e(v,Yr),e(v,Gt),e(Gt,Qr),e(v,Kr),e(v,he),e(he,ea),e(v,ta),e(D,oa),e(D,we),e(we,Pt),e(Pt,ra),e(we,aa),e(D,la),e(D,B),e(B,Ct),e(Ct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o),e(lo,ze),e(ze,no),e(no,gl),e(I,_l),e(I,so),e(so,El),e(I,yl),e(I,Ve),e(Ve,bl),e(I,xl),e(I,io),e(p,wl),e(p,S),e(S,fo),e(fo,Xe),e(Xe,ho),e(ho,Tl),e(S,Dl),e(S,co),e(co,kl),e(S,Al),e(S,Ye),e(Ye,Il),e(S,Sl),e(S,Qe),e(Qe,me),e(me,Ke),e(p,Rl),e(p,R),e(R,uo),e(uo,et),e(et,po),e(po,Ol),e(R,Nl),e(R,mo),e(mo,$l),e(R,Gl),e(R,tt),e(tt,Pl),e(R,Cl),e(R,ot),e(ot,ve),e(ve,rt),e(p,Ll),e(p,O),e(O,vo),e(vo,at),e(at,go),e(go,ql),e(O,Ul),e(O,_o),e(_o,Ml),e(O,Wl),e(O,lt),e(lt,Zl),e(O,Bl),e(O,nt),e(nt,Fl),e(p,Hl),e(p,N),e(N,Eo),e(Eo,st),e(st,yo),e(yo,Jl),e(N,jl),e(N,bo),e(bo,zl),e(N,Vl),e(N,it),e(it,Xl),e(N,Yl),e(N,ft),e(ft,Ql),e(p,Kl),e(p,$),e($,xo),e(xo,dt),e(dt,wo),e(wo,en),e($,tn),e($,To),e(To,on),e($,rn),e($,ht),e(ht,an),e($,ln),e($,ct),e(ct,nn),e(p,sn),e(p,G),e(G,Do),e(Do,ut),e(ut,ko),e(ko,fn),e(G,dn),e(G,Ao),e(Ao,hn),e(G,cn),e(G,pt),e(pt,un),e(G,pn),e(G,mt),e(mt,mn),e(p,vn),e(p,P),e(P,Io),e(Io,vt),e(vt,So),e(So,gn),e(P,_n),e(P,Ro),e(Ro,En),e(P,yn),e(P,gt),e(gt,bn),e(P,xn),e(P,_t),e(_t,wn),c(s,nr,h),c(s,U,h),e(U,j),e(j,Oo),Ho(ge,Oo,null),e(U,Tn),e(U,No),e(No,Dn),c(s,sr,h),c(s,m,h),e(m,kn),e(m,$o),e($o,An),e(m,In),e(m,Go),e(Go,Sn),e(m,Rn),e(m,Po),e(Po,On),e(m,Nn),e(m,_e),e(_e,$n),e(m,Gn),e(m,Co),e(Co,Pn),e(m,Cn),e(m,Ee),e(Ee,Ln),e(m,qn),e(m,Lo),e(Lo,Un),e(m,Mn),c(s,ir,h),c(s,M,h),e(M,z),e(z,qo),Ho(ye,qo,null),e(M,Wn),e(M,Uo),e(Uo,Zn),c(s,fr,h),c(s,V,h),e(V,Bn),e(V,Mo),e(Mo,Fn),e(V,Hn),c(s,dr,h),Ho(be,s,h),c(s,hr,h),c(s,Et,h),e(Et,Jn),c(s,cr,h),Ho(xe,s,h),ur=!0},p:Of,i(s){ur||(Jo(ie.$$.fragment,s),Jo(ge.$$.fragment,s),Jo(ye.$$.fragment,s),Jo(be.$$.fragment,s),Jo(xe.$$.fragment,s),ur=!0)},o(s){jo(ie.$$.fragment,s),jo(ge.$$.fragment,s),jo(ye.$$.fragment,s),jo(be.$$.fragment,s),jo(xe.$$.fragment,s),ur=!1},d(s){t(L),s&&t(Vo),s&&t(q),zo(ie),s&&t(Xo),s&&t(Z),s&&t(Yo),s&&t(T),s&&t(Qo),s&&t(x),s&&t(Ko),s&&t(D),s&&t(er),s&&t(g),s&&t(tr),s&&t(Te),s&&t(or),s&&t(u),s&&t(rr),s&&t(Me),s&&t(ar),s&&t(H),s&&t(lr),s&&t(J),s&&t(nr),s&&t(U),zo(ge),s&&t(sr),s&&t(m),s&&t(ir),s&&t(M),zo(ye),s&&t(fr),s&&t(V),s&&t(dr),zo(be,s),s&&t(hr),s&&t(Et),s&&t(cr),zo(xe,s)}}}const Gf={local:"diffusers-training-examples",sections:[{local:"community",title:"Community"},{local:"important-note",title:"Important note"}],title:"\u{1F9E8} Diffusers Training Examples"};function Pf(os){return Nf(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Uf extends Af{constructor(L){super();If(this,L,Pf,$f,Sf,{})}}export{Uf as default,Gf as metadata};
