import{S as Au,i as Vu,s as Ru,e as a,k as r,w as h,t as n,M as Fu,c as s,d as o,m as d,a as l,x as g,h as i,b as p,G as e,g as f,y as _,q as b,o as v,B as y,v as Bu,L as Wu}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 Nu}from"../../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function zu(Ot){let S,j,T,L,U;return L=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=a("p"),j=n("Examples:"),T=r(),h(L.$$.fragment)},l(M){S=s(M,"P",{});var P=l(S);j=i(P,"Examples:"),P.forEach(o),T=d(M),g(L.$$.fragment,M)},m(M,P){f(M,S,P),e(S,j),f(M,T,P),_(L,M,P),U=!0},p:Wu,i(M){U||(b(L.$$.fragment,M),U=!0)},o(M){v(L.$$.fragment,M),U=!1},d(M){M&&o(S),M&&o(T),y(L,M)}}}function Ou(Ot){let S,j,T,L,U;return L=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=a("p"),j=n("Examples:"),T=r(),h(L.$$.fragment)},l(M){S=s(M,"P",{});var P=l(S);j=i(P,"Examples:"),P.forEach(o),T=d(M),g(L.$$.fragment,M)},m(M,P){f(M,S,P),e(S,j),f(M,T,P),_(L,M,P),U=!0},p:Wu,i(M){U||(b(L.$$.fragment,M),U=!0)},o(M){v(L.$$.fragment,M),U=!1},d(M){M&&o(S),M&&o(T),y(L,M)}}}function qu(Ot){let S,j,T,L,U,M,P,ko,us,zi,be,hs,Re,gs,_s,Oi,qt,bs,qi,Yt,Po,vs,Yi,ee,ve,Uo,Fe,ys,Co,ws,Hi,ye,Jo,Es,Ms,Xo,xs,Qi,te,we,jo,Be,$s,Zo,Is,Ki,Ee,oe,Go,Ds,Ls,ze,Ss,Ts,Ht,ks,Ps,ne,No,Us,Cs,Oe,Js,Xs,Qt,js,ea,ie,Me,Wo,qe,Zs,Ao,Gs,ta,C,Ns,Vo,Ws,As,Ro,Vs,Rs,Fo,Fs,Bs,Bo,zs,Os,oa,Ye,na,ae,xe,zo,He,qs,Oo,Ys,ia,$e,Hs,qo,Qs,Ks,aa,Qe,sa,se,Ie,Yo,Ke,el,Ho,tl,la,N,ol,et,nl,il,Qo,al,sl,ra,tt,da,le,De,Ko,ot,ll,en,rl,pa,W,dl,Kt,pl,cl,tn,fl,ml,ca,nt,fa,re,Le,on,it,ul,nn,hl,ma,Se,gl,eo,_l,bl,ua,at,ha,to,vl,ga,st,_a,de,Te,an,lt,yl,oo,wl,sn,El,ba,A,Ml,ln,xl,$l,rn,Il,Dl,va,rt,ya,pe,ke,dn,dt,Ll,pt,Sl,pn,Tl,kl,wa,ce,cn,Pl,Ul,fn,Cl,Jl,Ea,ct,Ma,ft,xa,fe,Pe,mn,mt,Xl,un,jl,$a,x,ut,Zl,hn,Gl,Nl,ht,Wl,no,Al,Vl,Rl,gn,Fl,Bl,me,gt,_n,zl,Ol,io,ql,Yl,_t,bn,Hl,Ql,ao,Kl,er,bt,vn,tr,or,so,nr,ir,yn,ar,sr,wn,vt,En,lr,rr,lo,dr,pr,V,yt,cr,Mn,fr,mr,Ue,ur,Ce,wt,hr,Et,gr,xn,_r,br,vr,Je,Mt,yr,xt,wr,$n,Er,Mr,xr,Xe,$t,$r,J,Ir,In,Dr,Lr,Dn,Sr,Tr,Ln,kr,Pr,Sn,Ur,Cr,Jr,je,It,Xr,ue,jr,Tn,Zr,Gr,kn,Nr,Wr,Ar,R,Dt,Vr,Pn,Rr,Fr,Un,Br,zr,F,Lt,Or,Cn,qr,Yr,Jn,Hr,Qr,B,St,Kr,Xn,ed,td,m,od,jn,nd,id,Zn,ad,sd,Gn,ld,rd,Nn,dd,pd,Wn,cd,fd,An,md,ud,Vn,hd,gd,Rn,_d,bd,Fn,vd,yd,Bn,wd,Ed,zn,Md,xd,On,$d,Id,qn,Dd,Ld,Yn,Sd,Td,Hn,kd,Pd,Qn,Ud,Cd,Kn,Jd,Xd,ei,jd,Zd,ti,Gd,Nd,Ia,he,Ze,oi,Tt,Wd,ni,Ad,Da,$,kt,Vd,ii,Rd,Fd,Pt,Bd,ro,zd,Od,qd,ai,Yd,Hd,ge,Ut,si,Qd,Kd,po,ep,tp,Ct,li,op,np,co,ip,ap,Jt,ri,sp,lp,fo,rp,dp,di,pp,cp,pi,Xt,ci,fp,mp,mo,up,hp,z,jt,gp,fi,_p,bp,Ge,vp,Ne,Zt,yp,Gt,wp,mi,Ep,Mp,xp,We,Nt,$p,Wt,Ip,ui,Dp,Lp,Sp,Ae,At,Tp,X,kp,hi,Pp,Up,gi,Cp,Jp,_i,Xp,jp,bi,Zp,Gp,Np,Ve,Vt,Wp,_e,Ap,vi,Vp,Rp,yi,Fp,Bp,zp,O,Rt,Op,wi,qp,Yp,Ei,Hp,Qp,q,Ft,Kp,Mi,ec,tc,xi,oc,nc,Y,Bt,ic,$i,ac,sc,u,lc,Ii,rc,dc,Di,pc,cc,Li,fc,mc,Si,uc,hc,Ti,gc,_c,ki,bc,vc,Pi,yc,wc,Ui,Ec,Mc,Ci,xc,$c,Ji,Ic,Dc,Xi,Lc,Sc,ji,Tc,kc,Zi,Pc,Uc,Gi,Cc,Jc,Ni,Xc,jc,Wi,Zc,Gc,Ai,Nc,Wc,Vi,Ac,Vc,Ri,Rc,Fc,La;return M=new Z({}),Fe=new Z({}),Be=new Z({}),qe=new Z({}),Ye=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>`}}),He=new Z({}),Qe=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>]`}}),Ke=new Z({}),tt=new G({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUlMkMlMjBTdGFibGVEaWZmdXNpb25YTEltZzJJbWdQaXBlbGluZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi14bC1iYXNlLTAuOSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyJTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUwQSklMEFwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBcmVmaW5lciUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblhMSW1nMkltZ1BpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtcmVmaW5lci0wLjklMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlJTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIlMEEpJTBBcmVmaW5lci50byglMjJjdWRhJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkFzdHJvbmF1dCUyMGluJTIwYSUyMGp1bmdsZSUyQyUyMGNvbGQlMjBjb2xvciUyMHBhbGV0dGUlMkMlMjBtdXRlZCUyMGNvbG9ycyUyQyUyMGRldGFpbGVkJTJDJTIwOGslMjIlMEElMEFpbWFnZSUyMCUzRCUyMHBpcGUocHJvbXB0JTNEcHJvbXB0JTJDJTIwb3V0cHV0X3R5cGUlM0QlMjJsYXRlbnQlMjIlMjBpZiUyMHVzZV9yZWZpbmVyJTIwZWxzZSUyMCUyMnBpbCUyMikuaW1hZ2VzJTVCMCU1RCUwQWltYWdlJTIwJTNEJTIwcmVmaW5lcihwcm9tcHQlM0Rwcm9tcHQlMkMlMjBpbWFnZSUzRGltYWdlJTVCTm9uZSUyQyUyMCUzQSU1RCkuaW1hZ2VzJTVCMCU1RA==",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>)

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>]`}}),ot=new Z({}),nt=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>)`}}),it=new Z({}),at=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>`}}),st=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>`}}),lt=new Z({}),rt=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>`}}),dt=new Z({}),ct=new G({props:{code:"cGlwJTIwaW5zdGFsbCUyMHhmb3JtZXJz",highlighted:'pip <span class="hljs-keyword">install</span> xformers'}}),ft=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>`}}),mt=new Z({}),ut=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.0/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.0/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.0/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.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.18.0/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.18.0/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L76"}}),yt=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:"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.0/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__.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.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L522",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>
`}}),Ue=new Nu({props:{anchor:"diffusers.StableDiffusionXLPipeline.__call__.example",$$slots:{default:[zu]},$$scope:{ctx:Ot}}}),wt=new k({props:{name:"disable_vae_slicing",anchor:"diffusers.StableDiffusionXLPipeline.disable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L144"}}),Mt=new k({props:{name:"disable_vae_tiling",anchor:"diffusers.StableDiffusionXLPipeline.disable_vae_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L160"}}),$t=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.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L189"}}),It=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.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L167"}}),Dt=new k({props:{name:"enable_vae_slicing",anchor:"diffusers.StableDiffusionXLPipeline.enable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L135"}}),Lt=new k({props:{name:"enable_vae_tiling",anchor:"diffusers.StableDiffusionXLPipeline.enable_vae_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L151"}}),St=new k({props:{name:"encode_prompt",anchor:"diffusers.StableDiffusionXLPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"device",val:""},{name:"num_images_per_prompt",val:""},{name:"do_classifier_free_guidance",val:""},{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:"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.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py#L237"}}),Tt=new Z({}),kt=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.0/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.0/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.0/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.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.18.0/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.18.0/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py#L81"}}),jt=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:"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.0/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__.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.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py#L604",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>
`}}),Ge=new Nu({props:{anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.__call__.example",$$slots:{default:[Ou]},$$scope:{ctx:Ot}}}),Zt=new k({props:{name:"disable_vae_slicing",anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.disable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py#L152"}}),Nt=new k({props:{name:"disable_vae_tiling",anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.disable_vae_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py#L168"}}),At=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.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py#L197"}}),Vt=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.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py#L175"}}),Rt=new k({props:{name:"enable_vae_slicing",anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.enable_vae_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py#L143"}}),Ft=new k({props:{name:"enable_vae_tiling",anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.enable_vae_tiling",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py#L159"}}),Bt=new k({props:{name:"encode_prompt",anchor:"diffusers.StableDiffusionXLImg2ImgPipeline.encode_prompt",parameters:[{name:"prompt",val:""},{name:"device",val:""},{name:"num_images_per_prompt",val:""},{name:"do_classifier_free_guidance",val:""},{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:"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.0/src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py#L245"}}),{c(){S=a("meta"),j=r(),T=a("h1"),L=a("a"),U=a("span"),h(M.$$.fragment),P=r(),ko=a("span"),us=n("Stable diffusion XL"),zi=r(),be=a("p"),hs=n("Stable Diffusion XL was proposed in "),Re=a("a"),gs=n("SDXL: Improving Latent Diffusion Models for High-Resolution Image Synthesis"),_s=n(" by Dustin Podell, Zion English, Kyle Lacey, Andreas Blattmann, Tim Dockhorn, Jonas M\xFCller, Joe Penna, Robin Rombach"),Oi=r(),qt=a("p"),bs=n("The abstract of the paper is the following:"),qi=r(),Yt=a("p"),Po=a("em"),vs=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."),Yi=r(),ee=a("h2"),ve=a("a"),Uo=a("span"),h(Fe.$$.fragment),ys=r(),Co=a("span"),ws=n("Tips"),Hi=r(),ye=a("ul"),Jo=a("li"),Es=n("Stable Diffusion XL works especially well with images between 768 and 1024."),Ms=r(),Xo=a("li"),xs=n("Stable Diffusion XL output image can be improved by making use of a refiner as shown below"),Qi=r(),te=a("h3"),we=a("a"),jo=a("span"),h(Be.$$.fragment),$s=r(),Zo=a("span"),Is=n("Available checkpoints:"),Ki=r(),Ee=a("ul"),oe=a("li"),Go=a("em"),Ds=n("Text-to-Image (1024x1024 resolution)"),Ls=n(": "),ze=a("a"),Ss=n("stabilityai/stable-diffusion-xl-base-0.9"),Ts=n(" with "),Ht=a("a"),ks=n("StableDiffusionXLPipeline"),Ps=r(),ne=a("li"),No=a("em"),Us=n("Image-to-Image / Refiner (1024x1024 resolution)"),Cs=n(": "),Oe=a("a"),Js=n("stabilityai/stable-diffusion-xl-refiner-0.9"),Xs=n(" with "),Qt=a("a"),js=n("StableDiffusionXLImg2ImgPipeline"),ea=r(),ie=a("h2"),Me=a("a"),Wo=a("span"),h(qe.$$.fragment),Zs=r(),Ao=a("span"),Gs=n("Usage Example"),ta=r(),C=a("p"),Ns=n("Before using SDXL make sure to have "),Vo=a("code"),Ws=n("transformers"),As=n(", "),Ro=a("code"),Vs=n("accelerate"),Rs=n(", "),Fo=a("code"),Fs=n("safetensors"),Bs=n(" and "),Bo=a("code"),zs=n("invisible_watermark"),Os=n(` installed.
You can install the libraries as follows:`),oa=r(),h(Ye.$$.fragment),na=r(),ae=a("h3"),xe=a("a"),zo=a("span"),h(He.$$.fragment),qs=r(),Oo=a("span"),Ys=n("*Text-to-Image*"),ia=r(),$e=a("p"),Hs=n("You can use SDXL as follows for "),qo=a("em"),Qs=n("text-to-image"),Ks=n(":"),aa=r(),h(Qe.$$.fragment),sa=r(),se=a("h3"),Ie=a("a"),Yo=a("span"),h(Ke.$$.fragment),el=r(),Ho=a("span"),tl=n("Refining the image output"),la=r(),N=a("p"),ol=n("The image can be refined by making use of "),et=a("a"),nl=n("stabilityai/stable-diffusion-xl-refiner-0.9"),il=n(`.
In this case, you only have to output the `),Qo=a("code"),al=n("latents"),sl=n(" from the base model."),ra=r(),h(tt.$$.fragment),da=r(),le=a("h3"),De=a("a"),Ko=a("span"),h(ot.$$.fragment),ll=r(),en=a("span"),rl=n("Loading single file checkpoitns / original file format"),pa=r(),W=a("p"),dl=n("By making use of "),Kt=a("a"),pl=n("from_single_file()"),cl=n(` you can also load the
original file format into `),tn=a("code"),fl=n("diffusers"),ml=n(":"),ca=r(),h(nt.$$.fragment),fa=r(),re=a("h3"),Le=a("a"),on=a("span"),h(it.$$.fragment),ul=r(),nn=a("span"),hl=n("Memory optimization via model offloading"),ma=r(),Se=a("p"),gl=n("If you are seeing out-of-memory errors, we recommend making use of "),eo=a("a"),_l=n("StableDiffusionXLPipeline.enable_model_cpu_offload()"),bl=n("."),ua=r(),h(at.$$.fragment),ha=r(),to=a("p"),vl=n("and"),ga=r(),h(st.$$.fragment),_a=r(),de=a("h3"),Te=a("a"),an=a("span"),h(lt.$$.fragment),yl=r(),oo=a("span"),wl=n("Speed-up inference with "),sn=a("code"),El=n("torch.compile"),ba=r(),A=a("p"),Ml=n("You can speed up inference by making use of "),ln=a("code"),xl=n("torch.compile"),$l=n(". This should give you "),rn=a("strong"),Il=n("ca."),Dl=n(" 20% speed-up."),va=r(),h(rt.$$.fragment),ya=r(),pe=a("h3"),ke=a("a"),dn=a("span"),h(dt.$$.fragment),Ll=r(),pt=a("span"),Sl=n("Running with "),pn=a("code"),Tl=n("torch"),kl=n(" &lt; 2.0"),wa=r(),ce=a("p"),cn=a("strong"),Pl=n("Note"),Ul=n(" that if you want to run Stable Diffusion XL with "),fn=a("code"),Cl=n("torch"),Jl=n(` < 2.0, please make sure to enable xformers
attention:`),Ea=r(),h(ct.$$.fragment),Ma=r(),h(ft.$$.fragment),xa=r(),fe=a("h2"),Pe=a("a"),mn=a("span"),h(mt.$$.fragment),Xl=r(),un=a("span"),jl=n("StableDiffusionXLPipeline"),$a=r(),x=a("div"),h(ut.$$.fragment),Zl=r(),hn=a("p"),Gl=n("Pipeline for text-to-image generation using Stable Diffusion."),Nl=r(),ht=a("p"),Wl=n("This model inherits from "),no=a("a"),Al=n("DiffusionPipeline"),Vl=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.)`),Rl=r(),gn=a("p"),Fl=n("In addition the pipeline inherits the following loading methods:"),Bl=r(),me=a("ul"),gt=a("li"),_n=a("em"),zl=n("Textual-Inversion"),Ol=n(": "),io=a("a"),ql=n("loaders.TextualInversionLoaderMixin.load_textual_inversion()"),Yl=r(),_t=a("li"),bn=a("em"),Hl=n("LoRA"),Ql=n(": "),ao=a("a"),Kl=n("loaders.LoraLoaderMixin.load_lora_weights()"),er=r(),bt=a("li"),vn=a("em"),tr=n("Ckpt"),or=n(": "),so=a("a"),nr=n("loaders.FromSingleFileMixin.from_single_file()"),ir=r(),yn=a("p"),ar=n("as well as the following saving methods:"),sr=r(),wn=a("ul"),vt=a("li"),En=a("em"),lr=n("LoRA"),rr=n(": "),lo=a("a"),dr=n("loaders.LoraLoaderMixin.save_lora_weights()"),pr=r(),V=a("div"),h(yt.$$.fragment),cr=r(),Mn=a("p"),fr=n("Function invoked when calling the pipeline for generation."),mr=r(),h(Ue.$$.fragment),ur=r(),Ce=a("div"),h(wt.$$.fragment),hr=r(),Et=a("p"),gr=n("Disable sliced VAE decoding. If "),xn=a("code"),_r=n("enable_vae_slicing"),br=n(` was previously invoked, this method will go back to
computing decoding in one step.`),vr=r(),Je=a("div"),h(Mt.$$.fragment),yr=r(),xt=a("p"),wr=n("Disable tiled VAE decoding. If "),$n=a("code"),Er=n("enable_vae_tiling"),Mr=n(` was previously invoked, this method will go back to
computing decoding in one step.`),xr=r(),Xe=a("div"),h($t.$$.fragment),$r=r(),J=a("p"),Ir=n(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),In=a("code"),Dr=n("enable_sequential_cpu_offload"),Lr=n(", this method moves one whole model at a time to the GPU when its "),Dn=a("code"),Sr=n("forward"),Tr=n(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Ln=a("code"),kr=n("enable_sequential_cpu_offload"),Pr=n(", but performance is much better due to the iterative execution of the "),Sn=a("code"),Ur=n("unet"),Cr=n("."),Jr=r(),je=a("div"),h(It.$$.fragment),Xr=r(),ue=a("p"),jr=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
`),Tn=a("code"),Zr=n("torch.device('meta') and loaded to GPU only when their specific submodule has its "),Gr=n("forward"),kn=a("code"),Nr=n("method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),Wr=n("enable_model_cpu_offload`, but performance is lower."),Ar=r(),R=a("div"),h(Dt.$$.fragment),Vr=r(),Pn=a("p"),Rr=n("Enable sliced VAE decoding."),Fr=r(),Un=a("p"),Br=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.`),zr=r(),F=a("div"),h(Lt.$$.fragment),Or=r(),Cn=a("p"),qr=n("Enable tiled VAE decoding."),Yr=r(),Jn=a("p"),Hr=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.`),Qr=r(),B=a("div"),h(St.$$.fragment),Kr=r(),Xn=a("p"),ed=n("Encodes the prompt into text encoder hidden states."),td=r(),m=a("p"),od=n("device: ("),jn=a("code"),nd=n("torch.device"),id=n(`):
torch device
num_images_per_prompt (`),Zn=a("code"),ad=n("int"),sd=n(`):
number of images that should be generated per prompt
do_classifier_free_guidance (`),Gn=a("code"),ld=n("bool"),rd=n(`):
whether to use classifier free guidance or not
negative_prompt (`),Nn=a("code"),dd=n("str"),pd=n(" or "),Wn=a("code"),cd=n("List[str]"),fd=n(", "),An=a("em"),md=n("optional"),ud=n(`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),Vn=a("code"),hd=n("negative_prompt_embeds"),gd=n(" instead. Ignored when not using guidance (i.e., ignored if "),Rn=a("code"),_d=n("guidance_scale"),bd=n(` is
less than `),Fn=a("code"),vd=n("1"),yd=n(`).
prompt_embeds (`),Bn=a("code"),wd=n("torch.FloatTensor"),Ed=n(", "),zn=a("em"),Md=n("optional"),xd=n(`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),On=a("em"),$d=n("e.g."),Id=n(` prompt weighting. If not
provided, text embeddings will be generated from `),qn=a("code"),Dd=n("prompt"),Ld=n(` input argument.
negative_prompt_embeds (`),Yn=a("code"),Sd=n("torch.FloatTensor"),Td=n(", "),Hn=a("em"),kd=n("optional"),Pd=n(`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),Qn=a("em"),Ud=n("e.g."),Cd=n(` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),Kn=a("code"),Jd=n("negative_prompt"),Xd=n(` input
argument.
lora_scale (`),ei=a("code"),jd=n("float"),Zd=n(", "),ti=a("em"),Gd=n("optional"),Nd=n(`):
A lora scale that will be applied to all LoRA layers of the text encoder if LoRA layers are loaded.`),Ia=r(),he=a("h2"),Ze=a("a"),oi=a("span"),h(Tt.$$.fragment),Wd=r(),ni=a("span"),Ad=n("StableDiffusionXLImg2ImgPipeline"),Da=r(),$=a("div"),h(kt.$$.fragment),Vd=r(),ii=a("p"),Rd=n("Pipeline for text-to-image generation using Stable Diffusion."),Fd=r(),Pt=a("p"),Bd=n("This model inherits from "),ro=a("a"),zd=n("DiffusionPipeline"),Od=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.)`),qd=r(),ai=a("p"),Yd=n("In addition the pipeline inherits the following loading methods:"),Hd=r(),ge=a("ul"),Ut=a("li"),si=a("em"),Qd=n("Textual-Inversion"),Kd=n(": "),po=a("a"),ep=n("loaders.TextualInversionLoaderMixin.load_textual_inversion()"),tp=r(),Ct=a("li"),li=a("em"),op=n("LoRA"),np=n(": "),co=a("a"),ip=n("loaders.LoraLoaderMixin.load_lora_weights()"),ap=r(),Jt=a("li"),ri=a("em"),sp=n("Ckpt"),lp=n(": "),fo=a("a"),rp=n("loaders.FromSingleFileMixin.from_single_file()"),dp=r(),di=a("p"),pp=n("as well as the following saving methods:"),cp=r(),pi=a("ul"),Xt=a("li"),ci=a("em"),fp=n("LoRA"),mp=n(": "),mo=a("a"),up=n("loaders.LoraLoaderMixin.save_lora_weights()"),hp=r(),z=a("div"),h(jt.$$.fragment),gp=r(),fi=a("p"),_p=n("Function invoked when calling the pipeline for generation."),bp=r(),h(Ge.$$.fragment),vp=r(),Ne=a("div"),h(Zt.$$.fragment),yp=r(),Gt=a("p"),wp=n("Disable sliced VAE decoding. If "),mi=a("code"),Ep=n("enable_vae_slicing"),Mp=n(` was previously invoked, this method will go back to
computing decoding in one step.`),xp=r(),We=a("div"),h(Nt.$$.fragment),$p=r(),Wt=a("p"),Ip=n("Disable tiled VAE decoding. If "),ui=a("code"),Dp=n("enable_vae_tiling"),Lp=n(` was previously invoked, this method will go back to
computing decoding in one step.`),Sp=r(),Ae=a("div"),h(At.$$.fragment),Tp=r(),X=a("p"),kp=n(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),hi=a("code"),Pp=n("enable_sequential_cpu_offload"),Up=n(", this method moves one whole model at a time to the GPU when its "),gi=a("code"),Cp=n("forward"),Jp=n(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),_i=a("code"),Xp=n("enable_sequential_cpu_offload"),jp=n(", but performance is much better due to the iterative execution of the "),bi=a("code"),Zp=n("unet"),Gp=n("."),Np=r(),Ve=a("div"),h(Vt.$$.fragment),Wp=r(),_e=a("p"),Ap=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
`),vi=a("code"),Vp=n("torch.device('meta') and loaded to GPU only when their specific submodule has its "),Rp=n("forward"),yi=a("code"),Fp=n("method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),Bp=n("enable_model_cpu_offload`, but performance is lower."),zp=r(),O=a("div"),h(Rt.$$.fragment),Op=r(),wi=a("p"),qp=n("Enable sliced VAE decoding."),Yp=r(),Ei=a("p"),Hp=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.`),Qp=r(),q=a("div"),h(Ft.$$.fragment),Kp=r(),Mi=a("p"),ec=n("Enable tiled VAE decoding."),tc=r(),xi=a("p"),oc=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.`),nc=r(),Y=a("div"),h(Bt.$$.fragment),ic=r(),$i=a("p"),ac=n("Encodes the prompt into text encoder hidden states."),sc=r(),u=a("p"),lc=n("device: ("),Ii=a("code"),rc=n("torch.device"),dc=n(`):
torch device
num_images_per_prompt (`),Di=a("code"),pc=n("int"),cc=n(`):
number of images that should be generated per prompt
do_classifier_free_guidance (`),Li=a("code"),fc=n("bool"),mc=n(`):
whether to use classifier free guidance or not
negative_prompt (`),Si=a("code"),uc=n("str"),hc=n(" or "),Ti=a("code"),gc=n("List[str]"),_c=n(", "),ki=a("em"),bc=n("optional"),vc=n(`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),Pi=a("code"),yc=n("negative_prompt_embeds"),wc=n(" instead. Ignored when not using guidance (i.e., ignored if "),Ui=a("code"),Ec=n("guidance_scale"),Mc=n(` is
less than `),Ci=a("code"),xc=n("1"),$c=n(`).
prompt_embeds (`),Ji=a("code"),Ic=n("torch.FloatTensor"),Dc=n(", "),Xi=a("em"),Lc=n("optional"),Sc=n(`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),ji=a("em"),Tc=n("e.g."),kc=n(` prompt weighting. If not
provided, text embeddings will be generated from `),Zi=a("code"),Pc=n("prompt"),Uc=n(` input argument.
negative_prompt_embeds (`),Gi=a("code"),Cc=n("torch.FloatTensor"),Jc=n(", "),Ni=a("em"),Xc=n("optional"),jc=n(`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),Wi=a("em"),Zc=n("e.g."),Gc=n(` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),Ai=a("code"),Nc=n("negative_prompt"),Wc=n(` input
argument.
lora_scale (`),Vi=a("code"),Ac=n("float"),Vc=n(", "),Ri=a("em"),Rc=n("optional"),Fc=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=Fu('[data-svelte="svelte-1phssyn"]',document.head);S=s(c,"META",{name:!0,content:!0}),c.forEach(o),j=d(t),T=s(t,"H1",{class:!0});var zt=l(T);L=s(zt,"A",{id:!0,class:!0,href:!0});var Fi=l(L);U=s(Fi,"SPAN",{});var zc=l(U);g(M.$$.fragment,zc),zc.forEach(o),Fi.forEach(o),P=d(zt),ko=s(zt,"SPAN",{});var Oc=l(ko);us=i(Oc,"Stable diffusion XL"),Oc.forEach(o),zt.forEach(o),zi=d(t),be=s(t,"P",{});var Sa=l(be);hs=i(Sa,"Stable Diffusion XL was proposed in "),Re=s(Sa,"A",{href:!0,rel:!0});var qc=l(Re);gs=i(qc,"SDXL: Improving Latent Diffusion Models for High-Resolution Image Synthesis"),qc.forEach(o),_s=i(Sa," by Dustin Podell, Zion English, Kyle Lacey, Andreas Blattmann, Tim Dockhorn, Jonas M\xFCller, Joe Penna, Robin Rombach"),Sa.forEach(o),Oi=d(t),qt=s(t,"P",{});var Yc=l(qt);bs=i(Yc,"The abstract of the paper is the following:"),Yc.forEach(o),qi=d(t),Yt=s(t,"P",{});var Hc=l(Yt);Po=s(Hc,"EM",{});var Qc=l(Po);vs=i(Qc,"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."),Qc.forEach(o),Hc.forEach(o),Yi=d(t),ee=s(t,"H2",{class:!0});var Ta=l(ee);ve=s(Ta,"A",{id:!0,class:!0,href:!0});var Kc=l(ve);Uo=s(Kc,"SPAN",{});var ef=l(Uo);g(Fe.$$.fragment,ef),ef.forEach(o),Kc.forEach(o),ys=d(Ta),Co=s(Ta,"SPAN",{});var tf=l(Co);ws=i(tf,"Tips"),tf.forEach(o),Ta.forEach(o),Hi=d(t),ye=s(t,"UL",{});var ka=l(ye);Jo=s(ka,"LI",{});var of=l(Jo);Es=i(of,"Stable Diffusion XL works especially well with images between 768 and 1024."),of.forEach(o),Ms=d(ka),Xo=s(ka,"LI",{});var nf=l(Xo);xs=i(nf,"Stable Diffusion XL output image can be improved by making use of a refiner as shown below"),nf.forEach(o),ka.forEach(o),Qi=d(t),te=s(t,"H3",{class:!0});var Pa=l(te);we=s(Pa,"A",{id:!0,class:!0,href:!0});var af=l(we);jo=s(af,"SPAN",{});var sf=l(jo);g(Be.$$.fragment,sf),sf.forEach(o),af.forEach(o),$s=d(Pa),Zo=s(Pa,"SPAN",{});var lf=l(Zo);Is=i(lf,"Available checkpoints:"),lf.forEach(o),Pa.forEach(o),Ki=d(t),Ee=s(t,"UL",{});var Ua=l(Ee);oe=s(Ua,"LI",{});var uo=l(oe);Go=s(uo,"EM",{});var rf=l(Go);Ds=i(rf,"Text-to-Image (1024x1024 resolution)"),rf.forEach(o),Ls=i(uo,": "),ze=s(uo,"A",{href:!0,rel:!0});var df=l(ze);Ss=i(df,"stabilityai/stable-diffusion-xl-base-0.9"),df.forEach(o),Ts=i(uo," with "),Ht=s(uo,"A",{href:!0});var pf=l(Ht);ks=i(pf,"StableDiffusionXLPipeline"),pf.forEach(o),uo.forEach(o),Ps=d(Ua),ne=s(Ua,"LI",{});var ho=l(ne);No=s(ho,"EM",{});var cf=l(No);Us=i(cf,"Image-to-Image / Refiner (1024x1024 resolution)"),cf.forEach(o),Cs=i(ho,": "),Oe=s(ho,"A",{href:!0,rel:!0});var ff=l(Oe);Js=i(ff,"stabilityai/stable-diffusion-xl-refiner-0.9"),ff.forEach(o),Xs=i(ho," with "),Qt=s(ho,"A",{href:!0});var mf=l(Qt);js=i(mf,"StableDiffusionXLImg2ImgPipeline"),mf.forEach(o),ho.forEach(o),Ua.forEach(o),ea=d(t),ie=s(t,"H2",{class:!0});var Ca=l(ie);Me=s(Ca,"A",{id:!0,class:!0,href:!0});var uf=l(Me);Wo=s(uf,"SPAN",{});var hf=l(Wo);g(qe.$$.fragment,hf),hf.forEach(o),uf.forEach(o),Zs=d(Ca),Ao=s(Ca,"SPAN",{});var gf=l(Ao);Gs=i(gf,"Usage Example"),gf.forEach(o),Ca.forEach(o),ta=d(t),C=s(t,"P",{});var H=l(C);Ns=i(H,"Before using SDXL make sure to have "),Vo=s(H,"CODE",{});var _f=l(Vo);Ws=i(_f,"transformers"),_f.forEach(o),As=i(H,", "),Ro=s(H,"CODE",{});var bf=l(Ro);Vs=i(bf,"accelerate"),bf.forEach(o),Rs=i(H,", "),Fo=s(H,"CODE",{});var vf=l(Fo);Fs=i(vf,"safetensors"),vf.forEach(o),Bs=i(H," and "),Bo=s(H,"CODE",{});var yf=l(Bo);zs=i(yf,"invisible_watermark"),yf.forEach(o),Os=i(H,` installed.
You can install the libraries as follows:`),H.forEach(o),oa=d(t),g(Ye.$$.fragment,t),na=d(t),ae=s(t,"H3",{class:!0});var Ja=l(ae);xe=s(Ja,"A",{id:!0,class:!0,href:!0});var wf=l(xe);zo=s(wf,"SPAN",{});var Ef=l(zo);g(He.$$.fragment,Ef),Ef.forEach(o),wf.forEach(o),qs=d(Ja),Oo=s(Ja,"SPAN",{});var Mf=l(Oo);Ys=i(Mf,"*Text-to-Image*"),Mf.forEach(o),Ja.forEach(o),ia=d(t),$e=s(t,"P",{});var Xa=l($e);Hs=i(Xa,"You can use SDXL as follows for "),qo=s(Xa,"EM",{});var xf=l(qo);Qs=i(xf,"text-to-image"),xf.forEach(o),Ks=i(Xa,":"),Xa.forEach(o),aa=d(t),g(Qe.$$.fragment,t),sa=d(t),se=s(t,"H3",{class:!0});var ja=l(se);Ie=s(ja,"A",{id:!0,class:!0,href:!0});var $f=l(Ie);Yo=s($f,"SPAN",{});var If=l(Yo);g(Ke.$$.fragment,If),If.forEach(o),$f.forEach(o),el=d(ja),Ho=s(ja,"SPAN",{});var Df=l(Ho);tl=i(Df,"Refining the image output"),Df.forEach(o),ja.forEach(o),la=d(t),N=s(t,"P",{});var go=l(N);ol=i(go,"The image can be refined by making use of "),et=s(go,"A",{href:!0,rel:!0});var Lf=l(et);nl=i(Lf,"stabilityai/stable-diffusion-xl-refiner-0.9"),Lf.forEach(o),il=i(go,`.
In this case, you only have to output the `),Qo=s(go,"CODE",{});var Sf=l(Qo);al=i(Sf,"latents"),Sf.forEach(o),sl=i(go," from the base model."),go.forEach(o),ra=d(t),g(tt.$$.fragment,t),da=d(t),le=s(t,"H3",{class:!0});var Za=l(le);De=s(Za,"A",{id:!0,class:!0,href:!0});var Tf=l(De);Ko=s(Tf,"SPAN",{});var kf=l(Ko);g(ot.$$.fragment,kf),kf.forEach(o),Tf.forEach(o),ll=d(Za),en=s(Za,"SPAN",{});var Pf=l(en);rl=i(Pf,"Loading single file checkpoitns / original file format"),Pf.forEach(o),Za.forEach(o),pa=d(t),W=s(t,"P",{});var _o=l(W);dl=i(_o,"By making use of "),Kt=s(_o,"A",{href:!0});var Uf=l(Kt);pl=i(Uf,"from_single_file()"),Uf.forEach(o),cl=i(_o,` you can also load the
original file format into `),tn=s(_o,"CODE",{});var Cf=l(tn);fl=i(Cf,"diffusers"),Cf.forEach(o),ml=i(_o,":"),_o.forEach(o),ca=d(t),g(nt.$$.fragment,t),fa=d(t),re=s(t,"H3",{class:!0});var Ga=l(re);Le=s(Ga,"A",{id:!0,class:!0,href:!0});var Jf=l(Le);on=s(Jf,"SPAN",{});var Xf=l(on);g(it.$$.fragment,Xf),Xf.forEach(o),Jf.forEach(o),ul=d(Ga),nn=s(Ga,"SPAN",{});var jf=l(nn);hl=i(jf,"Memory optimization via model offloading"),jf.forEach(o),Ga.forEach(o),ma=d(t),Se=s(t,"P",{});var Na=l(Se);gl=i(Na,"If you are seeing out-of-memory errors, we recommend making use of "),eo=s(Na,"A",{href:!0});var Zf=l(eo);_l=i(Zf,"StableDiffusionXLPipeline.enable_model_cpu_offload()"),Zf.forEach(o),bl=i(Na,"."),Na.forEach(o),ua=d(t),g(at.$$.fragment,t),ha=d(t),to=s(t,"P",{});var Gf=l(to);vl=i(Gf,"and"),Gf.forEach(o),ga=d(t),g(st.$$.fragment,t),_a=d(t),de=s(t,"H3",{class:!0});var Wa=l(de);Te=s(Wa,"A",{id:!0,class:!0,href:!0});var Nf=l(Te);an=s(Nf,"SPAN",{});var Wf=l(an);g(lt.$$.fragment,Wf),Wf.forEach(o),Nf.forEach(o),yl=d(Wa),oo=s(Wa,"SPAN",{});var Bc=l(oo);wl=i(Bc,"Speed-up inference with "),sn=s(Bc,"CODE",{});var Af=l(sn);El=i(Af,"torch.compile"),Af.forEach(o),Bc.forEach(o),Wa.forEach(o),ba=d(t),A=s(t,"P",{});var bo=l(A);Ml=i(bo,"You can speed up inference by making use of "),ln=s(bo,"CODE",{});var Vf=l(ln);xl=i(Vf,"torch.compile"),Vf.forEach(o),$l=i(bo,". This should give you "),rn=s(bo,"STRONG",{});var Rf=l(rn);Il=i(Rf,"ca."),Rf.forEach(o),Dl=i(bo," 20% speed-up."),bo.forEach(o),va=d(t),g(rt.$$.fragment,t),ya=d(t),pe=s(t,"H3",{class:!0});var Aa=l(pe);ke=s(Aa,"A",{id:!0,class:!0,href:!0});var Ff=l(ke);dn=s(Ff,"SPAN",{});var Bf=l(dn);g(dt.$$.fragment,Bf),Bf.forEach(o),Ff.forEach(o),Ll=d(Aa),pt=s(Aa,"SPAN",{});var Va=l(pt);Sl=i(Va,"Running with "),pn=s(Va,"CODE",{});var zf=l(pn);Tl=i(zf,"torch"),zf.forEach(o),kl=i(Va," &lt; 2.0"),Va.forEach(o),Aa.forEach(o),wa=d(t),ce=s(t,"P",{});var Bi=l(ce);cn=s(Bi,"STRONG",{});var Of=l(cn);Pl=i(Of,"Note"),Of.forEach(o),Ul=i(Bi," that if you want to run Stable Diffusion XL with "),fn=s(Bi,"CODE",{});var qf=l(fn);Cl=i(qf,"torch"),qf.forEach(o),Jl=i(Bi,` < 2.0, please make sure to enable xformers
attention:`),Bi.forEach(o),Ea=d(t),g(ct.$$.fragment,t),Ma=d(t),g(ft.$$.fragment,t),xa=d(t),fe=s(t,"H2",{class:!0});var Ra=l(fe);Pe=s(Ra,"A",{id:!0,class:!0,href:!0});var Yf=l(Pe);mn=s(Yf,"SPAN",{});var Hf=l(mn);g(mt.$$.fragment,Hf),Hf.forEach(o),Yf.forEach(o),Xl=d(Ra),un=s(Ra,"SPAN",{});var Qf=l(un);jl=i(Qf,"StableDiffusionXLPipeline"),Qf.forEach(o),Ra.forEach(o),$a=d(t),x=s(t,"DIV",{class:!0});var I=l(x);g(ut.$$.fragment,I),Zl=d(I),hn=s(I,"P",{});var Kf=l(hn);Gl=i(Kf,"Pipeline for text-to-image generation using Stable Diffusion."),Kf.forEach(o),Nl=d(I),ht=s(I,"P",{});var Fa=l(ht);Wl=i(Fa,"This model inherits from "),no=s(Fa,"A",{href:!0});var em=l(no);Al=i(em,"DiffusionPipeline"),em.forEach(o),Vl=i(Fa,`. 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.)`),Fa.forEach(o),Rl=d(I),gn=s(I,"P",{});var tm=l(gn);Fl=i(tm,"In addition the pipeline inherits the following loading methods:"),tm.forEach(o),Bl=d(I),me=s(I,"UL",{});var vo=l(me);gt=s(vo,"LI",{});var Ba=l(gt);_n=s(Ba,"EM",{});var om=l(_n);zl=i(om,"Textual-Inversion"),om.forEach(o),Ol=i(Ba,": "),io=s(Ba,"A",{href:!0});var nm=l(io);ql=i(nm,"loaders.TextualInversionLoaderMixin.load_textual_inversion()"),nm.forEach(o),Ba.forEach(o),Yl=d(vo),_t=s(vo,"LI",{});var za=l(_t);bn=s(za,"EM",{});var im=l(bn);Hl=i(im,"LoRA"),im.forEach(o),Ql=i(za,": "),ao=s(za,"A",{href:!0});var am=l(ao);Kl=i(am,"loaders.LoraLoaderMixin.load_lora_weights()"),am.forEach(o),za.forEach(o),er=d(vo),bt=s(vo,"LI",{});var Oa=l(bt);vn=s(Oa,"EM",{});var sm=l(vn);tr=i(sm,"Ckpt"),sm.forEach(o),or=i(Oa,": "),so=s(Oa,"A",{href:!0});var lm=l(so);nr=i(lm,"loaders.FromSingleFileMixin.from_single_file()"),lm.forEach(o),Oa.forEach(o),vo.forEach(o),ir=d(I),yn=s(I,"P",{});var rm=l(yn);ar=i(rm,"as well as the following saving methods:"),rm.forEach(o),sr=d(I),wn=s(I,"UL",{});var dm=l(wn);vt=s(dm,"LI",{});var qa=l(vt);En=s(qa,"EM",{});var pm=l(En);lr=i(pm,"LoRA"),pm.forEach(o),rr=i(qa,": "),lo=s(qa,"A",{href:!0});var cm=l(lo);dr=i(cm,"loaders.LoraLoaderMixin.save_lora_weights()"),cm.forEach(o),qa.forEach(o),dm.forEach(o),pr=d(I),V=s(I,"DIV",{class:!0});var yo=l(V);g(yt.$$.fragment,yo),cr=d(yo),Mn=s(yo,"P",{});var fm=l(Mn);fr=i(fm,"Function invoked when calling the pipeline for generation."),fm.forEach(o),mr=d(yo),g(Ue.$$.fragment,yo),yo.forEach(o),ur=d(I),Ce=s(I,"DIV",{class:!0});var Ya=l(Ce);g(wt.$$.fragment,Ya),hr=d(Ya),Et=s(Ya,"P",{});var Ha=l(Et);gr=i(Ha,"Disable sliced VAE decoding. If "),xn=s(Ha,"CODE",{});var mm=l(xn);_r=i(mm,"enable_vae_slicing"),mm.forEach(o),br=i(Ha,` was previously invoked, this method will go back to
computing decoding in one step.`),Ha.forEach(o),Ya.forEach(o),vr=d(I),Je=s(I,"DIV",{class:!0});var Qa=l(Je);g(Mt.$$.fragment,Qa),yr=d(Qa),xt=s(Qa,"P",{});var Ka=l(xt);wr=i(Ka,"Disable tiled VAE decoding. If "),$n=s(Ka,"CODE",{});var um=l($n);Er=i(um,"enable_vae_tiling"),um.forEach(o),Mr=i(Ka,` was previously invoked, this method will go back to
computing decoding in one step.`),Ka.forEach(o),Qa.forEach(o),xr=d(I),Xe=s(I,"DIV",{class:!0});var es=l(Xe);g($t.$$.fragment,es),$r=d(es),J=s(es,"P",{});var Q=l(J);Ir=i(Q,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),In=s(Q,"CODE",{});var hm=l(In);Dr=i(hm,"enable_sequential_cpu_offload"),hm.forEach(o),Lr=i(Q,", this method moves one whole model at a time to the GPU when its "),Dn=s(Q,"CODE",{});var gm=l(Dn);Sr=i(gm,"forward"),gm.forEach(o),Tr=i(Q,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Ln=s(Q,"CODE",{});var _m=l(Ln);kr=i(_m,"enable_sequential_cpu_offload"),_m.forEach(o),Pr=i(Q,", but performance is much better due to the iterative execution of the "),Sn=s(Q,"CODE",{});var bm=l(Sn);Ur=i(bm,"unet"),bm.forEach(o),Cr=i(Q,"."),Q.forEach(o),es.forEach(o),Jr=d(I),je=s(I,"DIV",{class:!0});var ts=l(je);g(It.$$.fragment,ts),Xr=d(ts),ue=s(ts,"P",{});var wo=l(ue);jr=i(wo,`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
`),Tn=s(wo,"CODE",{});var vm=l(Tn);Zr=i(vm,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),vm.forEach(o),Gr=i(wo,"forward"),kn=s(wo,"CODE",{});var ym=l(kn);Nr=i(ym,"method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),ym.forEach(o),Wr=i(wo,"enable_model_cpu_offload`, but performance is lower."),wo.forEach(o),ts.forEach(o),Ar=d(I),R=s(I,"DIV",{class:!0});var Eo=l(R);g(Dt.$$.fragment,Eo),Vr=d(Eo),Pn=s(Eo,"P",{});var wm=l(Pn);Rr=i(wm,"Enable sliced VAE decoding."),wm.forEach(o),Fr=d(Eo),Un=s(Eo,"P",{});var Em=l(Un);Br=i(Em,`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.`),Em.forEach(o),Eo.forEach(o),zr=d(I),F=s(I,"DIV",{class:!0});var Mo=l(F);g(Lt.$$.fragment,Mo),Or=d(Mo),Cn=s(Mo,"P",{});var Mm=l(Cn);qr=i(Mm,"Enable tiled VAE decoding."),Mm.forEach(o),Yr=d(Mo),Jn=s(Mo,"P",{});var xm=l(Jn);Hr=i(xm,`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.`),xm.forEach(o),Mo.forEach(o),Qr=d(I),B=s(I,"DIV",{class:!0});var xo=l(B);g(St.$$.fragment,xo),Kr=d(xo),Xn=s(xo,"P",{});var $m=l(Xn);ed=i($m,"Encodes the prompt into text encoder hidden states."),$m.forEach(o),td=d(xo),m=s(xo,"P",{});var w=l(m);od=i(w,"device: ("),jn=s(w,"CODE",{});var Im=l(jn);nd=i(Im,"torch.device"),Im.forEach(o),id=i(w,`):
torch device
num_images_per_prompt (`),Zn=s(w,"CODE",{});var Dm=l(Zn);ad=i(Dm,"int"),Dm.forEach(o),sd=i(w,`):
number of images that should be generated per prompt
do_classifier_free_guidance (`),Gn=s(w,"CODE",{});var Lm=l(Gn);ld=i(Lm,"bool"),Lm.forEach(o),rd=i(w,`):
whether to use classifier free guidance or not
negative_prompt (`),Nn=s(w,"CODE",{});var Sm=l(Nn);dd=i(Sm,"str"),Sm.forEach(o),pd=i(w," or "),Wn=s(w,"CODE",{});var Tm=l(Wn);cd=i(Tm,"List[str]"),Tm.forEach(o),fd=i(w,", "),An=s(w,"EM",{});var km=l(An);md=i(km,"optional"),km.forEach(o),ud=i(w,`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),Vn=s(w,"CODE",{});var Pm=l(Vn);hd=i(Pm,"negative_prompt_embeds"),Pm.forEach(o),gd=i(w," instead. Ignored when not using guidance (i.e., ignored if "),Rn=s(w,"CODE",{});var Um=l(Rn);_d=i(Um,"guidance_scale"),Um.forEach(o),bd=i(w,` is
less than `),Fn=s(w,"CODE",{});var Cm=l(Fn);vd=i(Cm,"1"),Cm.forEach(o),yd=i(w,`).
prompt_embeds (`),Bn=s(w,"CODE",{});var Jm=l(Bn);wd=i(Jm,"torch.FloatTensor"),Jm.forEach(o),Ed=i(w,", "),zn=s(w,"EM",{});var Xm=l(zn);Md=i(Xm,"optional"),Xm.forEach(o),xd=i(w,`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),On=s(w,"EM",{});var jm=l(On);$d=i(jm,"e.g."),jm.forEach(o),Id=i(w,` prompt weighting. If not
provided, text embeddings will be generated from `),qn=s(w,"CODE",{});var Zm=l(qn);Dd=i(Zm,"prompt"),Zm.forEach(o),Ld=i(w,` input argument.
negative_prompt_embeds (`),Yn=s(w,"CODE",{});var Gm=l(Yn);Sd=i(Gm,"torch.FloatTensor"),Gm.forEach(o),Td=i(w,", "),Hn=s(w,"EM",{});var Nm=l(Hn);kd=i(Nm,"optional"),Nm.forEach(o),Pd=i(w,`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),Qn=s(w,"EM",{});var Wm=l(Qn);Ud=i(Wm,"e.g."),Wm.forEach(o),Cd=i(w,` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),Kn=s(w,"CODE",{});var Am=l(Kn);Jd=i(Am,"negative_prompt"),Am.forEach(o),Xd=i(w,` input
argument.
lora_scale (`),ei=s(w,"CODE",{});var Vm=l(ei);jd=i(Vm,"float"),Vm.forEach(o),Zd=i(w,", "),ti=s(w,"EM",{});var Rm=l(ti);Gd=i(Rm,"optional"),Rm.forEach(o),Nd=i(w,`):
A lora scale that will be applied to all LoRA layers of the text encoder if LoRA layers are loaded.`),w.forEach(o),xo.forEach(o),I.forEach(o),Ia=d(t),he=s(t,"H2",{class:!0});var os=l(he);Ze=s(os,"A",{id:!0,class:!0,href:!0});var Fm=l(Ze);oi=s(Fm,"SPAN",{});var Bm=l(oi);g(Tt.$$.fragment,Bm),Bm.forEach(o),Fm.forEach(o),Wd=d(os),ni=s(os,"SPAN",{});var zm=l(ni);Ad=i(zm,"StableDiffusionXLImg2ImgPipeline"),zm.forEach(o),os.forEach(o),Da=d(t),$=s(t,"DIV",{class:!0});var D=l($);g(kt.$$.fragment,D),Vd=d(D),ii=s(D,"P",{});var Om=l(ii);Rd=i(Om,"Pipeline for text-to-image generation using Stable Diffusion."),Om.forEach(o),Fd=d(D),Pt=s(D,"P",{});var ns=l(Pt);Bd=i(ns,"This model inherits from "),ro=s(ns,"A",{href:!0});var qm=l(ro);zd=i(qm,"DiffusionPipeline"),qm.forEach(o),Od=i(ns,`. 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.)`),ns.forEach(o),qd=d(D),ai=s(D,"P",{});var Ym=l(ai);Yd=i(Ym,"In addition the pipeline inherits the following loading methods:"),Ym.forEach(o),Hd=d(D),ge=s(D,"UL",{});var $o=l(ge);Ut=s($o,"LI",{});var is=l(Ut);si=s(is,"EM",{});var Hm=l(si);Qd=i(Hm,"Textual-Inversion"),Hm.forEach(o),Kd=i(is,": "),po=s(is,"A",{href:!0});var Qm=l(po);ep=i(Qm,"loaders.TextualInversionLoaderMixin.load_textual_inversion()"),Qm.forEach(o),is.forEach(o),tp=d($o),Ct=s($o,"LI",{});var as=l(Ct);li=s(as,"EM",{});var Km=l(li);op=i(Km,"LoRA"),Km.forEach(o),np=i(as,": "),co=s(as,"A",{href:!0});var eu=l(co);ip=i(eu,"loaders.LoraLoaderMixin.load_lora_weights()"),eu.forEach(o),as.forEach(o),ap=d($o),Jt=s($o,"LI",{});var ss=l(Jt);ri=s(ss,"EM",{});var tu=l(ri);sp=i(tu,"Ckpt"),tu.forEach(o),lp=i(ss,": "),fo=s(ss,"A",{href:!0});var ou=l(fo);rp=i(ou,"loaders.FromSingleFileMixin.from_single_file()"),ou.forEach(o),ss.forEach(o),$o.forEach(o),dp=d(D),di=s(D,"P",{});var nu=l(di);pp=i(nu,"as well as the following saving methods:"),nu.forEach(o),cp=d(D),pi=s(D,"UL",{});var iu=l(pi);Xt=s(iu,"LI",{});var ls=l(Xt);ci=s(ls,"EM",{});var au=l(ci);fp=i(au,"LoRA"),au.forEach(o),mp=i(ls,": "),mo=s(ls,"A",{href:!0});var su=l(mo);up=i(su,"loaders.LoraLoaderMixin.save_lora_weights()"),su.forEach(o),ls.forEach(o),iu.forEach(o),hp=d(D),z=s(D,"DIV",{class:!0});var Io=l(z);g(jt.$$.fragment,Io),gp=d(Io),fi=s(Io,"P",{});var lu=l(fi);_p=i(lu,"Function invoked when calling the pipeline for generation."),lu.forEach(o),bp=d(Io),g(Ge.$$.fragment,Io),Io.forEach(o),vp=d(D),Ne=s(D,"DIV",{class:!0});var rs=l(Ne);g(Zt.$$.fragment,rs),yp=d(rs),Gt=s(rs,"P",{});var ds=l(Gt);wp=i(ds,"Disable sliced VAE decoding. If "),mi=s(ds,"CODE",{});var ru=l(mi);Ep=i(ru,"enable_vae_slicing"),ru.forEach(o),Mp=i(ds,` was previously invoked, this method will go back to
computing decoding in one step.`),ds.forEach(o),rs.forEach(o),xp=d(D),We=s(D,"DIV",{class:!0});var ps=l(We);g(Nt.$$.fragment,ps),$p=d(ps),Wt=s(ps,"P",{});var cs=l(Wt);Ip=i(cs,"Disable tiled VAE decoding. If "),ui=s(cs,"CODE",{});var du=l(ui);Dp=i(du,"enable_vae_tiling"),du.forEach(o),Lp=i(cs,` was previously invoked, this method will go back to
computing decoding in one step.`),cs.forEach(o),ps.forEach(o),Sp=d(D),Ae=s(D,"DIV",{class:!0});var fs=l(Ae);g(At.$$.fragment,fs),Tp=d(fs),X=s(fs,"P",{});var K=l(X);kp=i(K,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),hi=s(K,"CODE",{});var pu=l(hi);Pp=i(pu,"enable_sequential_cpu_offload"),pu.forEach(o),Up=i(K,", this method moves one whole model at a time to the GPU when its "),gi=s(K,"CODE",{});var cu=l(gi);Cp=i(cu,"forward"),cu.forEach(o),Jp=i(K,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),_i=s(K,"CODE",{});var fu=l(_i);Xp=i(fu,"enable_sequential_cpu_offload"),fu.forEach(o),jp=i(K,", but performance is much better due to the iterative execution of the "),bi=s(K,"CODE",{});var mu=l(bi);Zp=i(mu,"unet"),mu.forEach(o),Gp=i(K,"."),K.forEach(o),fs.forEach(o),Np=d(D),Ve=s(D,"DIV",{class:!0});var ms=l(Ve);g(Vt.$$.fragment,ms),Wp=d(ms),_e=s(ms,"P",{});var Do=l(_e);Ap=i(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
`),vi=s(Do,"CODE",{});var uu=l(vi);Vp=i(uu,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),uu.forEach(o),Rp=i(Do,"forward"),yi=s(Do,"CODE",{});var hu=l(yi);Fp=i(hu,"method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),hu.forEach(o),Bp=i(Do,"enable_model_cpu_offload`, but performance is lower."),Do.forEach(o),ms.forEach(o),zp=d(D),O=s(D,"DIV",{class:!0});var Lo=l(O);g(Rt.$$.fragment,Lo),Op=d(Lo),wi=s(Lo,"P",{});var gu=l(wi);qp=i(gu,"Enable sliced VAE decoding."),gu.forEach(o),Yp=d(Lo),Ei=s(Lo,"P",{});var _u=l(Ei);Hp=i(_u,`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.`),_u.forEach(o),Lo.forEach(o),Qp=d(D),q=s(D,"DIV",{class:!0});var So=l(q);g(Ft.$$.fragment,So),Kp=d(So),Mi=s(So,"P",{});var bu=l(Mi);ec=i(bu,"Enable tiled VAE decoding."),bu.forEach(o),tc=d(So),xi=s(So,"P",{});var vu=l(xi);oc=i(vu,`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.`),vu.forEach(o),So.forEach(o),nc=d(D),Y=s(D,"DIV",{class:!0});var To=l(Y);g(Bt.$$.fragment,To),ic=d(To),$i=s(To,"P",{});var yu=l($i);ac=i(yu,"Encodes the prompt into text encoder hidden states."),yu.forEach(o),sc=d(To),u=s(To,"P",{});var E=l(u);lc=i(E,"device: ("),Ii=s(E,"CODE",{});var wu=l(Ii);rc=i(wu,"torch.device"),wu.forEach(o),dc=i(E,`):
torch device
num_images_per_prompt (`),Di=s(E,"CODE",{});var Eu=l(Di);pc=i(Eu,"int"),Eu.forEach(o),cc=i(E,`):
number of images that should be generated per prompt
do_classifier_free_guidance (`),Li=s(E,"CODE",{});var Mu=l(Li);fc=i(Mu,"bool"),Mu.forEach(o),mc=i(E,`):
whether to use classifier free guidance or not
negative_prompt (`),Si=s(E,"CODE",{});var xu=l(Si);uc=i(xu,"str"),xu.forEach(o),hc=i(E," or "),Ti=s(E,"CODE",{});var $u=l(Ti);gc=i($u,"List[str]"),$u.forEach(o),_c=i(E,", "),ki=s(E,"EM",{});var Iu=l(ki);bc=i(Iu,"optional"),Iu.forEach(o),vc=i(E,`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),Pi=s(E,"CODE",{});var Du=l(Pi);yc=i(Du,"negative_prompt_embeds"),Du.forEach(o),wc=i(E," instead. Ignored when not using guidance (i.e., ignored if "),Ui=s(E,"CODE",{});var Lu=l(Ui);Ec=i(Lu,"guidance_scale"),Lu.forEach(o),Mc=i(E,` is
less than `),Ci=s(E,"CODE",{});var Su=l(Ci);xc=i(Su,"1"),Su.forEach(o),$c=i(E,`).
prompt_embeds (`),Ji=s(E,"CODE",{});var Tu=l(Ji);Ic=i(Tu,"torch.FloatTensor"),Tu.forEach(o),Dc=i(E,", "),Xi=s(E,"EM",{});var ku=l(Xi);Lc=i(ku,"optional"),ku.forEach(o),Sc=i(E,`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),ji=s(E,"EM",{});var Pu=l(ji);Tc=i(Pu,"e.g."),Pu.forEach(o),kc=i(E,` prompt weighting. If not
provided, text embeddings will be generated from `),Zi=s(E,"CODE",{});var Uu=l(Zi);Pc=i(Uu,"prompt"),Uu.forEach(o),Uc=i(E,` input argument.
negative_prompt_embeds (`),Gi=s(E,"CODE",{});var Cu=l(Gi);Cc=i(Cu,"torch.FloatTensor"),Cu.forEach(o),Jc=i(E,", "),Ni=s(E,"EM",{});var Ju=l(Ni);Xc=i(Ju,"optional"),Ju.forEach(o),jc=i(E,`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),Wi=s(E,"EM",{});var Xu=l(Wi);Zc=i(Xu,"e.g."),Xu.forEach(o),Gc=i(E,` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),Ai=s(E,"CODE",{});var ju=l(Ai);Nc=i(ju,"negative_prompt"),ju.forEach(o),Wc=i(E,` input
argument.
lora_scale (`),Vi=s(E,"CODE",{});var Zu=l(Vi);Ac=i(Zu,"float"),Zu.forEach(o),Vc=i(E,", "),Ri=s(E,"EM",{});var Gu=l(Ri);Rc=i(Gu,"optional"),Gu.forEach(o),Fc=i(E,`):
A lora scale that will be applied to all LoRA layers of the text encoder if LoRA layers are loaded.`),E.forEach(o),To.forEach(o),D.forEach(o),this.h()},h(){p(S,"name","hf:doc:metadata"),p(S,"content",JSON.stringify(Yu)),p(L,"id","stable-diffusion-xl"),p(L,"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(L,"href","#stable-diffusion-xl"),p(T,"class","relative group"),p(Re,"href","https://arxiv.org/abs/2307.01952"),p(Re,"rel","nofollow"),p(ve,"id","tips"),p(ve,"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(ve,"href","#tips"),p(ee,"class","relative group"),p(we,"id","available-checkpoints"),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","#available-checkpoints"),p(te,"class","relative group"),p(ze,"href","https://huggingface.co/stabilityai/stable-diffusion-xl-base-0.9"),p(ze,"rel","nofollow"),p(Ht,"href","/docs/diffusers/v0.18.0/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLPipeline"),p(Oe,"href","https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-0.9"),p(Oe,"rel","nofollow"),p(Qt,"href","/docs/diffusers/v0.18.0/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLImg2ImgPipeline"),p(Me,"id","usage-example"),p(Me,"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(Me,"href","#usage-example"),p(ie,"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(ae,"class","relative group"),p(Ie,"id","refining-the-image-output"),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","#refining-the-image-output"),p(se,"class","relative group"),p(et,"href","https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-0.9"),p(et,"rel","nofollow"),p(De,"id","loading-single-file-checkpoitns-original-file-format"),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","#loading-single-file-checkpoitns-original-file-format"),p(le,"class","relative group"),p(Kt,"href","/docs/diffusers/v0.18.0/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.from_single_file"),p(Le,"id","memory-optimization-via-model-offloading"),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","#memory-optimization-via-model-offloading"),p(re,"class","relative group"),p(eo,"href","/docs/diffusers/v0.18.0/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLPipeline.enable_model_cpu_offload"),p(Te,"id","speedup-inference-with-torchcompile"),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","#speedup-inference-with-torchcompile"),p(de,"class","relative group"),p(ke,"id","running-with-torch-amplt-20"),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","#running-with-torch-amplt-20"),p(pe,"class","relative group"),p(Pe,"id","diffusers.StableDiffusionXLPipeline"),p(Pe,"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(Pe,"href","#diffusers.StableDiffusionXLPipeline"),p(fe,"class","relative group"),p(no,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),p(io,"href","/docs/diffusers/v0.18.0/en/api/pipelines/stable_diffusion/depth2img#diffusers.StableDiffusionDepth2ImgPipeline.load_textual_inversion"),p(ao,"href","/docs/diffusers/v0.18.0/en/api/pipelines/stable_diffusion/depth2img#diffusers.StableDiffusionDepth2ImgPipeline.load_lora_weights"),p(so,"href","/docs/diffusers/v0.18.0/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.from_single_file"),p(lo,"href","/docs/diffusers/v0.18.0/en/api/pipelines/stable_diffusion/depth2img#diffusers.StableDiffusionDepth2ImgPipeline.save_lora_weights"),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(Ce,"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(Xe,"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(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(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(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(x,"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,"id","diffusers.StableDiffusionXLImg2ImgPipeline"),p(Ze,"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(Ze,"href","#diffusers.StableDiffusionXLImg2ImgPipeline"),p(he,"class","relative group"),p(ro,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),p(po,"href","/docs/diffusers/v0.18.0/en/api/pipelines/stable_diffusion/depth2img#diffusers.StableDiffusionDepth2ImgPipeline.load_textual_inversion"),p(co,"href","/docs/diffusers/v0.18.0/en/api/pipelines/stable_diffusion/depth2img#diffusers.StableDiffusionDepth2ImgPipeline.load_lora_weights"),p(fo,"href","/docs/diffusers/v0.18.0/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.from_single_file"),p(mo,"href","/docs/diffusers/v0.18.0/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(Ne,"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(Ae,"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(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(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($,"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,T,c),e(T,L),e(L,U),_(M,U,null),e(T,P),e(T,ko),e(ko,us),f(t,zi,c),f(t,be,c),e(be,hs),e(be,Re),e(Re,gs),e(be,_s),f(t,Oi,c),f(t,qt,c),e(qt,bs),f(t,qi,c),f(t,Yt,c),e(Yt,Po),e(Po,vs),f(t,Yi,c),f(t,ee,c),e(ee,ve),e(ve,Uo),_(Fe,Uo,null),e(ee,ys),e(ee,Co),e(Co,ws),f(t,Hi,c),f(t,ye,c),e(ye,Jo),e(Jo,Es),e(ye,Ms),e(ye,Xo),e(Xo,xs),f(t,Qi,c),f(t,te,c),e(te,we),e(we,jo),_(Be,jo,null),e(te,$s),e(te,Zo),e(Zo,Is),f(t,Ki,c),f(t,Ee,c),e(Ee,oe),e(oe,Go),e(Go,Ds),e(oe,Ls),e(oe,ze),e(ze,Ss),e(oe,Ts),e(oe,Ht),e(Ht,ks),e(Ee,Ps),e(Ee,ne),e(ne,No),e(No,Us),e(ne,Cs),e(ne,Oe),e(Oe,Js),e(ne,Xs),e(ne,Qt),e(Qt,js),f(t,ea,c),f(t,ie,c),e(ie,Me),e(Me,Wo),_(qe,Wo,null),e(ie,Zs),e(ie,Ao),e(Ao,Gs),f(t,ta,c),f(t,C,c),e(C,Ns),e(C,Vo),e(Vo,Ws),e(C,As),e(C,Ro),e(Ro,Vs),e(C,Rs),e(C,Fo),e(Fo,Fs),e(C,Bs),e(C,Bo),e(Bo,zs),e(C,Os),f(t,oa,c),_(Ye,t,c),f(t,na,c),f(t,ae,c),e(ae,xe),e(xe,zo),_(He,zo,null),e(ae,qs),e(ae,Oo),e(Oo,Ys),f(t,ia,c),f(t,$e,c),e($e,Hs),e($e,qo),e(qo,Qs),e($e,Ks),f(t,aa,c),_(Qe,t,c),f(t,sa,c),f(t,se,c),e(se,Ie),e(Ie,Yo),_(Ke,Yo,null),e(se,el),e(se,Ho),e(Ho,tl),f(t,la,c),f(t,N,c),e(N,ol),e(N,et),e(et,nl),e(N,il),e(N,Qo),e(Qo,al),e(N,sl),f(t,ra,c),_(tt,t,c),f(t,da,c),f(t,le,c),e(le,De),e(De,Ko),_(ot,Ko,null),e(le,ll),e(le,en),e(en,rl),f(t,pa,c),f(t,W,c),e(W,dl),e(W,Kt),e(Kt,pl),e(W,cl),e(W,tn),e(tn,fl),e(W,ml),f(t,ca,c),_(nt,t,c),f(t,fa,c),f(t,re,c),e(re,Le),e(Le,on),_(it,on,null),e(re,ul),e(re,nn),e(nn,hl),f(t,ma,c),f(t,Se,c),e(Se,gl),e(Se,eo),e(eo,_l),e(Se,bl),f(t,ua,c),_(at,t,c),f(t,ha,c),f(t,to,c),e(to,vl),f(t,ga,c),_(st,t,c),f(t,_a,c),f(t,de,c),e(de,Te),e(Te,an),_(lt,an,null),e(de,yl),e(de,oo),e(oo,wl),e(oo,sn),e(sn,El),f(t,ba,c),f(t,A,c),e(A,Ml),e(A,ln),e(ln,xl),e(A,$l),e(A,rn),e(rn,Il),e(A,Dl),f(t,va,c),_(rt,t,c),f(t,ya,c),f(t,pe,c),e(pe,ke),e(ke,dn),_(dt,dn,null),e(pe,Ll),e(pe,pt),e(pt,Sl),e(pt,pn),e(pn,Tl),e(pt,kl),f(t,wa,c),f(t,ce,c),e(ce,cn),e(cn,Pl),e(ce,Ul),e(ce,fn),e(fn,Cl),e(ce,Jl),f(t,Ea,c),_(ct,t,c),f(t,Ma,c),_(ft,t,c),f(t,xa,c),f(t,fe,c),e(fe,Pe),e(Pe,mn),_(mt,mn,null),e(fe,Xl),e(fe,un),e(un,jl),f(t,$a,c),f(t,x,c),_(ut,x,null),e(x,Zl),e(x,hn),e(hn,Gl),e(x,Nl),e(x,ht),e(ht,Wl),e(ht,no),e(no,Al),e(ht,Vl),e(x,Rl),e(x,gn),e(gn,Fl),e(x,Bl),e(x,me),e(me,gt),e(gt,_n),e(_n,zl),e(gt,Ol),e(gt,io),e(io,ql),e(me,Yl),e(me,_t),e(_t,bn),e(bn,Hl),e(_t,Ql),e(_t,ao),e(ao,Kl),e(me,er),e(me,bt),e(bt,vn),e(vn,tr),e(bt,or),e(bt,so),e(so,nr),e(x,ir),e(x,yn),e(yn,ar),e(x,sr),e(x,wn),e(wn,vt),e(vt,En),e(En,lr),e(vt,rr),e(vt,lo),e(lo,dr),e(x,pr),e(x,V),_(yt,V,null),e(V,cr),e(V,Mn),e(Mn,fr),e(V,mr),_(Ue,V,null),e(x,ur),e(x,Ce),_(wt,Ce,null),e(Ce,hr),e(Ce,Et),e(Et,gr),e(Et,xn),e(xn,_r),e(Et,br),e(x,vr),e(x,Je),_(Mt,Je,null),e(Je,yr),e(Je,xt),e(xt,wr),e(xt,$n),e($n,Er),e(xt,Mr),e(x,xr),e(x,Xe),_($t,Xe,null),e(Xe,$r),e(Xe,J),e(J,Ir),e(J,In),e(In,Dr),e(J,Lr),e(J,Dn),e(Dn,Sr),e(J,Tr),e(J,Ln),e(Ln,kr),e(J,Pr),e(J,Sn),e(Sn,Ur),e(J,Cr),e(x,Jr),e(x,je),_(It,je,null),e(je,Xr),e(je,ue),e(ue,jr),e(ue,Tn),e(Tn,Zr),e(ue,Gr),e(ue,kn),e(kn,Nr),e(ue,Wr),e(x,Ar),e(x,R),_(Dt,R,null),e(R,Vr),e(R,Pn),e(Pn,Rr),e(R,Fr),e(R,Un),e(Un,Br),e(x,zr),e(x,F),_(Lt,F,null),e(F,Or),e(F,Cn),e(Cn,qr),e(F,Yr),e(F,Jn),e(Jn,Hr),e(x,Qr),e(x,B),_(St,B,null),e(B,Kr),e(B,Xn),e(Xn,ed),e(B,td),e(B,m),e(m,od),e(m,jn),e(jn,nd),e(m,id),e(m,Zn),e(Zn,ad),e(m,sd),e(m,Gn),e(Gn,ld),e(m,rd),e(m,Nn),e(Nn,dd),e(m,pd),e(m,Wn),e(Wn,cd),e(m,fd),e(m,An),e(An,md),e(m,ud),e(m,Vn),e(Vn,hd),e(m,gd),e(m,Rn),e(Rn,_d),e(m,bd),e(m,Fn),e(Fn,vd),e(m,yd),e(m,Bn),e(Bn,wd),e(m,Ed),e(m,zn),e(zn,Md),e(m,xd),e(m,On),e(On,$d),e(m,Id),e(m,qn),e(qn,Dd),e(m,Ld),e(m,Yn),e(Yn,Sd),e(m,Td),e(m,Hn),e(Hn,kd),e(m,Pd),e(m,Qn),e(Qn,Ud),e(m,Cd),e(m,Kn),e(Kn,Jd),e(m,Xd),e(m,ei),e(ei,jd),e(m,Zd),e(m,ti),e(ti,Gd),e(m,Nd),f(t,Ia,c),f(t,he,c),e(he,Ze),e(Ze,oi),_(Tt,oi,null),e(he,Wd),e(he,ni),e(ni,Ad),f(t,Da,c),f(t,$,c),_(kt,$,null),e($,Vd),e($,ii),e(ii,Rd),e($,Fd),e($,Pt),e(Pt,Bd),e(Pt,ro),e(ro,zd),e(Pt,Od),e($,qd),e($,ai),e(ai,Yd),e($,Hd),e($,ge),e(ge,Ut),e(Ut,si),e(si,Qd),e(Ut,Kd),e(Ut,po),e(po,ep),e(ge,tp),e(ge,Ct),e(Ct,li),e(li,op),e(Ct,np),e(Ct,co),e(co,ip),e(ge,ap),e(ge,Jt),e(Jt,ri),e(ri,sp),e(Jt,lp),e(Jt,fo),e(fo,rp),e($,dp),e($,di),e(di,pp),e($,cp),e($,pi),e(pi,Xt),e(Xt,ci),e(ci,fp),e(Xt,mp),e(Xt,mo),e(mo,up),e($,hp),e($,z),_(jt,z,null),e(z,gp),e(z,fi),e(fi,_p),e(z,bp),_(Ge,z,null),e($,vp),e($,Ne),_(Zt,Ne,null),e(Ne,yp),e(Ne,Gt),e(Gt,wp),e(Gt,mi),e(mi,Ep),e(Gt,Mp),e($,xp),e($,We),_(Nt,We,null),e(We,$p),e(We,Wt),e(Wt,Ip),e(Wt,ui),e(ui,Dp),e(Wt,Lp),e($,Sp),e($,Ae),_(At,Ae,null),e(Ae,Tp),e(Ae,X),e(X,kp),e(X,hi),e(hi,Pp),e(X,Up),e(X,gi),e(gi,Cp),e(X,Jp),e(X,_i),e(_i,Xp),e(X,jp),e(X,bi),e(bi,Zp),e(X,Gp),e($,Np),e($,Ve),_(Vt,Ve,null),e(Ve,Wp),e(Ve,_e),e(_e,Ap),e(_e,vi),e(vi,Vp),e(_e,Rp),e(_e,yi),e(yi,Fp),e(_e,Bp),e($,zp),e($,O),_(Rt,O,null),e(O,Op),e(O,wi),e(wi,qp),e(O,Yp),e(O,Ei),e(Ei,Hp),e($,Qp),e($,q),_(Ft,q,null),e(q,Kp),e(q,Mi),e(Mi,ec),e(q,tc),e(q,xi),e(xi,oc),e($,nc),e($,Y),_(Bt,Y,null),e(Y,ic),e(Y,$i),e($i,ac),e(Y,sc),e(Y,u),e(u,lc),e(u,Ii),e(Ii,rc),e(u,dc),e(u,Di),e(Di,pc),e(u,cc),e(u,Li),e(Li,fc),e(u,mc),e(u,Si),e(Si,uc),e(u,hc),e(u,Ti),e(Ti,gc),e(u,_c),e(u,ki),e(ki,bc),e(u,vc),e(u,Pi),e(Pi,yc),e(u,wc),e(u,Ui),e(Ui,Ec),e(u,Mc),e(u,Ci),e(Ci,xc),e(u,$c),e(u,Ji),e(Ji,Ic),e(u,Dc),e(u,Xi),e(Xi,Lc),e(u,Sc),e(u,ji),e(ji,Tc),e(u,kc),e(u,Zi),e(Zi,Pc),e(u,Uc),e(u,Gi),e(Gi,Cc),e(u,Jc),e(u,Ni),e(Ni,Xc),e(u,jc),e(u,Wi),e(Wi,Zc),e(u,Gc),e(u,Ai),e(Ai,Nc),e(u,Wc),e(u,Vi),e(Vi,Ac),e(u,Vc),e(u,Ri),e(Ri,Rc),e(u,Fc),La=!0},p(t,[c]){const zt={};c&2&&(zt.$$scope={dirty:c,ctx:t}),Ue.$set(zt);const Fi={};c&2&&(Fi.$$scope={dirty:c,ctx:t}),Ge.$set(Fi)},i(t){La||(b(M.$$.fragment,t),b(Fe.$$.fragment,t),b(Be.$$.fragment,t),b(qe.$$.fragment,t),b(Ye.$$.fragment,t),b(He.$$.fragment,t),b(Qe.$$.fragment,t),b(Ke.$$.fragment,t),b(tt.$$.fragment,t),b(ot.$$.fragment,t),b(nt.$$.fragment,t),b(it.$$.fragment,t),b(at.$$.fragment,t),b(st.$$.fragment,t),b(lt.$$.fragment,t),b(rt.$$.fragment,t),b(dt.$$.fragment,t),b(ct.$$.fragment,t),b(ft.$$.fragment,t),b(mt.$$.fragment,t),b(ut.$$.fragment,t),b(yt.$$.fragment,t),b(Ue.$$.fragment,t),b(wt.$$.fragment,t),b(Mt.$$.fragment,t),b($t.$$.fragment,t),b(It.$$.fragment,t),b(Dt.$$.fragment,t),b(Lt.$$.fragment,t),b(St.$$.fragment,t),b(Tt.$$.fragment,t),b(kt.$$.fragment,t),b(jt.$$.fragment,t),b(Ge.$$.fragment,t),b(Zt.$$.fragment,t),b(Nt.$$.fragment,t),b(At.$$.fragment,t),b(Vt.$$.fragment,t),b(Rt.$$.fragment,t),b(Ft.$$.fragment,t),b(Bt.$$.fragment,t),La=!0)},o(t){v(M.$$.fragment,t),v(Fe.$$.fragment,t),v(Be.$$.fragment,t),v(qe.$$.fragment,t),v(Ye.$$.fragment,t),v(He.$$.fragment,t),v(Qe.$$.fragment,t),v(Ke.$$.fragment,t),v(tt.$$.fragment,t),v(ot.$$.fragment,t),v(nt.$$.fragment,t),v(it.$$.fragment,t),v(at.$$.fragment,t),v(st.$$.fragment,t),v(lt.$$.fragment,t),v(rt.$$.fragment,t),v(dt.$$.fragment,t),v(ct.$$.fragment,t),v(ft.$$.fragment,t),v(mt.$$.fragment,t),v(ut.$$.fragment,t),v(yt.$$.fragment,t),v(Ue.$$.fragment,t),v(wt.$$.fragment,t),v(Mt.$$.fragment,t),v($t.$$.fragment,t),v(It.$$.fragment,t),v(Dt.$$.fragment,t),v(Lt.$$.fragment,t),v(St.$$.fragment,t),v(Tt.$$.fragment,t),v(kt.$$.fragment,t),v(jt.$$.fragment,t),v(Ge.$$.fragment,t),v(Zt.$$.fragment,t),v(Nt.$$.fragment,t),v(At.$$.fragment,t),v(Vt.$$.fragment,t),v(Rt.$$.fragment,t),v(Ft.$$.fragment,t),v(Bt.$$.fragment,t),La=!1},d(t){o(S),t&&o(j),t&&o(T),y(M),t&&o(zi),t&&o(be),t&&o(Oi),t&&o(qt),t&&o(qi),t&&o(Yt),t&&o(Yi),t&&o(ee),y(Fe),t&&o(Hi),t&&o(ye),t&&o(Qi),t&&o(te),y(Be),t&&o(Ki),t&&o(Ee),t&&o(ea),t&&o(ie),y(qe),t&&o(ta),t&&o(C),t&&o(oa),y(Ye,t),t&&o(na),t&&o(ae),y(He),t&&o(ia),t&&o($e),t&&o(aa),y(Qe,t),t&&o(sa),t&&o(se),y(Ke),t&&o(la),t&&o(N),t&&o(ra),y(tt,t),t&&o(da),t&&o(le),y(ot),t&&o(pa),t&&o(W),t&&o(ca),y(nt,t),t&&o(fa),t&&o(re),y(it),t&&o(ma),t&&o(Se),t&&o(ua),y(at,t),t&&o(ha),t&&o(to),t&&o(ga),y(st,t),t&&o(_a),t&&o(de),y(lt),t&&o(ba),t&&o(A),t&&o(va),y(rt,t),t&&o(ya),t&&o(pe),y(dt),t&&o(wa),t&&o(ce),t&&o(Ea),y(ct,t),t&&o(Ma),y(ft,t),t&&o(xa),t&&o(fe),y(mt),t&&o($a),t&&o(x),y(ut),y(yt),y(Ue),y(wt),y(Mt),y($t),y(It),y(Dt),y(Lt),y(St),t&&o(Ia),t&&o(he),y(Tt),t&&o(Da),t&&o($),y(kt),y(jt),y(Ge),y(Zt),y(Nt),y(At),y(Vt),y(Rt),y(Ft),y(Bt)}}}const Yu={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:"loading-single-file-checkpoitns-original-file-format",title:"Loading single file checkpoitns / 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 Hu(Ot){return Bu(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class nh extends Au{constructor(S){super();Vu(this,S,Hu,qu,Ru,{})}}export{nh as default,Yu as metadata};
