import{S as Nh,i as Ah,s as Fh,e as i,k as r,w as _,t as n,M as Bh,c as s,d as o,m as d,a as l,x as b,h as a,b as p,N as jh,G as e,g as f,y as v,q as w,o as y,B as E,v as Rh,L as Wh}from"../../../../chunks/vendor-hf-doc-builder.js";import{D as k}from"../../../../chunks/Docstring-hf-doc-builder.js";import{C as G}from"../../../../chunks/CodeBlock-hf-doc-builder.js";import{I as Z}from"../../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Gh}from"../../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Vh(to){let S,j,L,D,J;return D=new G({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uWExQaXBlbGluZSUwQSUwQXBpcGUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25YTFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0wLjklMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpJTBBcGlwZSUyMCUzRCUyMHBpcGUudG8oJTIyY3VkYSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJhJTIwcGhvdG8lMjBvZiUyMGFuJTIwYXN0cm9uYXV0JTIwcmlkaW5nJTIwYSUyMGhvcnNlJTIwb24lMjBtYXJzJTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKHByb21wdCkuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLPipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = StableDiffusionXLPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-0.9&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;a photo of an astronaut riding a horse on mars&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(prompt).images[<span class="hljs-number">0</span>]`}}),{c(){S=i("p"),j=n("Examples:"),L=r(),_(D.$$.fragment)},l(M){S=s(M,"P",{});var P=l(S);j=a(P,"Examples:"),P.forEach(o),L=d(M),b(D.$$.fragment,M)},m(M,P){f(M,S,P),e(S,j),f(M,L,P),v(D,M,P),J=!0},p:Wh,i(M){J||(w(D.$$.fragment,M),J=!0)},o(M){y(D.$$.fragment,M),J=!1},d(M){M&&o(S),M&&o(L),E(D,M)}}}function zh(to){let S,j,L,D,J;return D=new G({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uWExJbWcySW1nUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUwQSUwQXBpcGUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25YTEltZzJJbWdQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLXJlZmluZXItMC45JTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKSUwQXBpcGUlMjAlM0QlMjBwaXBlLnRvKCUyMmN1ZGElMjIpJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGcGF0cmlja3ZvbnBsYXRlbiUyRmltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGYWFfeGwlMkYwMDAwMDAwMDkucG5nJTIyJTBBJTBBaW5pdF9pbWFnZSUyMCUzRCUyMGxvYWRfaW1hZ2UodXJsKS5jb252ZXJ0KCUyMlJHQiUyMiklMEFwcm9tcHQlMjAlM0QlMjAlMjJhJTIwcGhvdG8lMjBvZiUyMGFuJTIwYXN0cm9uYXV0JTIwcmlkaW5nJTIwYSUyMGhvcnNlJTIwb24lMjBtYXJzJTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKHByb21wdCUyQyUyMGltYWdlJTNEaW5pdF9pbWFnZSkuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLImg2ImgPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = StableDiffusionXLImg2ImgPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-refiner-0.9&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/aa_xl/000000009.png&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>init_image = load_image(url).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;a photo of an astronaut riding a horse on mars&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(prompt, image=init_image).images[<span class="hljs-number">0</span>]`}}),{c(){S=i("p"),j=n("Examples:"),L=r(),_(D.$$.fragment)},l(M){S=s(M,"P",{});var P=l(S);j=a(P,"Examples:"),P.forEach(o),L=d(M),b(D.$$.fragment,M)},m(M,P){f(M,S,P),e(S,j),f(M,L,P),v(D,M,P),J=!0},p:Wh,i(M){J||(w(D.$$.fragment,M),J=!0)},o(M){y(D.$$.fragment,M),J=!1},d(M){M&&o(S),M&&o(L),E(D,M)}}}function Oh(to){let S,j,L,D,J,M,P,jo,el,$i,ve,tl,ze,ol,nl,Ti,oo,al,Di,no,Go,il,Si,ee,we,Wo,Oe,sl,No,ll,Li,ye,Ao,rl,dl,Fo,pl,ki,te,Ee,Bo,Ye,cl,Ro,fl,Pi,Me,oe,Vo,ml,ul,qe,gl,hl,ao,_l,bl,ne,zo,vl,wl,He,yl,El,io,Ml,Ji,ae,Ie,Oo,Qe,Il,Yo,xl,Ui,U,$l,qo,Tl,Dl,Ho,Sl,Ll,Qo,kl,Pl,Ko,Jl,Ul,Xi,Ke,Ci,ie,xe,en,et,Xl,tn,Cl,Zi,$e,Zl,on,jl,Gl,ji,tt,Gi,se,Te,nn,ot,Wl,an,Nl,Wi,W,Al,nt,Fl,Bl,sn,Rl,Vl,Ni,at,Ai,le,De,ln,it,zl,rn,Ol,Fi,st,Bi,Se,dn,lt,pn,Yl,ql,cn,Hl,Ql,fn,rt,mn,un,vm,Kl,gn,hn,wm,Ri,re,Le,_n,dt,er,bn,tr,Vi,N,or,so,nr,ar,vn,ir,sr,zi,pt,Oi,de,ke,wn,ct,lr,yn,rr,Yi,Pe,dr,lo,pr,cr,qi,ft,Hi,ro,fr,Qi,mt,Ki,pe,Je,En,ut,mr,po,ur,Mn,gr,es,A,hr,In,_r,br,xn,vr,wr,ts,gt,os,ce,Ue,$n,ht,yr,_t,Er,Tn,Mr,Ir,ns,fe,Dn,xr,$r,Sn,Tr,Dr,as,bt,is,vt,ss,me,Xe,Ln,wt,Sr,kn,Lr,ls,I,yt,kr,Pn,Pr,Jr,Et,Ur,co,Xr,Cr,Zr,Jn,jr,Gr,ue,Mt,Un,Wr,Nr,fo,Ar,Fr,It,Xn,Br,Rr,mo,Vr,zr,xt,Cn,Or,Yr,uo,qr,Hr,Zn,Qr,Kr,jn,$t,Gn,ed,td,go,od,nd,F,Tt,ad,Wn,id,sd,Ce,ld,Ze,Dt,rd,St,dd,Nn,pd,cd,fd,je,Lt,md,kt,ud,An,gd,hd,_d,Ge,Pt,bd,X,vd,Fn,wd,yd,Bn,Ed,Md,Rn,Id,xd,Vn,$d,Td,Dd,We,Jt,Sd,ge,Ld,zn,kd,Pd,On,Jd,Ud,Xd,B,Ut,Cd,Yn,Zd,jd,qn,Gd,Wd,R,Xt,Nd,Hn,Ad,Fd,Qn,Bd,Rd,V,Ct,Vd,Kn,zd,Od,m,Yd,ea,qd,Hd,ta,Qd,Kd,oa,ep,tp,na,op,np,aa,ap,ip,ia,sp,lp,sa,rp,dp,la,pp,cp,ra,fp,mp,da,up,gp,pa,hp,_p,ca,bp,vp,fa,wp,yp,ma,Ep,Mp,ua,Ip,xp,ga,$p,Tp,ha,Dp,Sp,_a,Lp,kp,ba,Pp,Jp,va,Up,Xp,wa,Cp,Zp,ya,jp,Gp,Ea,Wp,Np,Ma,Ap,Fp,Ia,Bp,Rp,xa,Vp,zp,$a,Op,Yp,rs,he,Ne,Ta,Zt,qp,Da,Hp,ds,x,jt,Qp,Sa,Kp,ec,Gt,tc,ho,oc,nc,ac,La,ic,sc,_e,Wt,ka,lc,rc,_o,dc,pc,Nt,Pa,cc,fc,bo,mc,uc,At,Ja,gc,hc,vo,_c,bc,Ua,vc,wc,Xa,Ft,Ca,yc,Ec,wo,Mc,Ic,z,Bt,xc,Za,$c,Tc,Ae,Dc,Fe,Rt,Sc,Vt,Lc,ja,kc,Pc,Jc,Be,zt,Uc,Ot,Xc,Ga,Cc,Zc,jc,Re,Yt,Gc,C,Wc,Wa,Nc,Ac,Na,Fc,Bc,Aa,Rc,Vc,Fa,zc,Oc,Yc,Ve,qt,qc,be,Hc,Ba,Qc,Kc,Ra,ef,tf,of,O,Ht,nf,Va,af,sf,za,lf,rf,Y,Qt,df,Oa,pf,cf,Ya,ff,mf,q,Kt,uf,qa,gf,hf,u,_f,Ha,bf,vf,Qa,wf,yf,Ka,Ef,Mf,ei,If,xf,ti,$f,Tf,oi,Df,Sf,ni,Lf,kf,ai,Pf,Jf,ii,Uf,Xf,si,Cf,Zf,li,jf,Gf,ri,Wf,Nf,di,Af,Ff,pi,Bf,Rf,ci,Vf,zf,fi,Of,Yf,mi,qf,Hf,ui,Qf,Kf,gi,em,tm,hi,om,nm,_i,am,im,bi,sm,lm,vi,rm,dm,wi,pm,cm,yi,fm,mm,Ei,um,gm,Mi,hm,_m,ps;return M=new Z({}),Oe=new Z({}),Ye=new Z({}),Qe=new Z({}),Ke=new G({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUwQXBpcCUyMGluc3RhbGwlMjBhY2NlbGVyYXRlJTBBcGlwJTIwaW5zdGFsbCUyMHNhZmV0ZW5zb3JzJTBBcGlwJTIwaW5zdGFsbCUyMGludmlzaWJsZS13YXRlcm1hcmslM0UlM0QyLjA=",highlighted:`pip <span class="hljs-keyword">install</span> transformers
pip <span class="hljs-keyword">install</span> accelerate
pip <span class="hljs-keyword">install</span> safetensors
pip <span class="hljs-keyword">install</span> invisible-watermark&gt;=<span class="hljs-number">2.0</span>`}}),et=new Z({}),tt=new G({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25YTFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0wLjklMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUlMEEpJTBBcGlwZS50byglMjJjdWRhJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkFzdHJvbmF1dCUyMGluJTIwYSUyMGp1bmdsZSUyQyUyMGNvbGQlMjBjb2xvciUyMHBhbGV0dGUlMkMlMjBtdXRlZCUyMGNvbG9ycyUyQyUyMGRldGFpbGVkJTJDJTIwOGslMjIlMEFpbWFnZSUyMCUzRCUyMHBpcGUocHJvbXB0JTNEcHJvbXB0KS5pbWFnZXMlNUIwJTVE",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLPipeline
<span class="hljs-keyword">import</span> torch

pipe = StableDiffusionXLPipeline.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-0.9&quot;</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>
)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

prompt = <span class="hljs-string">&quot;Astronaut in a jungle, cold color palette, muted colors, detailed, 8k&quot;</span>
image = pipe(prompt=prompt).images[<span class="hljs-number">0</span>]`}}),ot=new Z({}),at=new G({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUlMkMlMjBTdGFibGVEaWZmdXNpb25YTEltZzJJbWdQaXBlbGluZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi14bC1iYXNlLTAuOSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyJTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUwQSklMEFwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBdXNlX3JlZmluZXIlMjAlM0QlMjBUcnVlJTBBcmVmaW5lciUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblhMSW1nMkltZ1BpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtcmVmaW5lci0wLjklMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlJTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIlMEEpJTBBcmVmaW5lci50byglMjJjdWRhJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkFzdHJvbmF1dCUyMGluJTIwYSUyMGp1bmdsZSUyQyUyMGNvbGQlMjBjb2xvciUyMHBhbGV0dGUlMkMlMjBtdXRlZCUyMGNvbG9ycyUyQyUyMGRldGFpbGVkJTJDJTIwOGslMjIlMEElMEFpbWFnZSUyMCUzRCUyMHBpcGUocHJvbXB0JTNEcHJvbXB0JTJDJTIwb3V0cHV0X3R5cGUlM0QlMjJsYXRlbnQlMjIlMjBpZiUyMHVzZV9yZWZpbmVyJTIwZWxzZSUyMCUyMnBpbCUyMikuaW1hZ2VzJTVCMCU1RCUwQWltYWdlJTIwJTNEJTIwcmVmaW5lcihwcm9tcHQlM0Rwcm9tcHQlMkMlMjBpbWFnZSUzRGltYWdlJTVCTm9uZSUyQyUyMCUzQSU1RCkuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLPipeline, StableDiffusionXLImg2ImgPipeline
<span class="hljs-keyword">import</span> torch

pipe = StableDiffusionXLPipeline.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-0.9&quot;</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>
)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

use_refiner = <span class="hljs-literal">True</span>
refiner = StableDiffusionXLImg2ImgPipeline.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-refiner-0.9&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>
)
refiner.to(<span class="hljs-string">&quot;cuda&quot;</span>)

prompt = <span class="hljs-string">&quot;Astronaut in a jungle, cold color palette, muted colors, detailed, 8k&quot;</span>

image = pipe(prompt=prompt, output_type=<span class="hljs-string">&quot;latent&quot;</span> <span class="hljs-keyword">if</span> use_refiner <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;pil&quot;</span>).images[<span class="hljs-number">0</span>]
image = refiner(prompt=prompt, image=image[<span class="hljs-literal">None</span>, :]).images[<span class="hljs-number">0</span>]`}}),it=new Z({}),st=new G({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uWExJbWcySW1nUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUwQSUwQXBpcGUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25YTEltZzJJbWdQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLXJlZmluZXItMC45JTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKSUwQXBpcGUlMjAlM0QlMjBwaXBlLnRvKCUyMmN1ZGElMjIpJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGcGF0cmlja3ZvbnBsYXRlbiUyRmltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGYWFfeGwlMkYwMDAwMDAwMDkucG5nJTIyJTBBJTBBaW5pdF9pbWFnZSUyMCUzRCUyMGxvYWRfaW1hZ2UodXJsKS5jb252ZXJ0KCUyMlJHQiUyMiklMEFwcm9tcHQlMjAlM0QlMjAlMjJhJTIwcGhvdG8lMjBvZiUyMGFuJTIwYXN0cm9uYXV0JTIwcmlkaW5nJTIwYSUyMGhvcnNlJTIwb24lMjBtYXJzJTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKHByb21wdCUyQyUyMGltYWdlJTNEaW5pdF9pbWFnZSkuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLImg2ImgPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image

pipe = StableDiffusionXLImg2ImgPipeline.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-refiner-0.9&quot;</span>, torch_dtype=torch.float16
)
pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
url = <span class="hljs-string">&quot;https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/aa_xl/000000009.png&quot;</span>

init_image = load_image(url).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
prompt = <span class="hljs-string">&quot;a photo of an astronaut riding a horse on mars&quot;</span>
image = pipe(prompt, image=init_image).images[<span class="hljs-number">0</span>]`}}),dt=new Z({}),pt=new G({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUlMkMlMjBTdGFibGVEaWZmdXNpb25YTEltZzJJbWdQaXBlbGluZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi14bC1iYXNlLTAuOSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyJTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUwQSklMEFwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBcmVmaW5lciUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblhMSW1nMkltZ1BpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtcmVmaW5lci0wLjklMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlJTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIlMEEpJTBBcmVmaW5lci50byglMjJjdWRhJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLPipeline, StableDiffusionXLImg2ImgPipeline
<span class="hljs-keyword">import</span> torch

pipe = StableDiffusionXLPipeline.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-0.9&quot;</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>
)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

refiner = StableDiffusionXLImg2ImgPipeline.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-refiner-0.9&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>
)
refiner.to(<span class="hljs-string">&quot;cuda&quot;</span>)`}}),ct=new Z({}),ft=new G({props:{code:"LSUyMHBpcGUudG8oJTIyY3VkYSUyMiklMEElMkIlMjBwaXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgp",highlighted:`<span class="hljs-deletion">- pipe.to(&quot;cuda&quot;)</span>
<span class="hljs-addition">+ pipe.enable_model_cpu_offload()</span>`}}),mt=new G({props:{code:"LSUyMHJlZmluZXIudG8oJTIyY3VkYSUyMiklMEElMkIlMjByZWZpbmVyLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgp",highlighted:`<span class="hljs-deletion">- refiner.to(&quot;cuda&quot;)</span>
<span class="hljs-addition">+ refiner.enable_model_cpu_offload()</span>`}}),ut=new Z({}),gt=new G({props:{code:"JTJCJTIwcGlwZS51bmV0JTIwJTNEJTIwdG9yY2guY29tcGlsZShwaXBlLnVuZXQlMkMlMjBtb2RlJTNEJTIycmVkdWNlLW92ZXJoZWFkJTIyJTJDJTIwZnVsbGdyYXBoJTNEVHJ1ZSklMEElMkIlMjByZWZpbmVyLnVuZXQlMjAlM0QlMjB0b3JjaC5jb21waWxlKHJlZmluZXIudW5ldCUyQyUyMG1vZGUlM0QlMjJyZWR1Y2Utb3ZlcmhlYWQlMjIlMkMlMjBmdWxsZ3JhcGglM0RUcnVlKQ==",highlighted:`<span class="hljs-addition">+ pipe.unet = torch.compile(pipe.unet, mode=&quot;reduce-overhead&quot;, fullgraph=True)</span>
<span class="hljs-addition">+ refiner.unet = torch.compile(refiner.unet, mode=&quot;reduce-overhead&quot;, fullgraph=True)</span>`}}),ht=new Z({}),bt=new G({props:{code:"cGlwJTIwaW5zdGFsbCUyMHhmb3JtZXJz",highlighted:'pip <span class="hljs-keyword">install</span> xformers'}}),vt=new G({props:{code:"JTJCcGlwZS5lbmFibGVfeGZvcm1lcnNfbWVtb3J5X2VmZmljaWVudF9hdHRlbnRpb24oKSUwQSUyQnJlZmluZXIuZW5hYmxlX3hmb3JtZXJzX21lbW9yeV9lZmZpY2llbnRfYXR0ZW50aW9uKCk=",highlighted:`<span class="hljs-addition">+pipe.enable_xformers_memory_efficient_attention()</span>
<span class="hljs-addition">+refiner.enable_xformers_memory_efficient_attention()</span>`}}),wt=new Z({}),yt=new k({props:{name:"class diffusers.StableDiffusionXLPipeline",anchor:"diffusers.StableDiffusionXLPipeline",parameters:[{name:"vae",val:": AutoencoderKL"},{name:"text_encoder",val:": CLIPTextModel"},{name:"text_encoder_2",val:": CLIPTextModelWithProjection"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"tokenizer_2",val:": CLIPTokenizer"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": KarrasDiffusionSchedulers"},{name:"force_zeros_for_empty_prompt",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.StableDiffusionXLPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/v0.18.2/en/api/models/autoencoderkl#diffusers.AutoencoderKL">AutoencoderKL</a>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.`,name:"vae"},{anchor:"diffusers.StableDiffusionXLPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>CLIPTextModel</code>) &#x2014;
Frozen text-encoder. Stable Diffusion uses the text portion of
<a href="https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModel" rel="nofollow">CLIP</a>, specifically
the <a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a> variant.`,name:"text_encoder"},{anchor:"diffusers.StableDiffusionXLPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>CLIPTokenizer</code>) &#x2014;
Tokenizer of class
<a href="https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>.`,name:"tokenizer"},{anchor:"diffusers.StableDiffusionXLPipeline.unet",description:'<strong>unet</strong> (<a href="/docs/diffusers/v0.18.2/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014; Conditional U-Net architecture to denoise the encoded image latents.',name:"unet"},{anchor:"diffusers.StableDiffusionXLPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.18.2/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to denoise the encoded image latents. Can be one of
<a href="/docs/diffusers/v0.18.2/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.18.2/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.18.2/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L76"}}),Tt=new k({props:{name:"__call__",anchor:"diffusers.StableDiffusionXLPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 5.0"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"pooled_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_pooled_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"guidance_rescale",val:": float = 0.0"},{name:"original_size",val:": typing.Union[typing.Tuple[int, int], NoneType] = None"},{name:"crops_coords_top_left",val:": typing.Tuple[int, int] = (0, 0)"},{name:"target_size",val:": typing.Union[typing.Tuple[int, int], NoneType] = None"}],parametersDescription:[{anchor:"diffusers.StableDiffusionXLPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size * self.vae_scale_factor) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size * self.vae_scale_factor) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/v0.18.2/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.pooled_prompt_embeds",description:`<strong>pooled_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated pooled text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting.
If not provided, pooled text embeddings will be generated from <code>prompt</code> input argument.`,name:"pooled_prompt_embeds"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.negative_pooled_prompt_embeds",description:`<strong>negative_pooled_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative pooled text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, pooled negative_prompt_embeds will be generated from <code>negative_prompt</code>
input argument.`,name:"negative_pooled_prompt_embeds"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.StableDiffusionXLPipelineOutput</code> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/cross_attention.py" rel="nofollow">diffusers.cross_attention</a>.`,name:"cross_attention_kwargs"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.guidance_rescale",description:`<strong>guidance_rescale</strong> (<code>float</code>, <em>optional</em>, defaults to 0.7) &#x2014;
Guidance rescale factor proposed by <a href="https://arxiv.org/pdf/2305.08891.pdf" rel="nofollow">Common Diffusion Noise Schedules and Sample Steps are
Flawed</a> <code>guidance_scale</code> is defined as <code>&#x3C6;</code> in equation 16. of
<a href="https://arxiv.org/pdf/2305.08891.pdf" rel="nofollow">Common Diffusion Noise Schedules and Sample Steps are Flawed</a>.
Guidance rescale factor should fix overexposure when using zero terminal SNR.`,name:"guidance_rescale"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.original_size",description:`<strong>original_size</strong> (<code>Tuple[int]</code>, <em>optional</em>, defaults to (1024, 1024)) &#x2014;
TODO`,name:"original_size"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.crops_coords_top_left",description:`<strong>crops_coords_top_left</strong> (<code>Tuple[int]</code>, <em>optional</em>, defaults to (0, 0)) &#x2014;
TODO`,name:"crops_coords_top_left"},{anchor:"diffusers.StableDiffusionXLPipeline.__call__.target_size",description:`<strong>target_size</strong> (<code>Tuple[int]</code>, <em>optional</em>, defaults to (1024, 1024)) &#x2014;
TODO`,name:"target_size"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L540",returnDescription:`
<p><code>~pipelines.stable_diffusion.StableDiffusionXLPipelineOutput</code> if <code>return_dict</code> is True, otherwise a
<code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><code>~pipelines.stable_diffusion.StableDiffusionXLPipelineOutput</code> or <code>tuple</code></p>
`}}),Ce=new Gh({props:{anchor:"diffusers.StableDiffusionXLPipeline.__call__.example",$$slots:{default:[Vh]},$$scope:{ctx:to}}}),Dt=new k({props:{name:"disable_vae_slicing",anchor:"diffusers.StableDiffusionXLPipeline.disable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L147"}}),Lt=new k({props:{name:"disable_vae_tiling",anchor:"diffusers.StableDiffusionXLPipeline.disable_vae_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L165"}}),Pt=new k({props:{name:"enable_model_cpu_offload",anchor:"diffusers.StableDiffusionXLPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L194"}}),Jt=new k({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.StableDiffusionXLPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L172"}}),Ut=new k({props:{name:"enable_vae_slicing",anchor:"diffusers.StableDiffusionXLPipeline.enable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L137"}}),Xt=new k({props:{name:"enable_vae_tiling",anchor:"diffusers.StableDiffusionXLPipeline.enable_vae_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L155"}}),Ct=new k({props:{name:"encode_prompt",anchor:"diffusers.StableDiffusionXLPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"num_images_per_prompt",val:": int = 1"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"pooled_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_pooled_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"lora_scale",val:": typing.Optional[float] = None"}],parametersDescription:[{anchor:"diffusers.StableDiffusionXLPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L243"}}),Zt=new Z({}),jt=new k({props:{name:"class diffusers.StableDiffusionXLImg2ImgPipeline",anchor:"diffusers.StableDiffusionXLImg2ImgPipeline",parameters:[{name:"vae",val:": AutoencoderKL"},{name:"text_encoder",val:": CLIPTextModel"},{name:"text_encoder_2",val:": CLIPTextModelWithProjection"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"tokenizer_2",val:": CLIPTokenizer"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": KarrasDiffusionSchedulers"},{name:"requires_aesthetics_score",val:": bool = False"},{name:"force_zeros_for_empty_prompt",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/v0.18.2/en/api/models/autoencoderkl#diffusers.AutoencoderKL">AutoencoderKL</a>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.`,name:"vae"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>CLIPTextModel</code>) &#x2014;
Frozen text-encoder. Stable Diffusion uses the text portion of
<a href="https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModel" rel="nofollow">CLIP</a>, specifically
the <a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a> variant.`,name:"text_encoder"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>CLIPTokenizer</code>) &#x2014;
Tokenizer of class
<a href="https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>.`,name:"tokenizer"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.unet",description:'<strong>unet</strong> (<a href="/docs/diffusers/v0.18.2/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014; Conditional U-Net architecture to denoise the encoded image latents.',name:"unet"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.18.2/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to denoise the encoded image latents. Can be one of
<a href="/docs/diffusers/v0.18.2/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.18.2/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.18.2/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py#L81"}}),Bt=new k({props:{name:"__call__",anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"image",val:": typing.Union[torch.FloatTensor, PIL.Image.Image, numpy.ndarray, typing.List[torch.FloatTensor], typing.List[PIL.Image.Image], typing.List[numpy.ndarray]] = None"},{name:"strength",val:": float = 0.3"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 5.0"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"pooled_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_pooled_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"guidance_rescale",val:": float = 0.0"},{name:"original_size",val:": typing.Tuple[int, int] = None"},{name:"crops_coords_top_left",val:": typing.Tuple[int, int] = (0, 0)"},{name:"target_size",val:": typing.Tuple[int, int] = None"},{name:"aesthetic_score",val:": float = 6.0"},{name:"negative_aesthetic_score",val:": float = 2.5"}],parametersDescription:[{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code> or <code>PIL.Image.Image</code> or <code>np.ndarray</code> or <code>List[torch.FloatTensor]</code> or <code>List[PIL.Image.Image]</code> or <code>List[np.ndarray]</code>) &#x2014;
The image(s) to modify with the pipeline.`,name:"image"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
Conceptually, indicates how much to transform the reference <code>image</code>. Must be between 0 and 1. <code>image</code>
will be used as a starting point, adding more noise to it the larger the <code>strength</code>. The number of
denoising steps depends on the amount of noise initially added. When <code>strength</code> is 1, added noise will
be maximum and the denoising process will run for the full number of iterations specified in
<code>num_inference_steps</code>. A value of 1, therefore, essentially ignores <code>image</code>.`,name:"strength"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/v0.18.2/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.pooled_prompt_embeds",description:`<strong>pooled_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated pooled text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting.
If not provided, pooled text embeddings will be generated from <code>prompt</code> input argument.`,name:"pooled_prompt_embeds"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.negative_pooled_prompt_embeds",description:`<strong>negative_pooled_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative pooled text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, pooled negative_prompt_embeds will be generated from <code>negative_prompt</code>
input argument.`,name:"negative_pooled_prompt_embeds"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion.StableDiffusionXLPipelineOutput</code> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/cross_attention.py" rel="nofollow">diffusers.cross_attention</a>.`,name:"cross_attention_kwargs"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.guidance_rescale",description:`<strong>guidance_rescale</strong> (<code>float</code>, <em>optional</em>, defaults to 0.7) &#x2014;
Guidance rescale factor proposed by <a href="https://arxiv.org/pdf/2305.08891.pdf" rel="nofollow">Common Diffusion Noise Schedules and Sample Steps are
Flawed</a> <code>guidance_scale</code> is defined as <code>&#x3C6;</code> in equation 16. of
<a href="https://arxiv.org/pdf/2305.08891.pdf" rel="nofollow">Common Diffusion Noise Schedules and Sample Steps are Flawed</a>.
Guidance rescale factor should fix overexposure when using zero terminal SNR.`,name:"guidance_rescale"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.original_size",description:`<strong>original_size</strong> (<code>Tuple[int]</code>, <em>optional</em>, defaults to (1024, 1024)) &#x2014;
TODO`,name:"original_size"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.crops_coords_top_left",description:`<strong>crops_coords_top_left</strong> (<code>Tuple[int]</code>, <em>optional</em>, defaults to (0, 0)) &#x2014;
TODO`,name:"crops_coords_top_left"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.target_size",description:`<strong>target_size</strong> (<code>Tuple[int]</code>, <em>optional</em>, defaults to (1024, 1024)) &#x2014;
TODO`,name:"target_size"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.aesthetic_score",description:`<strong>aesthetic_score</strong> (<code>float</code>, <em>optional</em>, defaults to 6.0) &#x2014;
TODO`,name:"aesthetic_score"},{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.negative_aesthetic_score",description:`<strong>negative_aesthetic_score</strong> (<code>float</code>, <em>optional</em>, defaults to 2.5) &#x2014;
TDOO`,name:"negative_aesthetic_score"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py#L607",returnDescription:`
<p><code>~pipelines.stable_diffusion.StableDiffusionXLPipelineOutput</code> if <code>return_dict</code> is True, otherwise a
<code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><code>~pipelines.stable_diffusion.StableDiffusionXLPipelineOutput</code> or <code>tuple</code></p>
`}}),Ae=new Gh({props:{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.example",$$slots:{default:[zh]},$$scope:{ctx:to}}}),Rt=new k({props:{name:"disable_vae_slicing",anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.disable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py#L154"}}),zt=new k({props:{name:"disable_vae_tiling",anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.disable_vae_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py#L172"}}),Yt=new k({props:{name:"enable_model_cpu_offload",anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py#L203"}}),qt=new k({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py#L180"}}),Ht=new k({props:{name:"enable_vae_slicing",anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.enable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py#L144"}}),Qt=new k({props:{name:"enable_vae_tiling",anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.enable_vae_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py#L162"}}),Kt=new k({props:{name:"encode_prompt",anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"num_images_per_prompt",val:": int = 1"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"negative_prompt",val:" = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"pooled_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_pooled_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"lora_scale",val:": typing.Optional[float] = None"}],parametersDescription:[{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.2/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py#L253"}}),{c(){S=i("meta"),j=r(),L=i("h1"),D=i("a"),J=i("span"),_(M.$$.fragment),P=r(),jo=i("span"),el=n("Stable diffusion XL"),$i=r(),ve=i("p"),tl=n("Stable Diffusion XL was proposed in "),ze=i("a"),ol=n("SDXL: Improving Latent Diffusion Models for High-Resolution Image Synthesis"),nl=n(" by Dustin Podell, Zion English, Kyle Lacey, Andreas Blattmann, Tim Dockhorn, Jonas M\xFCller, Joe Penna, Robin Rombach"),Ti=r(),oo=i("p"),al=n("The abstract of the paper is the following:"),Di=r(),no=i("p"),Go=i("em"),il=n("We present SDXL, a latent diffusion model for text-to-image synthesis. Compared to previous versions of Stable Diffusion, SDXL leverages a three times larger UNet backbone: The increase of model parameters is mainly due to more attention blocks and a larger cross-attention context as SDXL uses a second text encoder. We design multiple novel conditioning schemes and train SDXL on multiple aspect ratios. We also introduce a refinement model which is used to improve the visual fidelity of samples generated by SDXL using a post-hoc image-to-image technique. We demonstrate that SDXL shows drastically improved performance compared the previous versions of Stable Diffusion and achieves results competitive with those of black-box state-of-the-art image generators."),Si=r(),ee=i("h2"),we=i("a"),Wo=i("span"),_(Oe.$$.fragment),sl=r(),No=i("span"),ll=n("Tips"),Li=r(),ye=i("ul"),Ao=i("li"),rl=n("Stable Diffusion XL works especially well with images between 768 and 1024."),dl=r(),Fo=i("li"),pl=n("Stable Diffusion XL output image can be improved by making use of a refiner as shown below."),ki=r(),te=i("h3"),Ee=i("a"),Bo=i("span"),_(Ye.$$.fragment),cl=r(),Ro=i("span"),fl=n("Available checkpoints:"),Pi=r(),Me=i("ul"),oe=i("li"),Vo=i("em"),ml=n("Text-to-Image (1024x1024 resolution)"),ul=n(": "),qe=i("a"),gl=n("stabilityai/stable-diffusion-xl-base-0.9"),hl=n(" with "),ao=i("a"),_l=n("StableDiffusionXLPipeline"),bl=r(),ne=i("li"),zo=i("em"),vl=n("Image-to-Image / Refiner (1024x1024 resolution)"),wl=n(": "),He=i("a"),yl=n("stabilityai/stable-diffusion-xl-refiner-0.9"),El=n(" with "),io=i("a"),Ml=n("StableDiffusionXLImg2ImgPipeline"),Ji=r(),ae=i("h2"),Ie=i("a"),Oo=i("span"),_(Qe.$$.fragment),Il=r(),Yo=i("span"),xl=n("Usage Example"),Ui=r(),U=i("p"),$l=n("Before using SDXL make sure to have "),qo=i("code"),Tl=n("transformers"),Dl=n(", "),Ho=i("code"),Sl=n("accelerate"),Ll=n(", "),Qo=i("code"),kl=n("safetensors"),Pl=n(" and "),Ko=i("code"),Jl=n("invisible_watermark"),Ul=n(` installed.
You can install the libraries as follows:`),Xi=r(),_(Ke.$$.fragment),Ci=r(),ie=i("h3"),xe=i("a"),en=i("span"),_(et.$$.fragment),Xl=r(),tn=i("span"),Cl=n("Text-to-Image"),Zi=r(),$e=i("p"),Zl=n("You can use SDXL as follows for "),on=i("em"),jl=n("text-to-image"),Gl=n(":"),ji=r(),_(tt.$$.fragment),Gi=r(),se=i("h3"),Te=i("a"),nn=i("span"),_(ot.$$.fragment),Wl=r(),an=i("span"),Nl=n("Refining the image output"),Wi=r(),W=i("p"),Al=n("The image can be refined by making use of "),nt=i("a"),Fl=n("stabilityai/stable-diffusion-xl-refiner-0.9"),Bl=n(`.
In this case, you only have to output the `),sn=i("code"),Rl=n("latents"),Vl=n(" from the base model."),Ni=r(),_(at.$$.fragment),Ai=r(),le=i("h3"),De=i("a"),ln=i("span"),_(it.$$.fragment),zl=r(),rn=i("span"),Ol=n("Image-to-image"),Fi=r(),_(st.$$.fragment),Bi=r(),Se=i("table"),dn=i("thead"),lt=i("tr"),pn=i("th"),Yl=n("Original Image"),ql=r(),cn=i("th"),Hl=n("Refined Image"),Ql=r(),fn=i("tbody"),rt=i("tr"),mn=i("td"),un=i("img"),Kl=r(),gn=i("td"),hn=i("img"),Ri=r(),re=i("h3"),Le=i("a"),_n=i("span"),_(dt.$$.fragment),er=r(),bn=i("span"),tr=n("Loading single file checkpoints / original file format"),Vi=r(),N=i("p"),or=n("By making use of "),so=i("a"),nr=n("from_single_file()"),ar=n(` you can also load the
original file format into `),vn=i("code"),ir=n("diffusers"),sr=n(":"),zi=r(),_(pt.$$.fragment),Oi=r(),de=i("h3"),ke=i("a"),wn=i("span"),_(ct.$$.fragment),lr=r(),yn=i("span"),rr=n("Memory optimization via model offloading"),Yi=r(),Pe=i("p"),dr=n("If you are seeing out-of-memory errors, we recommend making use of "),lo=i("a"),pr=n("StableDiffusionXLPipeline.enable_model_cpu_offload()"),cr=n("."),qi=r(),_(ft.$$.fragment),Hi=r(),ro=i("p"),fr=n("and"),Qi=r(),_(mt.$$.fragment),Ki=r(),pe=i("h3"),Je=i("a"),En=i("span"),_(ut.$$.fragment),mr=r(),po=i("span"),ur=n("Speed-up inference with "),Mn=i("code"),gr=n("torch.compile"),es=r(),A=i("p"),hr=n("You can speed up inference by making use of "),In=i("code"),_r=n("torch.compile"),br=n(". This should give you "),xn=i("strong"),vr=n("ca."),wr=n(" 20% speed-up."),ts=r(),_(gt.$$.fragment),os=r(),ce=i("h3"),Ue=i("a"),$n=i("span"),_(ht.$$.fragment),yr=r(),_t=i("span"),Er=n("Running with "),Tn=i("code"),Mr=n("torch"),Ir=n(" \\&lt; 2.0"),ns=r(),fe=i("p"),Dn=i("strong"),xr=n("Note"),$r=n(" that if you want to run Stable Diffusion XL with "),Sn=i("code"),Tr=n("torch"),Dr=n(` < 2.0, please make sure to enable xformers
attention:`),as=r(),_(bt.$$.fragment),is=r(),_(vt.$$.fragment),ss=r(),me=i("h2"),Xe=i("a"),Ln=i("span"),_(wt.$$.fragment),Sr=r(),kn=i("span"),Lr=n("StableDiffusionXLPipeline"),ls=r(),I=i("div"),_(yt.$$.fragment),kr=r(),Pn=i("p"),Pr=n("Pipeline for text-to-image generation using Stable Diffusion."),Jr=r(),Et=i("p"),Ur=n("This model inherits from "),co=i("a"),Xr=n("DiffusionPipeline"),Cr=n(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Zr=r(),Jn=i("p"),jr=n("In addition the pipeline inherits the following loading methods:"),Gr=r(),ue=i("ul"),Mt=i("li"),Un=i("em"),Wr=n("Textual-Inversion"),Nr=n(": "),fo=i("a"),Ar=n("loaders.TextualInversionLoaderMixin.load_textual_inversion()"),Fr=r(),It=i("li"),Xn=i("em"),Br=n("LoRA"),Rr=n(": "),mo=i("a"),Vr=n("loaders.LoraLoaderMixin.load_lora_weights()"),zr=r(),xt=i("li"),Cn=i("em"),Or=n("Ckpt"),Yr=n(": "),uo=i("a"),qr=n("loaders.FromSingleFileMixin.from_single_file()"),Hr=r(),Zn=i("p"),Qr=n("as well as the following saving methods:"),Kr=r(),jn=i("ul"),$t=i("li"),Gn=i("em"),ed=n("LoRA"),td=n(": "),go=i("a"),od=n("loaders.LoraLoaderMixin.save_lora_weights()"),nd=r(),F=i("div"),_(Tt.$$.fragment),ad=r(),Wn=i("p"),id=n("Function invoked when calling the pipeline for generation."),sd=r(),_(Ce.$$.fragment),ld=r(),Ze=i("div"),_(Dt.$$.fragment),rd=r(),St=i("p"),dd=n("Disable sliced VAE decoding. If "),Nn=i("code"),pd=n("enable_vae_slicing"),cd=n(` was previously invoked, this method will go back to
computing decoding in one step.`),fd=r(),je=i("div"),_(Lt.$$.fragment),md=r(),kt=i("p"),ud=n("Disable tiled VAE decoding. If "),An=i("code"),gd=n("enable_vae_tiling"),hd=n(` was previously invoked, this method will go back to
computing decoding in one step.`),_d=r(),Ge=i("div"),_(Pt.$$.fragment),bd=r(),X=i("p"),vd=n(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Fn=i("code"),wd=n("enable_sequential_cpu_offload"),yd=n(", this method moves one whole model at a time to the GPU when its "),Bn=i("code"),Ed=n("forward"),Md=n(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Rn=i("code"),Id=n("enable_sequential_cpu_offload"),xd=n(", but performance is much better due to the iterative execution of the "),Vn=i("code"),$d=n("unet"),Td=n("."),Dd=r(),We=i("div"),_(Jt.$$.fragment),Sd=r(),ge=i("p"),Ld=n(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),zn=i("code"),kd=n("torch.device('meta') and loaded to GPU only when their specific submodule has its "),Pd=n("forward"),On=i("code"),Jd=n("method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),Ud=n("enable_model_cpu_offload`, but performance is lower."),Xd=r(),B=i("div"),_(Ut.$$.fragment),Cd=r(),Yn=i("p"),Zd=n("Enable sliced VAE decoding."),jd=r(),qn=i("p"),Gd=n(`When this option is enabled, the VAE will split the input tensor in slices to compute decoding in several
steps. This is useful to save some memory and allow larger batch sizes.`),Wd=r(),R=i("div"),_(Xt.$$.fragment),Nd=r(),Hn=i("p"),Ad=n("Enable tiled VAE decoding."),Fd=r(),Qn=i("p"),Bd=n(`When this option is enabled, the VAE will split the input tensor into tiles to compute decoding and encoding in
several steps. This is useful to save a large amount of memory and to allow the processing of larger images.`),Rd=r(),V=i("div"),_(Ct.$$.fragment),Vd=r(),Kn=i("p"),zd=n("Encodes the prompt into text encoder hidden states."),Od=r(),m=i("p"),Yd=n("device: ("),ea=i("code"),qd=n("torch.device"),Hd=n(`):
torch device
num_images_per_prompt (`),ta=i("code"),Qd=n("int"),Kd=n(`):
number of images that should be generated per prompt
do_classifier_free_guidance (`),oa=i("code"),ep=n("bool"),tp=n(`):
whether to use classifier free guidance or not
negative_prompt (`),na=i("code"),op=n("str"),np=n(" or "),aa=i("code"),ap=n("List[str]"),ip=n(", "),ia=i("em"),sp=n("optional"),lp=n(`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),sa=i("code"),rp=n("negative_prompt_embeds"),dp=n(" instead. Ignored when not using guidance (i.e., ignored if "),la=i("code"),pp=n("guidance_scale"),cp=n(` is
less than `),ra=i("code"),fp=n("1"),mp=n(`).
prompt_embeds (`),da=i("code"),up=n("torch.FloatTensor"),gp=n(", "),pa=i("em"),hp=n("optional"),_p=n(`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),ca=i("em"),bp=n("e.g."),vp=n(` prompt weighting. If not
provided, text embeddings will be generated from `),fa=i("code"),wp=n("prompt"),yp=n(` input argument.
negative_prompt_embeds (`),ma=i("code"),Ep=n("torch.FloatTensor"),Mp=n(", "),ua=i("em"),Ip=n("optional"),xp=n(`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),ga=i("em"),$p=n("e.g."),Tp=n(` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),ha=i("code"),Dp=n("negative_prompt"),Sp=n(` input
argument.
pooled_prompt_embeds (`),_a=i("code"),Lp=n("torch.FloatTensor"),kp=n(", "),ba=i("em"),Pp=n("optional"),Jp=n(`):
Pre-generated pooled text embeddings. Can be used to easily tweak text inputs, `),va=i("em"),Up=n("e.g."),Xp=n(` prompt weighting.
If not provided, pooled text embeddings will be generated from `),wa=i("code"),Cp=n("prompt"),Zp=n(` input argument.
negative_pooled_prompt_embeds (`),ya=i("code"),jp=n("torch.FloatTensor"),Gp=n(", "),Ea=i("em"),Wp=n("optional"),Np=n(`):
Pre-generated negative pooled text embeddings. Can be used to easily tweak text inputs, `),Ma=i("em"),Ap=n("e.g."),Fp=n(` prompt
weighting. If not provided, pooled negative_prompt_embeds will be generated from `),Ia=i("code"),Bp=n("negative_prompt"),Rp=n(`
input argument.
lora_scale (`),xa=i("code"),Vp=n("float"),zp=n(", "),$a=i("em"),Op=n("optional"),Yp=n(`):
A lora scale that will be applied to all LoRA layers of the text encoder if LoRA layers are loaded.`),rs=r(),he=i("h2"),Ne=i("a"),Ta=i("span"),_(Zt.$$.fragment),qp=r(),Da=i("span"),Hp=n("StableDiffusionXLImg2ImgPipeline"),ds=r(),x=i("div"),_(jt.$$.fragment),Qp=r(),Sa=i("p"),Kp=n("Pipeline for text-to-image generation using Stable Diffusion."),ec=r(),Gt=i("p"),tc=n("This model inherits from "),ho=i("a"),oc=n("DiffusionPipeline"),nc=n(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),ac=r(),La=i("p"),ic=n("In addition the pipeline inherits the following loading methods:"),sc=r(),_e=i("ul"),Wt=i("li"),ka=i("em"),lc=n("Textual-Inversion"),rc=n(": "),_o=i("a"),dc=n("loaders.TextualInversionLoaderMixin.load_textual_inversion()"),pc=r(),Nt=i("li"),Pa=i("em"),cc=n("LoRA"),fc=n(": "),bo=i("a"),mc=n("loaders.LoraLoaderMixin.load_lora_weights()"),uc=r(),At=i("li"),Ja=i("em"),gc=n("Ckpt"),hc=n(": "),vo=i("a"),_c=n("loaders.FromSingleFileMixin.from_single_file()"),bc=r(),Ua=i("p"),vc=n("as well as the following saving methods:"),wc=r(),Xa=i("ul"),Ft=i("li"),Ca=i("em"),yc=n("LoRA"),Ec=n(": "),wo=i("a"),Mc=n("loaders.LoraLoaderMixin.save_lora_weights()"),Ic=r(),z=i("div"),_(Bt.$$.fragment),xc=r(),Za=i("p"),$c=n("Function invoked when calling the pipeline for generation."),Tc=r(),_(Ae.$$.fragment),Dc=r(),Fe=i("div"),_(Rt.$$.fragment),Sc=r(),Vt=i("p"),Lc=n("Disable sliced VAE decoding. If "),ja=i("code"),kc=n("enable_vae_slicing"),Pc=n(` was previously invoked, this method will go back to
computing decoding in one step.`),Jc=r(),Be=i("div"),_(zt.$$.fragment),Uc=r(),Ot=i("p"),Xc=n("Disable tiled VAE decoding. If "),Ga=i("code"),Cc=n("enable_vae_tiling"),Zc=n(` was previously invoked, this method will go back to
computing decoding in one step.`),jc=r(),Re=i("div"),_(Yt.$$.fragment),Gc=r(),C=i("p"),Wc=n(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Wa=i("code"),Nc=n("enable_sequential_cpu_offload"),Ac=n(", this method moves one whole model at a time to the GPU when its "),Na=i("code"),Fc=n("forward"),Bc=n(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Aa=i("code"),Rc=n("enable_sequential_cpu_offload"),Vc=n(", but performance is much better due to the iterative execution of the "),Fa=i("code"),zc=n("unet"),Oc=n("."),Yc=r(),Ve=i("div"),_(qt.$$.fragment),qc=r(),be=i("p"),Hc=n(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),Ba=i("code"),Qc=n("torch.device('meta') and loaded to GPU only when their specific submodule has its "),Kc=n("forward"),Ra=i("code"),ef=n("method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),tf=n("enable_model_cpu_offload`, but performance is lower."),of=r(),O=i("div"),_(Ht.$$.fragment),nf=r(),Va=i("p"),af=n("Enable sliced VAE decoding."),sf=r(),za=i("p"),lf=n(`When this option is enabled, the VAE will split the input tensor in slices to compute decoding in several
steps. This is useful to save some memory and allow larger batch sizes.`),rf=r(),Y=i("div"),_(Qt.$$.fragment),df=r(),Oa=i("p"),pf=n("Enable tiled VAE decoding."),cf=r(),Ya=i("p"),ff=n(`When this option is enabled, the VAE will split the input tensor into tiles to compute decoding and encoding in
several steps. This is useful to save a large amount of memory and to allow the processing of larger images.`),mf=r(),q=i("div"),_(Kt.$$.fragment),uf=r(),qa=i("p"),gf=n("Encodes the prompt into text encoder hidden states."),hf=r(),u=i("p"),_f=n("device: ("),Ha=i("code"),bf=n("torch.device"),vf=n(`):
torch device
num_images_per_prompt (`),Qa=i("code"),wf=n("int"),yf=n(`):
number of images that should be generated per prompt
do_classifier_free_guidance (`),Ka=i("code"),Ef=n("bool"),Mf=n(`):
whether to use classifier free guidance or not
negative_prompt (`),ei=i("code"),If=n("str"),xf=n(" or "),ti=i("code"),$f=n("List[str]"),Tf=n(", "),oi=i("em"),Df=n("optional"),Sf=n(`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),ni=i("code"),Lf=n("negative_prompt_embeds"),kf=n(" instead. Ignored when not using guidance (i.e., ignored if "),ai=i("code"),Pf=n("guidance_scale"),Jf=n(` is
less than `),ii=i("code"),Uf=n("1"),Xf=n(`).
prompt_embeds (`),si=i("code"),Cf=n("torch.FloatTensor"),Zf=n(", "),li=i("em"),jf=n("optional"),Gf=n(`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),ri=i("em"),Wf=n("e.g."),Nf=n(` prompt weighting. If not
provided, text embeddings will be generated from `),di=i("code"),Af=n("prompt"),Ff=n(` input argument.
negative_prompt_embeds (`),pi=i("code"),Bf=n("torch.FloatTensor"),Rf=n(", "),ci=i("em"),Vf=n("optional"),zf=n(`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),fi=i("em"),Of=n("e.g."),Yf=n(` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),mi=i("code"),qf=n("negative_prompt"),Hf=n(` input
argument.
pooled_prompt_embeds (`),ui=i("code"),Qf=n("torch.FloatTensor"),Kf=n(", "),gi=i("em"),em=n("optional"),tm=n(`):
Pre-generated pooled text embeddings. Can be used to easily tweak text inputs, `),hi=i("em"),om=n("e.g."),nm=n(` prompt weighting.
If not provided, pooled text embeddings will be generated from `),_i=i("code"),am=n("prompt"),im=n(` input argument.
negative_pooled_prompt_embeds (`),bi=i("code"),sm=n("torch.FloatTensor"),lm=n(", "),vi=i("em"),rm=n("optional"),dm=n(`):
Pre-generated negative pooled text embeddings. Can be used to easily tweak text inputs, `),wi=i("em"),pm=n("e.g."),cm=n(` prompt
weighting. If not provided, pooled negative_prompt_embeds will be generated from `),yi=i("code"),fm=n("negative_prompt"),mm=n(`
input argument.
lora_scale (`),Ei=i("code"),um=n("float"),gm=n(", "),Mi=i("em"),hm=n("optional"),_m=n(`):
A lora scale that will be applied to all LoRA layers of the text encoder if LoRA layers are loaded.`),this.h()},l(t){const c=Bh('[data-svelte="svelte-1phssyn"]',document.head);S=s(c,"META",{name:!0,content:!0}),c.forEach(o),j=d(t),L=s(t,"H1",{class:!0});var eo=l(L);D=s(eo,"A",{id:!0,class:!0,href:!0});var Ii=l(D);J=s(Ii,"SPAN",{});var ym=l(J);b(M.$$.fragment,ym),ym.forEach(o),Ii.forEach(o),P=d(eo),jo=s(eo,"SPAN",{});var Em=l(jo);el=a(Em,"Stable diffusion XL"),Em.forEach(o),eo.forEach(o),$i=d(t),ve=s(t,"P",{});var cs=l(ve);tl=a(cs,"Stable Diffusion XL was proposed in "),ze=s(cs,"A",{href:!0,rel:!0});var Mm=l(ze);ol=a(Mm,"SDXL: Improving Latent Diffusion Models for High-Resolution Image Synthesis"),Mm.forEach(o),nl=a(cs," by Dustin Podell, Zion English, Kyle Lacey, Andreas Blattmann, Tim Dockhorn, Jonas M\xFCller, Joe Penna, Robin Rombach"),cs.forEach(o),Ti=d(t),oo=s(t,"P",{});var Im=l(oo);al=a(Im,"The abstract of the paper is the following:"),Im.forEach(o),Di=d(t),no=s(t,"P",{});var xm=l(no);Go=s(xm,"EM",{});var $m=l(Go);il=a($m,"We present SDXL, a latent diffusion model for text-to-image synthesis. Compared to previous versions of Stable Diffusion, SDXL leverages a three times larger UNet backbone: The increase of model parameters is mainly due to more attention blocks and a larger cross-attention context as SDXL uses a second text encoder. We design multiple novel conditioning schemes and train SDXL on multiple aspect ratios. We also introduce a refinement model which is used to improve the visual fidelity of samples generated by SDXL using a post-hoc image-to-image technique. We demonstrate that SDXL shows drastically improved performance compared the previous versions of Stable Diffusion and achieves results competitive with those of black-box state-of-the-art image generators."),$m.forEach(o),xm.forEach(o),Si=d(t),ee=s(t,"H2",{class:!0});var fs=l(ee);we=s(fs,"A",{id:!0,class:!0,href:!0});var Tm=l(we);Wo=s(Tm,"SPAN",{});var Dm=l(Wo);b(Oe.$$.fragment,Dm),Dm.forEach(o),Tm.forEach(o),sl=d(fs),No=s(fs,"SPAN",{});var Sm=l(No);ll=a(Sm,"Tips"),Sm.forEach(o),fs.forEach(o),Li=d(t),ye=s(t,"UL",{});var ms=l(ye);Ao=s(ms,"LI",{});var Lm=l(Ao);rl=a(Lm,"Stable Diffusion XL works especially well with images between 768 and 1024."),Lm.forEach(o),dl=d(ms),Fo=s(ms,"LI",{});var km=l(Fo);pl=a(km,"Stable Diffusion XL output image can be improved by making use of a refiner as shown below."),km.forEach(o),ms.forEach(o),ki=d(t),te=s(t,"H3",{class:!0});var us=l(te);Ee=s(us,"A",{id:!0,class:!0,href:!0});var Pm=l(Ee);Bo=s(Pm,"SPAN",{});var Jm=l(Bo);b(Ye.$$.fragment,Jm),Jm.forEach(o),Pm.forEach(o),cl=d(us),Ro=s(us,"SPAN",{});var Um=l(Ro);fl=a(Um,"Available checkpoints:"),Um.forEach(o),us.forEach(o),Pi=d(t),Me=s(t,"UL",{});var gs=l(Me);oe=s(gs,"LI",{});var yo=l(oe);Vo=s(yo,"EM",{});var Xm=l(Vo);ml=a(Xm,"Text-to-Image (1024x1024 resolution)"),Xm.forEach(o),ul=a(yo,": "),qe=s(yo,"A",{href:!0,rel:!0});var Cm=l(qe);gl=a(Cm,"stabilityai/stable-diffusion-xl-base-0.9"),Cm.forEach(o),hl=a(yo," with "),ao=s(yo,"A",{href:!0});var Zm=l(ao);_l=a(Zm,"StableDiffusionXLPipeline"),Zm.forEach(o),yo.forEach(o),bl=d(gs),ne=s(gs,"LI",{});var Eo=l(ne);zo=s(Eo,"EM",{});var jm=l(zo);vl=a(jm,"Image-to-Image / Refiner (1024x1024 resolution)"),jm.forEach(o),wl=a(Eo,": "),He=s(Eo,"A",{href:!0,rel:!0});var Gm=l(He);yl=a(Gm,"stabilityai/stable-diffusion-xl-refiner-0.9"),Gm.forEach(o),El=a(Eo," with "),io=s(Eo,"A",{href:!0});var Wm=l(io);Ml=a(Wm,"StableDiffusionXLImg2ImgPipeline"),Wm.forEach(o),Eo.forEach(o),gs.forEach(o),Ji=d(t),ae=s(t,"H2",{class:!0});var hs=l(ae);Ie=s(hs,"A",{id:!0,class:!0,href:!0});var Nm=l(Ie);Oo=s(Nm,"SPAN",{});var Am=l(Oo);b(Qe.$$.fragment,Am),Am.forEach(o),Nm.forEach(o),Il=d(hs),Yo=s(hs,"SPAN",{});var Fm=l(Yo);xl=a(Fm,"Usage Example"),Fm.forEach(o),hs.forEach(o),Ui=d(t),U=s(t,"P",{});var H=l(U);$l=a(H,"Before using SDXL make sure to have "),qo=s(H,"CODE",{});var Bm=l(qo);Tl=a(Bm,"transformers"),Bm.forEach(o),Dl=a(H,", "),Ho=s(H,"CODE",{});var Rm=l(Ho);Sl=a(Rm,"accelerate"),Rm.forEach(o),Ll=a(H,", "),Qo=s(H,"CODE",{});var Vm=l(Qo);kl=a(Vm,"safetensors"),Vm.forEach(o),Pl=a(H," and "),Ko=s(H,"CODE",{});var zm=l(Ko);Jl=a(zm,"invisible_watermark"),zm.forEach(o),Ul=a(H,` installed.
You can install the libraries as follows:`),H.forEach(o),Xi=d(t),b(Ke.$$.fragment,t),Ci=d(t),ie=s(t,"H3",{class:!0});var _s=l(ie);xe=s(_s,"A",{id:!0,class:!0,href:!0});var Om=l(xe);en=s(Om,"SPAN",{});var Ym=l(en);b(et.$$.fragment,Ym),Ym.forEach(o),Om.forEach(o),Xl=d(_s),tn=s(_s,"SPAN",{});var qm=l(tn);Cl=a(qm,"Text-to-Image"),qm.forEach(o),_s.forEach(o),Zi=d(t),$e=s(t,"P",{});var bs=l($e);Zl=a(bs,"You can use SDXL as follows for "),on=s(bs,"EM",{});var Hm=l(on);jl=a(Hm,"text-to-image"),Hm.forEach(o),Gl=a(bs,":"),bs.forEach(o),ji=d(t),b(tt.$$.fragment,t),Gi=d(t),se=s(t,"H3",{class:!0});var vs=l(se);Te=s(vs,"A",{id:!0,class:!0,href:!0});var Qm=l(Te);nn=s(Qm,"SPAN",{});var Km=l(nn);b(ot.$$.fragment,Km),Km.forEach(o),Qm.forEach(o),Wl=d(vs),an=s(vs,"SPAN",{});var eu=l(an);Nl=a(eu,"Refining the image output"),eu.forEach(o),vs.forEach(o),Wi=d(t),W=s(t,"P",{});var Mo=l(W);Al=a(Mo,"The image can be refined by making use of "),nt=s(Mo,"A",{href:!0,rel:!0});var tu=l(nt);Fl=a(tu,"stabilityai/stable-diffusion-xl-refiner-0.9"),tu.forEach(o),Bl=a(Mo,`.
In this case, you only have to output the `),sn=s(Mo,"CODE",{});var ou=l(sn);Rl=a(ou,"latents"),ou.forEach(o),Vl=a(Mo," from the base model."),Mo.forEach(o),Ni=d(t),b(at.$$.fragment,t),Ai=d(t),le=s(t,"H3",{class:!0});var ws=l(le);De=s(ws,"A",{id:!0,class:!0,href:!0});var nu=l(De);ln=s(nu,"SPAN",{});var au=l(ln);b(it.$$.fragment,au),au.forEach(o),nu.forEach(o),zl=d(ws),rn=s(ws,"SPAN",{});var iu=l(rn);Ol=a(iu,"Image-to-image"),iu.forEach(o),ws.forEach(o),Fi=d(t),b(st.$$.fragment,t),Bi=d(t),Se=s(t,"TABLE",{});var ys=l(Se);dn=s(ys,"THEAD",{});var su=l(dn);lt=s(su,"TR",{});var Es=l(lt);pn=s(Es,"TH",{});var lu=l(pn);Yl=a(lu,"Original Image"),lu.forEach(o),ql=d(Es),cn=s(Es,"TH",{});var ru=l(cn);Hl=a(ru,"Refined Image"),ru.forEach(o),Es.forEach(o),su.forEach(o),Ql=d(ys),fn=s(ys,"TBODY",{});var du=l(fn);rt=s(du,"TR",{});var Ms=l(rt);mn=s(Ms,"TD",{});var pu=l(mn);un=s(pu,"IMG",{src:!0}),pu.forEach(o),Kl=d(Ms),gn=s(Ms,"TD",{});var cu=l(gn);hn=s(cu,"IMG",{src:!0}),cu.forEach(o),Ms.forEach(o),du.forEach(o),ys.forEach(o),Ri=d(t),re=s(t,"H3",{class:!0});var Is=l(re);Le=s(Is,"A",{id:!0,class:!0,href:!0});var fu=l(Le);_n=s(fu,"SPAN",{});var mu=l(_n);b(dt.$$.fragment,mu),mu.forEach(o),fu.forEach(o),er=d(Is),bn=s(Is,"SPAN",{});var uu=l(bn);tr=a(uu,"Loading single file checkpoints / original file format"),uu.forEach(o),Is.forEach(o),Vi=d(t),N=s(t,"P",{});var Io=l(N);or=a(Io,"By making use of "),so=s(Io,"A",{href:!0});var gu=l(so);nr=a(gu,"from_single_file()"),gu.forEach(o),ar=a(Io,` you can also load the
original file format into `),vn=s(Io,"CODE",{});var hu=l(vn);ir=a(hu,"diffusers"),hu.forEach(o),sr=a(Io,":"),Io.forEach(o),zi=d(t),b(pt.$$.fragment,t),Oi=d(t),de=s(t,"H3",{class:!0});var xs=l(de);ke=s(xs,"A",{id:!0,class:!0,href:!0});var _u=l(ke);wn=s(_u,"SPAN",{});var bu=l(wn);b(ct.$$.fragment,bu),bu.forEach(o),_u.forEach(o),lr=d(xs),yn=s(xs,"SPAN",{});var vu=l(yn);rr=a(vu,"Memory optimization via model offloading"),vu.forEach(o),xs.forEach(o),Yi=d(t),Pe=s(t,"P",{});var $s=l(Pe);dr=a($s,"If you are seeing out-of-memory errors, we recommend making use of "),lo=s($s,"A",{href:!0});var wu=l(lo);pr=a(wu,"StableDiffusionXLPipeline.enable_model_cpu_offload()"),wu.forEach(o),cr=a($s,"."),$s.forEach(o),qi=d(t),b(ft.$$.fragment,t),Hi=d(t),ro=s(t,"P",{});var yu=l(ro);fr=a(yu,"and"),yu.forEach(o),Qi=d(t),b(mt.$$.fragment,t),Ki=d(t),pe=s(t,"H3",{class:!0});var Ts=l(pe);Je=s(Ts,"A",{id:!0,class:!0,href:!0});var Eu=l(Je);En=s(Eu,"SPAN",{});var Mu=l(En);b(ut.$$.fragment,Mu),Mu.forEach(o),Eu.forEach(o),mr=d(Ts),po=s(Ts,"SPAN",{});var bm=l(po);ur=a(bm,"Speed-up inference with "),Mn=s(bm,"CODE",{});var Iu=l(Mn);gr=a(Iu,"torch.compile"),Iu.forEach(o),bm.forEach(o),Ts.forEach(o),es=d(t),A=s(t,"P",{});var xo=l(A);hr=a(xo,"You can speed up inference by making use of "),In=s(xo,"CODE",{});var xu=l(In);_r=a(xu,"torch.compile"),xu.forEach(o),br=a(xo,". This should give you "),xn=s(xo,"STRONG",{});var $u=l(xn);vr=a($u,"ca."),$u.forEach(o),wr=a(xo," 20% speed-up."),xo.forEach(o),ts=d(t),b(gt.$$.fragment,t),os=d(t),ce=s(t,"H3",{class:!0});var Ds=l(ce);Ue=s(Ds,"A",{id:!0,class:!0,href:!0});var Tu=l(Ue);$n=s(Tu,"SPAN",{});var Du=l($n);b(ht.$$.fragment,Du),Du.forEach(o),Tu.forEach(o),yr=d(Ds),_t=s(Ds,"SPAN",{});var Ss=l(_t);Er=a(Ss,"Running with "),Tn=s(Ss,"CODE",{});var Su=l(Tn);Mr=a(Su,"torch"),Su.forEach(o),Ir=a(Ss," \\&lt; 2.0"),Ss.forEach(o),Ds.forEach(o),ns=d(t),fe=s(t,"P",{});var xi=l(fe);Dn=s(xi,"STRONG",{});var Lu=l(Dn);xr=a(Lu,"Note"),Lu.forEach(o),$r=a(xi," that if you want to run Stable Diffusion XL with "),Sn=s(xi,"CODE",{});var ku=l(Sn);Tr=a(ku,"torch"),ku.forEach(o),Dr=a(xi,` < 2.0, please make sure to enable xformers
attention:`),xi.forEach(o),as=d(t),b(bt.$$.fragment,t),is=d(t),b(vt.$$.fragment,t),ss=d(t),me=s(t,"H2",{class:!0});var Ls=l(me);Xe=s(Ls,"A",{id:!0,class:!0,href:!0});var Pu=l(Xe);Ln=s(Pu,"SPAN",{});var Ju=l(Ln);b(wt.$$.fragment,Ju),Ju.forEach(o),Pu.forEach(o),Sr=d(Ls),kn=s(Ls,"SPAN",{});var Uu=l(kn);Lr=a(Uu,"StableDiffusionXLPipeline"),Uu.forEach(o),Ls.forEach(o),ls=d(t),I=s(t,"DIV",{class:!0});var $=l(I);b(yt.$$.fragment,$),kr=d($),Pn=s($,"P",{});var Xu=l(Pn);Pr=a(Xu,"Pipeline for text-to-image generation using Stable Diffusion."),Xu.forEach(o),Jr=d($),Et=s($,"P",{});var ks=l(Et);Ur=a(ks,"This model inherits from "),co=s(ks,"A",{href:!0});var Cu=l(co);Xr=a(Cu,"DiffusionPipeline"),Cu.forEach(o),Cr=a(ks,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),ks.forEach(o),Zr=d($),Jn=s($,"P",{});var Zu=l(Jn);jr=a(Zu,"In addition the pipeline inherits the following loading methods:"),Zu.forEach(o),Gr=d($),ue=s($,"UL",{});var $o=l(ue);Mt=s($o,"LI",{});var Ps=l(Mt);Un=s(Ps,"EM",{});var ju=l(Un);Wr=a(ju,"Textual-Inversion"),ju.forEach(o),Nr=a(Ps,": "),fo=s(Ps,"A",{href:!0});var Gu=l(fo);Ar=a(Gu,"loaders.TextualInversionLoaderMixin.load_textual_inversion()"),Gu.forEach(o),Ps.forEach(o),Fr=d($o),It=s($o,"LI",{});var Js=l(It);Xn=s(Js,"EM",{});var Wu=l(Xn);Br=a(Wu,"LoRA"),Wu.forEach(o),Rr=a(Js,": "),mo=s(Js,"A",{href:!0});var Nu=l(mo);Vr=a(Nu,"loaders.LoraLoaderMixin.load_lora_weights()"),Nu.forEach(o),Js.forEach(o),zr=d($o),xt=s($o,"LI",{});var Us=l(xt);Cn=s(Us,"EM",{});var Au=l(Cn);Or=a(Au,"Ckpt"),Au.forEach(o),Yr=a(Us,": "),uo=s(Us,"A",{href:!0});var Fu=l(uo);qr=a(Fu,"loaders.FromSingleFileMixin.from_single_file()"),Fu.forEach(o),Us.forEach(o),$o.forEach(o),Hr=d($),Zn=s($,"P",{});var Bu=l(Zn);Qr=a(Bu,"as well as the following saving methods:"),Bu.forEach(o),Kr=d($),jn=s($,"UL",{});var Ru=l(jn);$t=s(Ru,"LI",{});var Xs=l($t);Gn=s(Xs,"EM",{});var Vu=l(Gn);ed=a(Vu,"LoRA"),Vu.forEach(o),td=a(Xs,": "),go=s(Xs,"A",{href:!0});var zu=l(go);od=a(zu,"loaders.LoraLoaderMixin.save_lora_weights()"),zu.forEach(o),Xs.forEach(o),Ru.forEach(o),nd=d($),F=s($,"DIV",{class:!0});var To=l(F);b(Tt.$$.fragment,To),ad=d(To),Wn=s(To,"P",{});var Ou=l(Wn);id=a(Ou,"Function invoked when calling the pipeline for generation."),Ou.forEach(o),sd=d(To),b(Ce.$$.fragment,To),To.forEach(o),ld=d($),Ze=s($,"DIV",{class:!0});var Cs=l(Ze);b(Dt.$$.fragment,Cs),rd=d(Cs),St=s(Cs,"P",{});var Zs=l(St);dd=a(Zs,"Disable sliced VAE decoding. If "),Nn=s(Zs,"CODE",{});var Yu=l(Nn);pd=a(Yu,"enable_vae_slicing"),Yu.forEach(o),cd=a(Zs,` was previously invoked, this method will go back to
computing decoding in one step.`),Zs.forEach(o),Cs.forEach(o),fd=d($),je=s($,"DIV",{class:!0});var js=l(je);b(Lt.$$.fragment,js),md=d(js),kt=s(js,"P",{});var Gs=l(kt);ud=a(Gs,"Disable tiled VAE decoding. If "),An=s(Gs,"CODE",{});var qu=l(An);gd=a(qu,"enable_vae_tiling"),qu.forEach(o),hd=a(Gs,` was previously invoked, this method will go back to
computing decoding in one step.`),Gs.forEach(o),js.forEach(o),_d=d($),Ge=s($,"DIV",{class:!0});var Ws=l(Ge);b(Pt.$$.fragment,Ws),bd=d(Ws),X=s(Ws,"P",{});var Q=l(X);vd=a(Q,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Fn=s(Q,"CODE",{});var Hu=l(Fn);wd=a(Hu,"enable_sequential_cpu_offload"),Hu.forEach(o),yd=a(Q,", this method moves one whole model at a time to the GPU when its "),Bn=s(Q,"CODE",{});var Qu=l(Bn);Ed=a(Qu,"forward"),Qu.forEach(o),Md=a(Q,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Rn=s(Q,"CODE",{});var Ku=l(Rn);Id=a(Ku,"enable_sequential_cpu_offload"),Ku.forEach(o),xd=a(Q,", but performance is much better due to the iterative execution of the "),Vn=s(Q,"CODE",{});var eg=l(Vn);$d=a(eg,"unet"),eg.forEach(o),Td=a(Q,"."),Q.forEach(o),Ws.forEach(o),Dd=d($),We=s($,"DIV",{class:!0});var Ns=l(We);b(Jt.$$.fragment,Ns),Sd=d(Ns),ge=s(Ns,"P",{});var Do=l(ge);Ld=a(Do,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),zn=s(Do,"CODE",{});var tg=l(zn);kd=a(tg,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),tg.forEach(o),Pd=a(Do,"forward"),On=s(Do,"CODE",{});var og=l(On);Jd=a(og,"method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),og.forEach(o),Ud=a(Do,"enable_model_cpu_offload`, but performance is lower."),Do.forEach(o),Ns.forEach(o),Xd=d($),B=s($,"DIV",{class:!0});var So=l(B);b(Ut.$$.fragment,So),Cd=d(So),Yn=s(So,"P",{});var ng=l(Yn);Zd=a(ng,"Enable sliced VAE decoding."),ng.forEach(o),jd=d(So),qn=s(So,"P",{});var ag=l(qn);Gd=a(ag,`When this option is enabled, the VAE will split the input tensor in slices to compute decoding in several
steps. This is useful to save some memory and allow larger batch sizes.`),ag.forEach(o),So.forEach(o),Wd=d($),R=s($,"DIV",{class:!0});var Lo=l(R);b(Xt.$$.fragment,Lo),Nd=d(Lo),Hn=s(Lo,"P",{});var ig=l(Hn);Ad=a(ig,"Enable tiled VAE decoding."),ig.forEach(o),Fd=d(Lo),Qn=s(Lo,"P",{});var sg=l(Qn);Bd=a(sg,`When this option is enabled, the VAE will split the input tensor into tiles to compute decoding and encoding in
several steps. This is useful to save a large amount of memory and to allow the processing of larger images.`),sg.forEach(o),Lo.forEach(o),Rd=d($),V=s($,"DIV",{class:!0});var ko=l(V);b(Ct.$$.fragment,ko),Vd=d(ko),Kn=s(ko,"P",{});var lg=l(Kn);zd=a(lg,"Encodes the prompt into text encoder hidden states."),lg.forEach(o),Od=d(ko),m=s(ko,"P",{});var g=l(m);Yd=a(g,"device: ("),ea=s(g,"CODE",{});var rg=l(ea);qd=a(rg,"torch.device"),rg.forEach(o),Hd=a(g,`):
torch device
num_images_per_prompt (`),ta=s(g,"CODE",{});var dg=l(ta);Qd=a(dg,"int"),dg.forEach(o),Kd=a(g,`):
number of images that should be generated per prompt
do_classifier_free_guidance (`),oa=s(g,"CODE",{});var pg=l(oa);ep=a(pg,"bool"),pg.forEach(o),tp=a(g,`):
whether to use classifier free guidance or not
negative_prompt (`),na=s(g,"CODE",{});var cg=l(na);op=a(cg,"str"),cg.forEach(o),np=a(g," or "),aa=s(g,"CODE",{});var fg=l(aa);ap=a(fg,"List[str]"),fg.forEach(o),ip=a(g,", "),ia=s(g,"EM",{});var mg=l(ia);sp=a(mg,"optional"),mg.forEach(o),lp=a(g,`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),sa=s(g,"CODE",{});var ug=l(sa);rp=a(ug,"negative_prompt_embeds"),ug.forEach(o),dp=a(g," instead. Ignored when not using guidance (i.e., ignored if "),la=s(g,"CODE",{});var gg=l(la);pp=a(gg,"guidance_scale"),gg.forEach(o),cp=a(g,` is
less than `),ra=s(g,"CODE",{});var hg=l(ra);fp=a(hg,"1"),hg.forEach(o),mp=a(g,`).
prompt_embeds (`),da=s(g,"CODE",{});var _g=l(da);up=a(_g,"torch.FloatTensor"),_g.forEach(o),gp=a(g,", "),pa=s(g,"EM",{});var bg=l(pa);hp=a(bg,"optional"),bg.forEach(o),_p=a(g,`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),ca=s(g,"EM",{});var vg=l(ca);bp=a(vg,"e.g."),vg.forEach(o),vp=a(g,` prompt weighting. If not
provided, text embeddings will be generated from `),fa=s(g,"CODE",{});var wg=l(fa);wp=a(wg,"prompt"),wg.forEach(o),yp=a(g,` input argument.
negative_prompt_embeds (`),ma=s(g,"CODE",{});var yg=l(ma);Ep=a(yg,"torch.FloatTensor"),yg.forEach(o),Mp=a(g,", "),ua=s(g,"EM",{});var Eg=l(ua);Ip=a(Eg,"optional"),Eg.forEach(o),xp=a(g,`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),ga=s(g,"EM",{});var Mg=l(ga);$p=a(Mg,"e.g."),Mg.forEach(o),Tp=a(g,` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),ha=s(g,"CODE",{});var Ig=l(ha);Dp=a(Ig,"negative_prompt"),Ig.forEach(o),Sp=a(g,` input
argument.
pooled_prompt_embeds (`),_a=s(g,"CODE",{});var xg=l(_a);Lp=a(xg,"torch.FloatTensor"),xg.forEach(o),kp=a(g,", "),ba=s(g,"EM",{});var $g=l(ba);Pp=a($g,"optional"),$g.forEach(o),Jp=a(g,`):
Pre-generated pooled text embeddings. Can be used to easily tweak text inputs, `),va=s(g,"EM",{});var Tg=l(va);Up=a(Tg,"e.g."),Tg.forEach(o),Xp=a(g,` prompt weighting.
If not provided, pooled text embeddings will be generated from `),wa=s(g,"CODE",{});var Dg=l(wa);Cp=a(Dg,"prompt"),Dg.forEach(o),Zp=a(g,` input argument.
negative_pooled_prompt_embeds (`),ya=s(g,"CODE",{});var Sg=l(ya);jp=a(Sg,"torch.FloatTensor"),Sg.forEach(o),Gp=a(g,", "),Ea=s(g,"EM",{});var Lg=l(Ea);Wp=a(Lg,"optional"),Lg.forEach(o),Np=a(g,`):
Pre-generated negative pooled text embeddings. Can be used to easily tweak text inputs, `),Ma=s(g,"EM",{});var kg=l(Ma);Ap=a(kg,"e.g."),kg.forEach(o),Fp=a(g,` prompt
weighting. If not provided, pooled negative_prompt_embeds will be generated from `),Ia=s(g,"CODE",{});var Pg=l(Ia);Bp=a(Pg,"negative_prompt"),Pg.forEach(o),Rp=a(g,`
input argument.
lora_scale (`),xa=s(g,"CODE",{});var Jg=l(xa);Vp=a(Jg,"float"),Jg.forEach(o),zp=a(g,", "),$a=s(g,"EM",{});var Ug=l($a);Op=a(Ug,"optional"),Ug.forEach(o),Yp=a(g,`):
A lora scale that will be applied to all LoRA layers of the text encoder if LoRA layers are loaded.`),g.forEach(o),ko.forEach(o),$.forEach(o),rs=d(t),he=s(t,"H2",{class:!0});var As=l(he);Ne=s(As,"A",{id:!0,class:!0,href:!0});var Xg=l(Ne);Ta=s(Xg,"SPAN",{});var Cg=l(Ta);b(Zt.$$.fragment,Cg),Cg.forEach(o),Xg.forEach(o),qp=d(As),Da=s(As,"SPAN",{});var Zg=l(Da);Hp=a(Zg,"StableDiffusionXLImg2ImgPipeline"),Zg.forEach(o),As.forEach(o),ds=d(t),x=s(t,"DIV",{class:!0});var T=l(x);b(jt.$$.fragment,T),Qp=d(T),Sa=s(T,"P",{});var jg=l(Sa);Kp=a(jg,"Pipeline for text-to-image generation using Stable Diffusion."),jg.forEach(o),ec=d(T),Gt=s(T,"P",{});var Fs=l(Gt);tc=a(Fs,"This model inherits from "),ho=s(Fs,"A",{href:!0});var Gg=l(ho);oc=a(Gg,"DiffusionPipeline"),Gg.forEach(o),nc=a(Fs,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Fs.forEach(o),ac=d(T),La=s(T,"P",{});var Wg=l(La);ic=a(Wg,"In addition the pipeline inherits the following loading methods:"),Wg.forEach(o),sc=d(T),_e=s(T,"UL",{});var Po=l(_e);Wt=s(Po,"LI",{});var Bs=l(Wt);ka=s(Bs,"EM",{});var Ng=l(ka);lc=a(Ng,"Textual-Inversion"),Ng.forEach(o),rc=a(Bs,": "),_o=s(Bs,"A",{href:!0});var Ag=l(_o);dc=a(Ag,"loaders.TextualInversionLoaderMixin.load_textual_inversion()"),Ag.forEach(o),Bs.forEach(o),pc=d(Po),Nt=s(Po,"LI",{});var Rs=l(Nt);Pa=s(Rs,"EM",{});var Fg=l(Pa);cc=a(Fg,"LoRA"),Fg.forEach(o),fc=a(Rs,": "),bo=s(Rs,"A",{href:!0});var Bg=l(bo);mc=a(Bg,"loaders.LoraLoaderMixin.load_lora_weights()"),Bg.forEach(o),Rs.forEach(o),uc=d(Po),At=s(Po,"LI",{});var Vs=l(At);Ja=s(Vs,"EM",{});var Rg=l(Ja);gc=a(Rg,"Ckpt"),Rg.forEach(o),hc=a(Vs,": "),vo=s(Vs,"A",{href:!0});var Vg=l(vo);_c=a(Vg,"loaders.FromSingleFileMixin.from_single_file()"),Vg.forEach(o),Vs.forEach(o),Po.forEach(o),bc=d(T),Ua=s(T,"P",{});var zg=l(Ua);vc=a(zg,"as well as the following saving methods:"),zg.forEach(o),wc=d(T),Xa=s(T,"UL",{});var Og=l(Xa);Ft=s(Og,"LI",{});var zs=l(Ft);Ca=s(zs,"EM",{});var Yg=l(Ca);yc=a(Yg,"LoRA"),Yg.forEach(o),Ec=a(zs,": "),wo=s(zs,"A",{href:!0});var qg=l(wo);Mc=a(qg,"loaders.LoraLoaderMixin.save_lora_weights()"),qg.forEach(o),zs.forEach(o),Og.forEach(o),Ic=d(T),z=s(T,"DIV",{class:!0});var Jo=l(z);b(Bt.$$.fragment,Jo),xc=d(Jo),Za=s(Jo,"P",{});var Hg=l(Za);$c=a(Hg,"Function invoked when calling the pipeline for generation."),Hg.forEach(o),Tc=d(Jo),b(Ae.$$.fragment,Jo),Jo.forEach(o),Dc=d(T),Fe=s(T,"DIV",{class:!0});var Os=l(Fe);b(Rt.$$.fragment,Os),Sc=d(Os),Vt=s(Os,"P",{});var Ys=l(Vt);Lc=a(Ys,"Disable sliced VAE decoding. If "),ja=s(Ys,"CODE",{});var Qg=l(ja);kc=a(Qg,"enable_vae_slicing"),Qg.forEach(o),Pc=a(Ys,` was previously invoked, this method will go back to
computing decoding in one step.`),Ys.forEach(o),Os.forEach(o),Jc=d(T),Be=s(T,"DIV",{class:!0});var qs=l(Be);b(zt.$$.fragment,qs),Uc=d(qs),Ot=s(qs,"P",{});var Hs=l(Ot);Xc=a(Hs,"Disable tiled VAE decoding. If "),Ga=s(Hs,"CODE",{});var Kg=l(Ga);Cc=a(Kg,"enable_vae_tiling"),Kg.forEach(o),Zc=a(Hs,` was previously invoked, this method will go back to
computing decoding in one step.`),Hs.forEach(o),qs.forEach(o),jc=d(T),Re=s(T,"DIV",{class:!0});var Qs=l(Re);b(Yt.$$.fragment,Qs),Gc=d(Qs),C=s(Qs,"P",{});var K=l(C);Wc=a(K,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Wa=s(K,"CODE",{});var eh=l(Wa);Nc=a(eh,"enable_sequential_cpu_offload"),eh.forEach(o),Ac=a(K,", this method moves one whole model at a time to the GPU when its "),Na=s(K,"CODE",{});var th=l(Na);Fc=a(th,"forward"),th.forEach(o),Bc=a(K,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Aa=s(K,"CODE",{});var oh=l(Aa);Rc=a(oh,"enable_sequential_cpu_offload"),oh.forEach(o),Vc=a(K,", but performance is much better due to the iterative execution of the "),Fa=s(K,"CODE",{});var nh=l(Fa);zc=a(nh,"unet"),nh.forEach(o),Oc=a(K,"."),K.forEach(o),Qs.forEach(o),Yc=d(T),Ve=s(T,"DIV",{class:!0});var Ks=l(Ve);b(qt.$$.fragment,Ks),qc=d(Ks),be=s(Ks,"P",{});var Uo=l(be);Hc=a(Uo,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),Ba=s(Uo,"CODE",{});var ah=l(Ba);Qc=a(ah,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),ah.forEach(o),Kc=a(Uo,"forward"),Ra=s(Uo,"CODE",{});var ih=l(Ra);ef=a(ih,"method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),ih.forEach(o),tf=a(Uo,"enable_model_cpu_offload`, but performance is lower."),Uo.forEach(o),Ks.forEach(o),of=d(T),O=s(T,"DIV",{class:!0});var Xo=l(O);b(Ht.$$.fragment,Xo),nf=d(Xo),Va=s(Xo,"P",{});var sh=l(Va);af=a(sh,"Enable sliced VAE decoding."),sh.forEach(o),sf=d(Xo),za=s(Xo,"P",{});var lh=l(za);lf=a(lh,`When this option is enabled, the VAE will split the input tensor in slices to compute decoding in several
steps. This is useful to save some memory and allow larger batch sizes.`),lh.forEach(o),Xo.forEach(o),rf=d(T),Y=s(T,"DIV",{class:!0});var Co=l(Y);b(Qt.$$.fragment,Co),df=d(Co),Oa=s(Co,"P",{});var rh=l(Oa);pf=a(rh,"Enable tiled VAE decoding."),rh.forEach(o),cf=d(Co),Ya=s(Co,"P",{});var dh=l(Ya);ff=a(dh,`When this option is enabled, the VAE will split the input tensor into tiles to compute decoding and encoding in
several steps. This is useful to save a large amount of memory and to allow the processing of larger images.`),dh.forEach(o),Co.forEach(o),mf=d(T),q=s(T,"DIV",{class:!0});var Zo=l(q);b(Kt.$$.fragment,Zo),uf=d(Zo),qa=s(Zo,"P",{});var ph=l(qa);gf=a(ph,"Encodes the prompt into text encoder hidden states."),ph.forEach(o),hf=d(Zo),u=s(Zo,"P",{});var h=l(u);_f=a(h,"device: ("),Ha=s(h,"CODE",{});var ch=l(Ha);bf=a(ch,"torch.device"),ch.forEach(o),vf=a(h,`):
torch device
num_images_per_prompt (`),Qa=s(h,"CODE",{});var fh=l(Qa);wf=a(fh,"int"),fh.forEach(o),yf=a(h,`):
number of images that should be generated per prompt
do_classifier_free_guidance (`),Ka=s(h,"CODE",{});var mh=l(Ka);Ef=a(mh,"bool"),mh.forEach(o),Mf=a(h,`):
whether to use classifier free guidance or not
negative_prompt (`),ei=s(h,"CODE",{});var uh=l(ei);If=a(uh,"str"),uh.forEach(o),xf=a(h," or "),ti=s(h,"CODE",{});var gh=l(ti);$f=a(gh,"List[str]"),gh.forEach(o),Tf=a(h,", "),oi=s(h,"EM",{});var hh=l(oi);Df=a(hh,"optional"),hh.forEach(o),Sf=a(h,`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),ni=s(h,"CODE",{});var _h=l(ni);Lf=a(_h,"negative_prompt_embeds"),_h.forEach(o),kf=a(h," instead. Ignored when not using guidance (i.e., ignored if "),ai=s(h,"CODE",{});var bh=l(ai);Pf=a(bh,"guidance_scale"),bh.forEach(o),Jf=a(h,` is
less than `),ii=s(h,"CODE",{});var vh=l(ii);Uf=a(vh,"1"),vh.forEach(o),Xf=a(h,`).
prompt_embeds (`),si=s(h,"CODE",{});var wh=l(si);Cf=a(wh,"torch.FloatTensor"),wh.forEach(o),Zf=a(h,", "),li=s(h,"EM",{});var yh=l(li);jf=a(yh,"optional"),yh.forEach(o),Gf=a(h,`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),ri=s(h,"EM",{});var Eh=l(ri);Wf=a(Eh,"e.g."),Eh.forEach(o),Nf=a(h,` prompt weighting. If not
provided, text embeddings will be generated from `),di=s(h,"CODE",{});var Mh=l(di);Af=a(Mh,"prompt"),Mh.forEach(o),Ff=a(h,` input argument.
negative_prompt_embeds (`),pi=s(h,"CODE",{});var Ih=l(pi);Bf=a(Ih,"torch.FloatTensor"),Ih.forEach(o),Rf=a(h,", "),ci=s(h,"EM",{});var xh=l(ci);Vf=a(xh,"optional"),xh.forEach(o),zf=a(h,`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),fi=s(h,"EM",{});var $h=l(fi);Of=a($h,"e.g."),$h.forEach(o),Yf=a(h,` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),mi=s(h,"CODE",{});var Th=l(mi);qf=a(Th,"negative_prompt"),Th.forEach(o),Hf=a(h,` input
argument.
pooled_prompt_embeds (`),ui=s(h,"CODE",{});var Dh=l(ui);Qf=a(Dh,"torch.FloatTensor"),Dh.forEach(o),Kf=a(h,", "),gi=s(h,"EM",{});var Sh=l(gi);em=a(Sh,"optional"),Sh.forEach(o),tm=a(h,`):
Pre-generated pooled text embeddings. Can be used to easily tweak text inputs, `),hi=s(h,"EM",{});var Lh=l(hi);om=a(Lh,"e.g."),Lh.forEach(o),nm=a(h,` prompt weighting.
If not provided, pooled text embeddings will be generated from `),_i=s(h,"CODE",{});var kh=l(_i);am=a(kh,"prompt"),kh.forEach(o),im=a(h,` input argument.
negative_pooled_prompt_embeds (`),bi=s(h,"CODE",{});var Ph=l(bi);sm=a(Ph,"torch.FloatTensor"),Ph.forEach(o),lm=a(h,", "),vi=s(h,"EM",{});var Jh=l(vi);rm=a(Jh,"optional"),Jh.forEach(o),dm=a(h,`):
Pre-generated negative pooled text embeddings. Can be used to easily tweak text inputs, `),wi=s(h,"EM",{});var Uh=l(wi);pm=a(Uh,"e.g."),Uh.forEach(o),cm=a(h,` prompt
weighting. If not provided, pooled negative_prompt_embeds will be generated from `),yi=s(h,"CODE",{});var Xh=l(yi);fm=a(Xh,"negative_prompt"),Xh.forEach(o),mm=a(h,`
input argument.
lora_scale (`),Ei=s(h,"CODE",{});var Ch=l(Ei);um=a(Ch,"float"),Ch.forEach(o),gm=a(h,", "),Mi=s(h,"EM",{});var Zh=l(Mi);hm=a(Zh,"optional"),Zh.forEach(o),_m=a(h,`):
A lora scale that will be applied to all LoRA layers of the text encoder if LoRA layers are loaded.`),h.forEach(o),Zo.forEach(o),T.forEach(o),this.h()},h(){p(S,"name","hf:doc:metadata"),p(S,"content",JSON.stringify(Yh)),p(D,"id","stable-diffusion-xl"),p(D,"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"),p(D,"href","#stable-diffusion-xl"),p(L,"class","relative group"),p(ze,"href","https://arxiv.org/abs/2307.01952"),p(ze,"rel","nofollow"),p(we,"id","tips"),p(we,"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"),p(we,"href","#tips"),p(ee,"class","relative group"),p(Ee,"id","available-checkpoints"),p(Ee,"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"),p(Ee,"href","#available-checkpoints"),p(te,"class","relative group"),p(qe,"href","https://huggingface.co/stabilityai/stable-diffusion-xl-base-0.9"),p(qe,"rel","nofollow"),p(ao,"href","/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLPipeline"),p(He,"href","https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-0.9"),p(He,"rel","nofollow"),p(io,"href","/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLImg2ImgPipeline"),p(Ie,"id","usage-example"),p(Ie,"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"),p(Ie,"href","#usage-example"),p(ae,"class","relative group"),p(xe,"id","texttoimage"),p(xe,"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"),p(xe,"href","#texttoimage"),p(ie,"class","relative group"),p(Te,"id","refining-the-image-output"),p(Te,"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"),p(Te,"href","#refining-the-image-output"),p(se,"class","relative group"),p(nt,"href","https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-0.9"),p(nt,"rel","nofollow"),p(De,"id","imagetoimage"),p(De,"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"),p(De,"href","#imagetoimage"),p(le,"class","relative group"),jh(un.src,vm="https://huggingface.co/datasets/diffusers/docs-images/resolve/main/sd_xl/init_image.png")||p(un,"src",vm),jh(hn.src,wm="https://huggingface.co/datasets/diffusers/docs-images/resolve/main/sd_xl/refined_image.png")||p(hn,"src",wm),p(Le,"id","loading-single-file-checkpoints-original-file-format"),p(Le,"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"),p(Le,"href","#loading-single-file-checkpoints-original-file-format"),p(re,"class","relative group"),p(so,"href","/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.from_single_file"),p(ke,"id","memory-optimization-via-model-offloading"),p(ke,"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"),p(ke,"href","#memory-optimization-via-model-offloading"),p(de,"class","relative group"),p(lo,"href","/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLPipeline.enable_model_cpu_offload"),p(Je,"id","speedup-inference-with-torchcompile"),p(Je,"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"),p(Je,"href","#speedup-inference-with-torchcompile"),p(pe,"class","relative group"),p(Ue,"id","running-with-torch-amplt-20"),p(Ue,"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"),p(Ue,"href","#running-with-torch-amplt-20"),p(ce,"class","relative group"),p(Xe,"id","diffusers.StableDiffusionXLPipeline"),p(Xe,"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"),p(Xe,"href","#diffusers.StableDiffusionXLPipeline"),p(me,"class","relative group"),p(co,"href","/docs/diffusers/v0.18.2/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),p(fo,"href","/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/depth2img#diffusers.StableDiffusionDepth2ImgPipeline.load_textual_inversion"),p(mo,"href","/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/depth2img#diffusers.StableDiffusionDepth2ImgPipeline.load_lora_weights"),p(uo,"href","/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.from_single_file"),p(go,"href","/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/depth2img#diffusers.StableDiffusionDepth2ImgPipeline.save_lora_weights"),p(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(We,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Ne,"id","diffusers.StableDiffusionXLImg2ImgPipeline"),p(Ne,"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"),p(Ne,"href","#diffusers.StableDiffusionXLImg2ImgPipeline"),p(he,"class","relative group"),p(ho,"href","/docs/diffusers/v0.18.2/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),p(_o,"href","/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/depth2img#diffusers.StableDiffusionDepth2ImgPipeline.load_textual_inversion"),p(bo,"href","/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/depth2img#diffusers.StableDiffusionDepth2ImgPipeline.load_lora_weights"),p(vo,"href","/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.from_single_file"),p(wo,"href","/docs/diffusers/v0.18.2/en/api/pipelines/stable_diffusion/depth2img#diffusers.StableDiffusionDepth2ImgPipeline.save_lora_weights"),p(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,c){e(document.head,S),f(t,j,c),f(t,L,c),e(L,D),e(D,J),v(M,J,null),e(L,P),e(L,jo),e(jo,el),f(t,$i,c),f(t,ve,c),e(ve,tl),e(ve,ze),e(ze,ol),e(ve,nl),f(t,Ti,c),f(t,oo,c),e(oo,al),f(t,Di,c),f(t,no,c),e(no,Go),e(Go,il),f(t,Si,c),f(t,ee,c),e(ee,we),e(we,Wo),v(Oe,Wo,null),e(ee,sl),e(ee,No),e(No,ll),f(t,Li,c),f(t,ye,c),e(ye,Ao),e(Ao,rl),e(ye,dl),e(ye,Fo),e(Fo,pl),f(t,ki,c),f(t,te,c),e(te,Ee),e(Ee,Bo),v(Ye,Bo,null),e(te,cl),e(te,Ro),e(Ro,fl),f(t,Pi,c),f(t,Me,c),e(Me,oe),e(oe,Vo),e(Vo,ml),e(oe,ul),e(oe,qe),e(qe,gl),e(oe,hl),e(oe,ao),e(ao,_l),e(Me,bl),e(Me,ne),e(ne,zo),e(zo,vl),e(ne,wl),e(ne,He),e(He,yl),e(ne,El),e(ne,io),e(io,Ml),f(t,Ji,c),f(t,ae,c),e(ae,Ie),e(Ie,Oo),v(Qe,Oo,null),e(ae,Il),e(ae,Yo),e(Yo,xl),f(t,Ui,c),f(t,U,c),e(U,$l),e(U,qo),e(qo,Tl),e(U,Dl),e(U,Ho),e(Ho,Sl),e(U,Ll),e(U,Qo),e(Qo,kl),e(U,Pl),e(U,Ko),e(Ko,Jl),e(U,Ul),f(t,Xi,c),v(Ke,t,c),f(t,Ci,c),f(t,ie,c),e(ie,xe),e(xe,en),v(et,en,null),e(ie,Xl),e(ie,tn),e(tn,Cl),f(t,Zi,c),f(t,$e,c),e($e,Zl),e($e,on),e(on,jl),e($e,Gl),f(t,ji,c),v(tt,t,c),f(t,Gi,c),f(t,se,c),e(se,Te),e(Te,nn),v(ot,nn,null),e(se,Wl),e(se,an),e(an,Nl),f(t,Wi,c),f(t,W,c),e(W,Al),e(W,nt),e(nt,Fl),e(W,Bl),e(W,sn),e(sn,Rl),e(W,Vl),f(t,Ni,c),v(at,t,c),f(t,Ai,c),f(t,le,c),e(le,De),e(De,ln),v(it,ln,null),e(le,zl),e(le,rn),e(rn,Ol),f(t,Fi,c),v(st,t,c),f(t,Bi,c),f(t,Se,c),e(Se,dn),e(dn,lt),e(lt,pn),e(pn,Yl),e(lt,ql),e(lt,cn),e(cn,Hl),e(Se,Ql),e(Se,fn),e(fn,rt),e(rt,mn),e(mn,un),e(rt,Kl),e(rt,gn),e(gn,hn),f(t,Ri,c),f(t,re,c),e(re,Le),e(Le,_n),v(dt,_n,null),e(re,er),e(re,bn),e(bn,tr),f(t,Vi,c),f(t,N,c),e(N,or),e(N,so),e(so,nr),e(N,ar),e(N,vn),e(vn,ir),e(N,sr),f(t,zi,c),v(pt,t,c),f(t,Oi,c),f(t,de,c),e(de,ke),e(ke,wn),v(ct,wn,null),e(de,lr),e(de,yn),e(yn,rr),f(t,Yi,c),f(t,Pe,c),e(Pe,dr),e(Pe,lo),e(lo,pr),e(Pe,cr),f(t,qi,c),v(ft,t,c),f(t,Hi,c),f(t,ro,c),e(ro,fr),f(t,Qi,c),v(mt,t,c),f(t,Ki,c),f(t,pe,c),e(pe,Je),e(Je,En),v(ut,En,null),e(pe,mr),e(pe,po),e(po,ur),e(po,Mn),e(Mn,gr),f(t,es,c),f(t,A,c),e(A,hr),e(A,In),e(In,_r),e(A,br),e(A,xn),e(xn,vr),e(A,wr),f(t,ts,c),v(gt,t,c),f(t,os,c),f(t,ce,c),e(ce,Ue),e(Ue,$n),v(ht,$n,null),e(ce,yr),e(ce,_t),e(_t,Er),e(_t,Tn),e(Tn,Mr),e(_t,Ir),f(t,ns,c),f(t,fe,c),e(fe,Dn),e(Dn,xr),e(fe,$r),e(fe,Sn),e(Sn,Tr),e(fe,Dr),f(t,as,c),v(bt,t,c),f(t,is,c),v(vt,t,c),f(t,ss,c),f(t,me,c),e(me,Xe),e(Xe,Ln),v(wt,Ln,null),e(me,Sr),e(me,kn),e(kn,Lr),f(t,ls,c),f(t,I,c),v(yt,I,null),e(I,kr),e(I,Pn),e(Pn,Pr),e(I,Jr),e(I,Et),e(Et,Ur),e(Et,co),e(co,Xr),e(Et,Cr),e(I,Zr),e(I,Jn),e(Jn,jr),e(I,Gr),e(I,ue),e(ue,Mt),e(Mt,Un),e(Un,Wr),e(Mt,Nr),e(Mt,fo),e(fo,Ar),e(ue,Fr),e(ue,It),e(It,Xn),e(Xn,Br),e(It,Rr),e(It,mo),e(mo,Vr),e(ue,zr),e(ue,xt),e(xt,Cn),e(Cn,Or),e(xt,Yr),e(xt,uo),e(uo,qr),e(I,Hr),e(I,Zn),e(Zn,Qr),e(I,Kr),e(I,jn),e(jn,$t),e($t,Gn),e(Gn,ed),e($t,td),e($t,go),e(go,od),e(I,nd),e(I,F),v(Tt,F,null),e(F,ad),e(F,Wn),e(Wn,id),e(F,sd),v(Ce,F,null),e(I,ld),e(I,Ze),v(Dt,Ze,null),e(Ze,rd),e(Ze,St),e(St,dd),e(St,Nn),e(Nn,pd),e(St,cd),e(I,fd),e(I,je),v(Lt,je,null),e(je,md),e(je,kt),e(kt,ud),e(kt,An),e(An,gd),e(kt,hd),e(I,_d),e(I,Ge),v(Pt,Ge,null),e(Ge,bd),e(Ge,X),e(X,vd),e(X,Fn),e(Fn,wd),e(X,yd),e(X,Bn),e(Bn,Ed),e(X,Md),e(X,Rn),e(Rn,Id),e(X,xd),e(X,Vn),e(Vn,$d),e(X,Td),e(I,Dd),e(I,We),v(Jt,We,null),e(We,Sd),e(We,ge),e(ge,Ld),e(ge,zn),e(zn,kd),e(ge,Pd),e(ge,On),e(On,Jd),e(ge,Ud),e(I,Xd),e(I,B),v(Ut,B,null),e(B,Cd),e(B,Yn),e(Yn,Zd),e(B,jd),e(B,qn),e(qn,Gd),e(I,Wd),e(I,R),v(Xt,R,null),e(R,Nd),e(R,Hn),e(Hn,Ad),e(R,Fd),e(R,Qn),e(Qn,Bd),e(I,Rd),e(I,V),v(Ct,V,null),e(V,Vd),e(V,Kn),e(Kn,zd),e(V,Od),e(V,m),e(m,Yd),e(m,ea),e(ea,qd),e(m,Hd),e(m,ta),e(ta,Qd),e(m,Kd),e(m,oa),e(oa,ep),e(m,tp),e(m,na),e(na,op),e(m,np),e(m,aa),e(aa,ap),e(m,ip),e(m,ia),e(ia,sp),e(m,lp),e(m,sa),e(sa,rp),e(m,dp),e(m,la),e(la,pp),e(m,cp),e(m,ra),e(ra,fp),e(m,mp),e(m,da),e(da,up),e(m,gp),e(m,pa),e(pa,hp),e(m,_p),e(m,ca),e(ca,bp),e(m,vp),e(m,fa),e(fa,wp),e(m,yp),e(m,ma),e(ma,Ep),e(m,Mp),e(m,ua),e(ua,Ip),e(m,xp),e(m,ga),e(ga,$p),e(m,Tp),e(m,ha),e(ha,Dp),e(m,Sp),e(m,_a),e(_a,Lp),e(m,kp),e(m,ba),e(ba,Pp),e(m,Jp),e(m,va),e(va,Up),e(m,Xp),e(m,wa),e(wa,Cp),e(m,Zp),e(m,ya),e(ya,jp),e(m,Gp),e(m,Ea),e(Ea,Wp),e(m,Np),e(m,Ma),e(Ma,Ap),e(m,Fp),e(m,Ia),e(Ia,Bp),e(m,Rp),e(m,xa),e(xa,Vp),e(m,zp),e(m,$a),e($a,Op),e(m,Yp),f(t,rs,c),f(t,he,c),e(he,Ne),e(Ne,Ta),v(Zt,Ta,null),e(he,qp),e(he,Da),e(Da,Hp),f(t,ds,c),f(t,x,c),v(jt,x,null),e(x,Qp),e(x,Sa),e(Sa,Kp),e(x,ec),e(x,Gt),e(Gt,tc),e(Gt,ho),e(ho,oc),e(Gt,nc),e(x,ac),e(x,La),e(La,ic),e(x,sc),e(x,_e),e(_e,Wt),e(Wt,ka),e(ka,lc),e(Wt,rc),e(Wt,_o),e(_o,dc),e(_e,pc),e(_e,Nt),e(Nt,Pa),e(Pa,cc),e(Nt,fc),e(Nt,bo),e(bo,mc),e(_e,uc),e(_e,At),e(At,Ja),e(Ja,gc),e(At,hc),e(At,vo),e(vo,_c),e(x,bc),e(x,Ua),e(Ua,vc),e(x,wc),e(x,Xa),e(Xa,Ft),e(Ft,Ca),e(Ca,yc),e(Ft,Ec),e(Ft,wo),e(wo,Mc),e(x,Ic),e(x,z),v(Bt,z,null),e(z,xc),e(z,Za),e(Za,$c),e(z,Tc),v(Ae,z,null),e(x,Dc),e(x,Fe),v(Rt,Fe,null),e(Fe,Sc),e(Fe,Vt),e(Vt,Lc),e(Vt,ja),e(ja,kc),e(Vt,Pc),e(x,Jc),e(x,Be),v(zt,Be,null),e(Be,Uc),e(Be,Ot),e(Ot,Xc),e(Ot,Ga),e(Ga,Cc),e(Ot,Zc),e(x,jc),e(x,Re),v(Yt,Re,null),e(Re,Gc),e(Re,C),e(C,Wc),e(C,Wa),e(Wa,Nc),e(C,Ac),e(C,Na),e(Na,Fc),e(C,Bc),e(C,Aa),e(Aa,Rc),e(C,Vc),e(C,Fa),e(Fa,zc),e(C,Oc),e(x,Yc),e(x,Ve),v(qt,Ve,null),e(Ve,qc),e(Ve,be),e(be,Hc),e(be,Ba),e(Ba,Qc),e(be,Kc),e(be,Ra),e(Ra,ef),e(be,tf),e(x,of),e(x,O),v(Ht,O,null),e(O,nf),e(O,Va),e(Va,af),e(O,sf),e(O,za),e(za,lf),e(x,rf),e(x,Y),v(Qt,Y,null),e(Y,df),e(Y,Oa),e(Oa,pf),e(Y,cf),e(Y,Ya),e(Ya,ff),e(x,mf),e(x,q),v(Kt,q,null),e(q,uf),e(q,qa),e(qa,gf),e(q,hf),e(q,u),e(u,_f),e(u,Ha),e(Ha,bf),e(u,vf),e(u,Qa),e(Qa,wf),e(u,yf),e(u,Ka),e(Ka,Ef),e(u,Mf),e(u,ei),e(ei,If),e(u,xf),e(u,ti),e(ti,$f),e(u,Tf),e(u,oi),e(oi,Df),e(u,Sf),e(u,ni),e(ni,Lf),e(u,kf),e(u,ai),e(ai,Pf),e(u,Jf),e(u,ii),e(ii,Uf),e(u,Xf),e(u,si),e(si,Cf),e(u,Zf),e(u,li),e(li,jf),e(u,Gf),e(u,ri),e(ri,Wf),e(u,Nf),e(u,di),e(di,Af),e(u,Ff),e(u,pi),e(pi,Bf),e(u,Rf),e(u,ci),e(ci,Vf),e(u,zf),e(u,fi),e(fi,Of),e(u,Yf),e(u,mi),e(mi,qf),e(u,Hf),e(u,ui),e(ui,Qf),e(u,Kf),e(u,gi),e(gi,em),e(u,tm),e(u,hi),e(hi,om),e(u,nm),e(u,_i),e(_i,am),e(u,im),e(u,bi),e(bi,sm),e(u,lm),e(u,vi),e(vi,rm),e(u,dm),e(u,wi),e(wi,pm),e(u,cm),e(u,yi),e(yi,fm),e(u,mm),e(u,Ei),e(Ei,um),e(u,gm),e(u,Mi),e(Mi,hm),e(u,_m),ps=!0},p(t,[c]){const eo={};c&2&&(eo.$$scope={dirty:c,ctx:t}),Ce.$set(eo);const Ii={};c&2&&(Ii.$$scope={dirty:c,ctx:t}),Ae.$set(Ii)},i(t){ps||(w(M.$$.fragment,t),w(Oe.$$.fragment,t),w(Ye.$$.fragment,t),w(Qe.$$.fragment,t),w(Ke.$$.fragment,t),w(et.$$.fragment,t),w(tt.$$.fragment,t),w(ot.$$.fragment,t),w(at.$$.fragment,t),w(it.$$.fragment,t),w(st.$$.fragment,t),w(dt.$$.fragment,t),w(pt.$$.fragment,t),w(ct.$$.fragment,t),w(ft.$$.fragment,t),w(mt.$$.fragment,t),w(ut.$$.fragment,t),w(gt.$$.fragment,t),w(ht.$$.fragment,t),w(bt.$$.fragment,t),w(vt.$$.fragment,t),w(wt.$$.fragment,t),w(yt.$$.fragment,t),w(Tt.$$.fragment,t),w(Ce.$$.fragment,t),w(Dt.$$.fragment,t),w(Lt.$$.fragment,t),w(Pt.$$.fragment,t),w(Jt.$$.fragment,t),w(Ut.$$.fragment,t),w(Xt.$$.fragment,t),w(Ct.$$.fragment,t),w(Zt.$$.fragment,t),w(jt.$$.fragment,t),w(Bt.$$.fragment,t),w(Ae.$$.fragment,t),w(Rt.$$.fragment,t),w(zt.$$.fragment,t),w(Yt.$$.fragment,t),w(qt.$$.fragment,t),w(Ht.$$.fragment,t),w(Qt.$$.fragment,t),w(Kt.$$.fragment,t),ps=!0)},o(t){y(M.$$.fragment,t),y(Oe.$$.fragment,t),y(Ye.$$.fragment,t),y(Qe.$$.fragment,t),y(Ke.$$.fragment,t),y(et.$$.fragment,t),y(tt.$$.fragment,t),y(ot.$$.fragment,t),y(at.$$.fragment,t),y(it.$$.fragment,t),y(st.$$.fragment,t),y(dt.$$.fragment,t),y(pt.$$.fragment,t),y(ct.$$.fragment,t),y(ft.$$.fragment,t),y(mt.$$.fragment,t),y(ut.$$.fragment,t),y(gt.$$.fragment,t),y(ht.$$.fragment,t),y(bt.$$.fragment,t),y(vt.$$.fragment,t),y(wt.$$.fragment,t),y(yt.$$.fragment,t),y(Tt.$$.fragment,t),y(Ce.$$.fragment,t),y(Dt.$$.fragment,t),y(Lt.$$.fragment,t),y(Pt.$$.fragment,t),y(Jt.$$.fragment,t),y(Ut.$$.fragment,t),y(Xt.$$.fragment,t),y(Ct.$$.fragment,t),y(Zt.$$.fragment,t),y(jt.$$.fragment,t),y(Bt.$$.fragment,t),y(Ae.$$.fragment,t),y(Rt.$$.fragment,t),y(zt.$$.fragment,t),y(Yt.$$.fragment,t),y(qt.$$.fragment,t),y(Ht.$$.fragment,t),y(Qt.$$.fragment,t),y(Kt.$$.fragment,t),ps=!1},d(t){o(S),t&&o(j),t&&o(L),E(M),t&&o($i),t&&o(ve),t&&o(Ti),t&&o(oo),t&&o(Di),t&&o(no),t&&o(Si),t&&o(ee),E(Oe),t&&o(Li),t&&o(ye),t&&o(ki),t&&o(te),E(Ye),t&&o(Pi),t&&o(Me),t&&o(Ji),t&&o(ae),E(Qe),t&&o(Ui),t&&o(U),t&&o(Xi),E(Ke,t),t&&o(Ci),t&&o(ie),E(et),t&&o(Zi),t&&o($e),t&&o(ji),E(tt,t),t&&o(Gi),t&&o(se),E(ot),t&&o(Wi),t&&o(W),t&&o(Ni),E(at,t),t&&o(Ai),t&&o(le),E(it),t&&o(Fi),E(st,t),t&&o(Bi),t&&o(Se),t&&o(Ri),t&&o(re),E(dt),t&&o(Vi),t&&o(N),t&&o(zi),E(pt,t),t&&o(Oi),t&&o(de),E(ct),t&&o(Yi),t&&o(Pe),t&&o(qi),E(ft,t),t&&o(Hi),t&&o(ro),t&&o(Qi),E(mt,t),t&&o(Ki),t&&o(pe),E(ut),t&&o(es),t&&o(A),t&&o(ts),E(gt,t),t&&o(os),t&&o(ce),E(ht),t&&o(ns),t&&o(fe),t&&o(as),E(bt,t),t&&o(is),E(vt,t),t&&o(ss),t&&o(me),E(wt),t&&o(ls),t&&o(I),E(yt),E(Tt),E(Ce),E(Dt),E(Lt),E(Pt),E(Jt),E(Ut),E(Xt),E(Ct),t&&o(rs),t&&o(he),E(Zt),t&&o(ds),t&&o(x),E(jt),E(Bt),E(Ae),E(Rt),E(zt),E(Yt),E(qt),E(Ht),E(Qt),E(Kt)}}}const Yh={local:"stable-diffusion-xl",sections:[{local:"tips",sections:[{local:"available-checkpoints",title:"Available checkpoints:"}],title:"Tips"},{local:"usage-example",sections:[{local:"texttoimage",title:"Text-to-Image"},{local:"refining-the-image-output",title:"Refining the image output"},{local:"imagetoimage",title:"Image-to-image "},{local:"loading-single-file-checkpoints-original-file-format",title:"Loading single file checkpoints / original file format"},{local:"memory-optimization-via-model-offloading",title:"Memory optimization via model offloading "},{local:"speedup-inference-with-torchcompile",title:"Speed-up inference with `torch.compile`"},{local:"running-with-torch-amplt-20",title:"Running with `torch` \\&amp;lt; 2.0"}],title:"Usage Example"},{local:"diffusers.StableDiffusionXLPipeline",title:"StableDiffusionXLPipeline"},{local:"diffusers.StableDiffusionXLImg2ImgPipeline",title:"StableDiffusionXLImg2ImgPipeline"}],title:"Stable diffusion XL"};function qh(to){return Rh(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class o_ extends Nh{constructor(S){super();Ah(this,S,qh,Oh,Fh,{})}}export{o_ as default,Yh as metadata};
