Buckets:
| import{S as km,i as $m,s as Xm,e as l,k as m,w as u,t as n,M as Sm,c as a,d as t,m as c,a as i,x as h,h as r,b as f,N as H,G as s,g as p,y,q as b,o as g,B as M,v as Bm,L as Rm}from"../../chunks/vendor-hf-doc-builder.js";import{T as ap}from"../../chunks/Tip-hf-doc-builder.js";import{I as R}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as _}from"../../chunks/CodeBlock-hf-doc-builder.js";import{D as xm}from"../../chunks/DocNotebookDropdown-hf-doc-builder.js";function Vm(ge){let d,$,w,Z,G,v,j,I;return j=new _({props:{code:"cGlwZWxpbmUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25YTFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCguLi4lMkMlMjBhZGRfd2F0ZXJtYXJrZXIlM0RGYWxzZSk=",highlighted:'pipeline = StableDiffusionXLPipeline.from_pretrained(..., add_watermarker=<span class="hljs-literal">False</span>)'}}),{c(){d=l("p"),$=n("We recommend installing the "),w=l("a"),Z=n("invisible-watermark"),G=n(" library to help identify images that are generated. If the invisible-watermark library is installed, it is used by default. To disable the watermarker:"),v=m(),u(j.$$.fragment),this.h()},l(J){d=a(J,"P",{});var T=i(d);$=r(T,"We recommend installing the "),w=a(T,"A",{href:!0,rel:!0});var W=i(w);Z=r(W,"invisible-watermark"),W.forEach(t),G=r(T," library to help identify images that are generated. If the invisible-watermark library is installed, it is used by default. To disable the watermarker:"),T.forEach(t),v=c(J),h(j.$$.fragment,J),this.h()},h(){f(w,"href","https://pypi.org/project/invisible-watermark/"),f(w,"rel","nofollow")},m(J,T){p(J,d,T),s(d,$),s(d,w),s(w,Z),s(d,G),p(J,v,T),y(j,J,T),I=!0},p:Rm,i(J){I||(b(j.$$.fragment,J),I=!0)},o(J){g(j.$$.fragment,J),I=!1},d(J){J&&t(d),J&&t(v),M(j,J)}}}function Cm(ge){let d,$,w,Z,G,v,j,I,J,T,W;return{c(){d=l("p"),$=n("The "),w=l("code"),Z=n("denoising_end"),G=n(" and "),v=l("code"),j=n("denoising_start"),I=n(" parameters should be a float between 0 and 1. These parameters are represented as a proportion of discrete timesteps as defined by the scheduler. If you\u2019re also using the "),J=l("code"),T=n("strength"),W=n(" parameter, it\u2019ll be ignored because the number of denoising steps is determined by the discrete timesteps the model is trained on and the declared fractional cutoff.")},l(k){d=a(k,"P",{});var U=i(d);$=r(U,"The "),w=a(U,"CODE",{});var B=i(w);Z=r(B,"denoising_end"),B.forEach(t),G=r(U," and "),v=a(U,"CODE",{});var V=i(v);j=r(V,"denoising_start"),V.forEach(t),I=r(U," parameters should be a float between 0 and 1. These parameters are represented as a proportion of discrete timesteps as defined by the scheduler. If you\u2019re also using the "),J=a(U,"CODE",{});var E=i(J);T=r(E,"strength"),E.forEach(t),W=r(U," parameter, it\u2019ll be ignored because the number of denoising steps is determined by the discrete timesteps the model is trained on and the declared fractional cutoff."),U.forEach(t)},m(k,U){p(k,d,U),s(d,$),s(d,w),s(w,Z),s(d,G),s(d,v),s(v,j),s(d,I),s(d,J),s(J,T),s(d,W)},d(k){k&&t(d)}}}function Nm(ge){let d,$,w,Z,G,v,j,I,J,T,W,k,U,B;return{c(){d=l("p"),$=n("You can use both micro-conditioning and negative micro-conditioning parameters thanks to classifier-free guidance. They are available in the "),w=l("a"),Z=n("StableDiffusionXLPipeline"),G=n(", "),v=l("a"),j=n("StableDiffusionXLImg2ImgPipeline"),I=n(", "),J=l("a"),T=n("StableDiffusionXLInpaintPipeline"),W=n(", and "),k=l("a"),U=n("StableDiffusionXLControlNetPipeline"),B=n("."),this.h()},l(V){d=a(V,"P",{});var E=i(d);$=r(E,"You can use both micro-conditioning and negative micro-conditioning parameters thanks to classifier-free guidance. They are available in the "),w=a(E,"A",{href:!0});var Fe=i(w);Z=r(Fe,"StableDiffusionXLPipeline"),Fe.forEach(t),G=r(E,", "),v=a(E,"A",{href:!0});var x=i(v);j=r(x,"StableDiffusionXLImg2ImgPipeline"),x.forEach(t),I=r(E,", "),J=a(E,"A",{href:!0});var Me=i(J);T=r(Me,"StableDiffusionXLInpaintPipeline"),Me.forEach(t),W=r(E,", and "),k=a(E,"A",{href:!0});var Ht=i(k);U=r(Ht,"StableDiffusionXLControlNetPipeline"),Ht.forEach(t),B=r(E,"."),E.forEach(t),this.h()},h(){f(w,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLPipeline"),f(v,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLImg2ImgPipeline"),f(J,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLInpaintPipeline"),f(k,"href","/docs/diffusers/main/en/api/pipelines/controlnet_sdxl#diffusers.StableDiffusionXLControlNetPipeline")},m(V,E){p(V,d,E),s(d,$),s(d,w),s(w,Z),s(d,G),s(d,v),s(v,j),s(d,I),s(d,J),s(J,T),s(d,W),s(d,k),s(k,U),s(d,B)},d(V){V&&t(d)}}}function Ym(ge){let d,$,w,Z,G,v,j,I,J,T,W,k,U,B,V,E,Fe,x,Me,Ht,Hi,Rs,Pi,Oi,P,Ki,xs,eo,to,Vs,so,lo,Ol,Pt,ao,Kl,Ot,io,ea,Ae,ta,Je,sa,O,we,Cs,Le,oo,Ns,no,la,ve,ro,Kt,po,fo,aa,qe,ia,C,mo,es,co,uo,Ys,ho,yo,Qs,bo,go,oa,He,na,K,Ue,Ds,Pe,Mo,zs,Jo,ra,F,wo,Fs,vo,Uo,As,To,Zo,pa,Oe,fa,Ke,ts,ip,ma,ee,Te,Ls,et,_o,qs,jo,ca,ss,Eo,da,tt,ua,st,ls,op,ha,te,Ze,Hs,lt,Io,Ps,Wo,ya,as,Go,ba,at,ga,it,is,np,Ma,se,_e,Os,ot,ko,Ks,$o,Ja,je,Xo,nt,So,Bo,wa,Ee,el,Ro,xo,tl,Vo,va,le,Ie,sl,rt,Co,ll,No,Ua,We,Yo,pt,al,Qo,Do,Ta,os,z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ji;return v=new R({}),W=new xm({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/sdxl.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/sdxl.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/sdxl.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/sdxl.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/sdxl.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/sdxl.ipynb"}]}}),Ae=new _({props:{code:"JTIzJTIwdW5jb21tZW50JTIwdG8lMjBpbnN0YWxsJTIwdGhlJTIwbmVjZXNzYXJ5JTIwbGlicmFyaWVzJTIwaW4lMjBDb2xhYiUwQSUyMyFwaXAlMjBpbnN0YWxsJTIwZGlmZnVzZXJzJTIwdHJhbnNmb3JtZXJzJTIwYWNjZWxlcmF0ZSUyMHNhZmV0ZW5zb3JzJTIwb21lZ2Fjb25mJTIwaW52aXNpYmxlLXdhdGVybWFyayUzRSUzRDAuMi4w",highlighted:`<span class="hljs-comment"># uncomment to install the necessary libraries in Colab</span> | |
| <span class="hljs-comment">#!pip install diffusers transformers accelerate safetensors omegaconf invisible-watermark>=0.2.0</span>`}}),Je=new ap({props:{warning:!0,$$slots:{default:[Vm]},$$scope:{ctx:ge}}}),Le=new R({}),qe=new _({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUlMkMlMjBTdGFibGVEaWZmdXNpb25YTEltZzJJbWdQaXBlbGluZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25YTFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0xLjAlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUlMEEpLnRvKCUyMmN1ZGElMjIpJTBBJTBBcmVmaW5lciUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblhMSW1nMkltZ1BpcGVsaW5lLmZyb21fc2luZ2xlX2ZpbGUoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLXJlZmluZXItMS4wJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUyQyUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyJTBBKS50byglMjJjdWRhJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLPipeline, StableDiffusionXLImg2ImgPipeline | |
| <span class="hljs-keyword">import</span> torch | |
| pipeline = StableDiffusionXLPipeline.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-xl-base-1.0"</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">"fp16"</span>, use_safetensors=<span class="hljs-literal">True</span> | |
| ).to(<span class="hljs-string">"cuda"</span>) | |
| refiner = StableDiffusionXLImg2ImgPipeline.from_single_file( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-xl-refiner-1.0"</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>, variant=<span class="hljs-string">"fp16"</span> | |
| ).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> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLPipeline, StableDiffusionXLImg2ImgPipeline | |
| <span class="hljs-keyword">import</span> torch | |
| pipeline = StableDiffusionXLPipeline.from_single_file( | |
| <span class="hljs-string">"https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0.safetensors"</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">"fp16"</span>, use_safetensors=<span class="hljs-literal">True</span> | |
| ).to(<span class="hljs-string">"cuda"</span>) | |
| refiner = StableDiffusionXLImg2ImgPipeline.from_single_file( | |
| <span class="hljs-string">"https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/blob/main/sd_xl_refiner_1.0.safetensors"</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>, variant=<span class="hljs-string">"fp16"</span> | |
| ).to(<span class="hljs-string">"cuda"</span>)`}}),Pe=new R({}),Oe=new _({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lX3RleHQyaW1hZ2UlMjAlM0QlMjBBdXRvUGlwZWxpbmVGb3JUZXh0MkltYWdlLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0xLjAlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUlMEEpLnRvKCUyMmN1ZGElMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyQXN0cm9uYXV0JTIwaW4lMjBhJTIwanVuZ2xlJTJDJTIwY29sZCUyMGNvbG9yJTIwcGFsZXR0ZSUyQyUyMG11dGVkJTIwY29sb3JzJTJDJTIwZGV0YWlsZWQlMkMlMjA4ayUyMiUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTNEcHJvbXB0KS5pbWFnZXMlNUIwJTVE",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image | |
| <span class="hljs-keyword">import</span> torch | |
| pipeline_text2image = AutoPipelineForText2Image.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-xl-base-1.0"</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">"fp16"</span>, use_safetensors=<span class="hljs-literal">True</span> | |
| ).to(<span class="hljs-string">"cuda"</span>) | |
| prompt = <span class="hljs-string">"Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"</span> | |
| image = pipeline(prompt=prompt).images[<span class="hljs-number">0</span>]`}}),et=new R({}),tt=new _({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvckltZzJJbWclMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUwQSUwQSUyMyUyMHVzZSUyMGZyb21fcGlwZSUyMHRvJTIwYXZvaWQlMjBjb25zdW1pbmclMjBhZGRpdGlvbmFsJTIwbWVtb3J5JTIwd2hlbiUyMGxvYWRpbmclMjBhJTIwY2hlY2twb2ludCUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9ySW1hZ2UySW1hZ2UuZnJvbV9waXBlKHBpcGVsaW5lX3RleHQyaW1hZ2UpLnRvKCUyMmN1ZGElMjIpJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaHVnZ2luZ2ZhY2UlMkZkb2N1bWVudGF0aW9uLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGZGlmZnVzZXJzJTJGc2R4bC1pbWcyaW1nLnBuZyUyMiUwQSUwQWluaXRfaW1hZ2UlMjAlM0QlMjBsb2FkX2ltYWdlKHVybCkuY29udmVydCglMjJSR0IlMjIpJTBBcHJvbXB0JTIwJTNEJTIwJTIyYSUyMGRvZyUyMGNhdGNoaW5nJTIwYSUyMGZyaXNiZWUlMjBpbiUyMHRoZSUyMGp1bmdsZSUyMiUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTJDJTIwaW1hZ2UlM0Rpbml0X2ltYWdlJTJDJTIwc3RyZW5ndGglM0QwLjglMkMlMjBndWlkYW5jZV9zY2FsZSUzRDEwLjUpLmltYWdlcyU1QjAlNUQ=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForImg2Img | |
| <span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image | |
| <span class="hljs-comment"># use from_pipe to avoid consuming additional memory when loading a checkpoint</span> | |
| pipeline = AutoPipelineForImage2Image.from_pipe(pipeline_text2image).to(<span class="hljs-string">"cuda"</span>) | |
| url = <span class="hljs-string">"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-img2img.png"</span> | |
| init_image = load_image(url).convert(<span class="hljs-string">"RGB"</span>) | |
| prompt = <span class="hljs-string">"a dog catching a frisbee in the jungle"</span> | |
| image = pipeline(prompt, image=init_image, strength=<span class="hljs-number">0.8</span>, guidance_scale=<span class="hljs-number">10.5</span>).images[<span class="hljs-number">0</span>]`}}),lt=new R({}),at=new _({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvcklucGFpbnRpbmclMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUwQSUwQSUyMyUyMHVzZSUyMGZyb21fcGlwZSUyMHRvJTIwYXZvaWQlMjBjb25zdW1pbmclMjBhZGRpdGlvbmFsJTIwbWVtb3J5JTIwd2hlbiUyMGxvYW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-keyword">import</span> AutoPipelineForInpainting | |
| <span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image | |
| <span class="hljs-comment"># use from_pipe to avoid consuming additional memory when loading a checkpoint</span> | |
| pipeline = AutoPipelineForInpainting.from_pipe(pipeline_text2image).to(<span class="hljs-string">"cuda"</span>) | |
| img_url = <span class="hljs-string">"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-text2img.png"</span> | |
| mask_url = <span class="hljs-string">"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-inpaint-mask.png"</span> | |
| init_image = load_image(img_url).convert(<span class="hljs-string">"RGB"</span>) | |
| mask_image = load_image(mask_url).convert(<span class="hljs-string">"RGB"</span>) | |
| prompt = <span class="hljs-string">"A deep sea diver floating"</span> | |
| image = pipeline(prompt=prompt, image=init_image, mask_image=mask_image, strength=<span class="hljs-number">0.85</span>, guidance_scale=<span class="hljs-number">12.5</span>).images[<span class="hljs-number">0</span>]`}}),ot=new R({}),rt=new R({}),ft=new _({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFiYXNlJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi14bC1iYXNlLTEuMCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyJTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUwQSkudG8oJTIyY3VkYSUyMiklMEElMEFyZWZpbmVyJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi14bC1yZWZpbmVyLTEuMCUyMiUyQyUwQSUyMCUyMCUyMCUyMHRleHRfZW5jb2Rlcl8yJTNEYmFzZS50ZXh0X2VuY29kZXJfMiUyQyUwQSUyMCUyMCUyMCUyMHZhZSUzRGJhc2UudmFlJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBJTIwJTIwJTIwJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyJTJDJTBBKS50byglMjJjdWRhJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline | |
| <span class="hljs-keyword">import</span> torch | |
| base = DiffusionPipeline.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-xl-base-1.0"</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">"fp16"</span>, use_safetensors=<span class="hljs-literal">True</span> | |
| ).to(<span class="hljs-string">"cuda"</span>) | |
| refiner = DiffusionPipeline.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-xl-refiner-1.0"</span>, | |
| text_encoder_2=base.text_encoder_2, | |
| vae=base.vae, | |
| torch_dtype=torch.float16, | |
| use_safetensors=<span class="hljs-literal">True</span>, | |
| variant=<span class="hljs-string">"fp16"</span>, | |
| ).to(<span class="hljs-string">"cuda"</span>)`}}),Ge=new ap({props:{$$slots:{default:[Cm]},$$scope:{ctx:ge}}}),dt=new _({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMG1hamVzdGljJTIwbGlvbiUyMGp1bXBpbmclMjBmcm9tJTIwYSUyMGJpZyUyMHN0b25lJTIwYXQlMjBuaWdodCUyMiUwQSUwQWltYWdlJTIwJTNEJTIwYmFzZSglMEElMjAlMjAlMjAlMjBwcm9tcHQlM0Rwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENDAlMkMlMEElMjAlMjAlMjAlMjBkZW5vaXNpbmdfZW5kJTNEMC44JTJDJTBBJTIwJTIwJTIwJTIwb3V0cHV0X3R5cGUlM0QlMjJsYXRlbnQlMjIlMkMlMEEpLmltYWdlcyUwQWltYWdlJTIwJTNEJTIwcmVmaW5lciglMEElMjAlMjAlMjAlMjBwcm9tcHQlM0Rwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENDAlMkMlMEElMjAlMjAlMjAlMjBkZW5vaXNpbmdfc3RhcnQlM0QwLjglMkMlMEElMjAlMjAlMjAlMjBpbWFnZSUzRGltYWdlJTJDJTBBKS5pbWFnZXMlNUIwJTVE",highlighted:`prompt = <span class="hljs-string">"A majestic lion jumping from a big stone at night"</span> | |
| image = base( | |
| prompt=prompt, | |
| num_inference_steps=<span class="hljs-number">40</span>, | |
| denoising_end=<span class="hljs-number">0.8</span>, | |
| output_type=<span class="hljs-string">"latent"</span>, | |
| ).images | |
| image = refiner( | |
| prompt=prompt, | |
| num_inference_steps=<span class="hljs-number">40</span>, | |
| denoising_start=<span class="hljs-number">0.8</span>, | |
| image=image, | |
| ).images[<span class="hljs-number">0</span>]`}}),gt=new _({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblhMSW5wYWludFBpcGVsaW5lJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEElMEFiYXNlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uWExJbnBhaW50UGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi14bC1iYXNlLTEuMCUyMiUyQyUyMHRvcmN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dGFydCUzRGhpZ2hfbm9pc2VfZnJhYyUyQyUwQSkuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLInpaintPipeline | |
| <span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image | |
| base = StableDiffusionXLInpaintPipeline.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-xl-base-1.0"</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">"fp16"</span>, use_safetensors=<span class="hljs-literal">True</span> | |
| ).to(<span class="hljs-string">"cuda"</span>) | |
| refiner = StableDiffusionXLInpaintPipeline.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-xl-refiner-1.0"</span>, | |
| text_encoder_2=pipe.text_encoder_2, | |
| vae=pipe.vae, | |
| torch_dtype=torch.float16, | |
| use_safetensors=<span class="hljs-literal">True</span>, | |
| variant=<span class="hljs-string">"fp16"</span>, | |
| ).to(<span class="hljs-string">"cuda"</span>) | |
| img_url = <span class="hljs-string">"https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png"</span> | |
| mask_url = <span class="hljs-string">"https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png"</span> | |
| init_image = load_image(img_url).convert(<span class="hljs-string">"RGB"</span>) | |
| mask_image = load_image(mask_url).convert(<span class="hljs-string">"RGB"</span>) | |
| prompt = <span class="hljs-string">"A majestic tiger sitting on a bench"</span> | |
| num_inference_steps = <span class="hljs-number">75</span> | |
| high_noise_frac = <span class="hljs-number">0.7</span> | |
| image = base( | |
| prompt=prompt, | |
| image=init_image, | |
| mask_image=mask_image, | |
| num_inference_steps=num_inference_steps, | |
| denoising_end=high_noise_frac, | |
| output_type=<span class="hljs-string">"latent"</span>, | |
| ).images | |
| image = refiner( | |
| prompt=prompt, | |
| image=image, | |
| mask_image=mask_image, | |
| num_inference_steps=num_inference_steps, | |
| denoising_start=high_noise_frac, | |
| ).images[<span class="hljs-number">0</span>]`}}),Mt=new R({}),Jt=new _({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFiYXNlJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi14bC1iYXNlLTEuMCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyJTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUwQSkudG8oJTIyY3VkYSUyMiklMEElMEFyZWZpbmVyJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi14bC1yZWZpbmVyLTEuMCUyMiUyQyUwQSUyMCUyMCUyMCUyMHRleHRfZW5jb2Rlcl8yJTNEcGlwZS50ZXh0X2VuY29kZXJfMiUyQyUwQSUyMCUyMCUyMCUyMHZhZSUzRHBpcGUudmFlJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBJTIwJTIwJTIwJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyJTJDJTBBKS50byglMjJjdWRhJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline | |
| <span class="hljs-keyword">import</span> torch | |
| base = DiffusionPipeline.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-xl-base-1.0"</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">"fp16"</span>, use_safetensors=<span class="hljs-literal">True</span> | |
| ).to(<span class="hljs-string">"cuda"</span>) | |
| refiner = DiffusionPipeline.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-xl-refiner-1.0"</span>, | |
| text_encoder_2=pipe.text_encoder_2, | |
| vae=pipe.vae, | |
| torch_dtype=torch.float16, | |
| use_safetensors=<span class="hljs-literal">True</span>, | |
| variant=<span class="hljs-string">"fp16"</span>, | |
| ).to(<span class="hljs-string">"cuda"</span>)`}}),wt=new _({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQXN0cm9uYXV0JTIwaW4lMjBhJTIwanVuZ2xlJTJDJTIwY29sZCUyMGNvbG9yJTIwcGFsZXR0ZSUyQyUyMG11dGVkJTIwY29sb3JzJTJDJTIwZGV0YWlsZWQlMkMlMjA4ayUyMiUwQSUwQWltYWdlJTIwJTNEJTIwYmFzZShwcm9tcHQlM0Rwcm9tcHQlMkMlMjBvdXRwdXRfdHlwZSUzRCUyMmxhdGVudCUyMikuaW1hZ2VzJTVCMCU1RA==",highlighted:`prompt = <span class="hljs-string">"Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"</span> | |
| image = base(prompt=prompt, output_type=<span class="hljs-string">"latent"</span>).images[<span class="hljs-number">0</span>]`}}),vt=new _({props:{code:"aW1hZ2UlMjAlM0QlMjByZWZpbmVyKHByb21wdCUzRHByb21wdCUyQyUyMGltYWdlJTNEaW1hZ2UlNUJOb25lJTJDJTIwJTNBJTVEKS5pbWFnZXMlNUIwJTVE",highlighted:'image = refiner(prompt=prompt, image=image[<span class="hljs-literal">None</span>, :]).images[<span class="hljs-number">0</span>]'}}),jt=new R({}),Re=new ap({props:{$$slots:{default:[Nm]},$$scope:{ctx:ge}}}),Et=new R({}),Gt=new _({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25YTFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0xLjAlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUlMEEpLnRvKCUyMmN1ZGElMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyQXN0cm9uYXV0JTIwaW4lMjBhJTIwanVuZ2xlJTJDJTIwY29sZCUyMGNvbG9yJTIwcGFsZXR0ZSUyQyUyMG11dGVkJTIwY29sb3JzJTJDJTIwZGV0YWlsZWQlMkMlMjA4ayUyMiUwQWltYWdlJTIwJTNEJTIwcGlwZSglMEElMjAlMjAlMjAlMjBwcm9tcHQlM0Rwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBuZWdhdGl2ZV9vcmlnaW5hbF9zaXplJTNEKDUxMiUyQyUyMDUxMiklMkMlMEElMjAlMjAlMjAlMjBuZWdhdGl2ZV90YXJnZXRfc2l6ZSUzRCgxMDI0JTJDJTIwMTAyNCklMkMlMEEpLmltYWdlcyU1QjAlNUQ=",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">"stabilityai/stable-diffusion-xl-base-1.0"</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">"fp16"</span>, use_safetensors=<span class="hljs-literal">True</span> | |
| ).to(<span class="hljs-string">"cuda"</span>) | |
| prompt = <span class="hljs-string">"Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"</span> | |
| image = pipe( | |
| prompt=prompt, | |
| negative_original_size=(<span class="hljs-number">512</span>, <span class="hljs-number">512</span>), | |
| negative_target_size=(<span class="hljs-number">1024</span>, <span class="hljs-number">1024</span>), | |
| ).images[<span class="hljs-number">0</span>]`}}),kt=new R({}),$t=new _({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uWExQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlJTBBKS50byglMjJjdWRhJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkFzdHJvbmF1dCUyMGluJTIwYSUyMGp1bmdsZSUyQyUyMGNvbGQlMjBjb2xvciUyMHBhbGV0dGUlMkMlMjBtdXRlZCUyMGNvbG9ycyUyQyUyMGRldGFpbGVkJTJDJTIwOGslMjIlMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKHByb21wdCUzRHByb21wdCUyQyUyMGNyb3BzX2Nvb3Jkc190b3BfbGVmdCUzRCgyNTYlMkMwKSkuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLPipeline | |
| <span class="hljs-keyword">import</span> torch | |
| pipeline = StableDiffusionXLPipeline.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-xl-base-1.0"</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">"fp16"</span>, use_safetensors=<span class="hljs-literal">True</span> | |
| ).to(<span class="hljs-string">"cuda"</span>) | |
| prompt = <span class="hljs-string">"Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"</span> | |
| image = pipeline(prompt=prompt, crops_coords_top_left=(<span class="hljs-number">256</span>,<span class="hljs-number">0</span>)).images[<span class="hljs-number">0</span>]`}}),St=new _({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25YTFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJzdGFiaWxpdHlhaSUyRnN0YWJsZS1kaWZmdXNpb24teGwtYmFzZS0xLjAlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUlMEEpLnRvKCUyMmN1ZGElMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyQXN0cm9uYXV0JTIwaW4lMjBhJTIwanVuZ2xlJTJDJTIwY29sZCUyMGNvbG9yJTIwcGFsZXR0ZSUyQyUyMG11dGVkJTIwY29sb3JzJTJDJTIwZGV0YWlsZWQlMkMlMjA4ayUyMiUwQWltYWdlJTIwJTNEJTIwcGlwZSglMEElMjAlMjAlMjAlMjBwcm9tcHQlM0Rwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBuZWdhdGl2ZV9vcmlnaW5hbF9zaXplJTNEKDUxMiUyQyUyMDUxMiklMkMlMEElMjAlMjAlMjAlMjBuZWdhdGl2ZV9jcm9wc19jb29yZHNfdG9wX2xlZnQlM0QoMCUyQyUyMDApJTJDJTBBJTIwJTIwJTIwJTIwbmVnYXRpdmVfdGFyZ2V0X3NpemUlM0QoMTAyNCUyQyUyMDEwMjQpJTJDJTBBKS5pbWFnZXMlNUIwJTVE",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">"stabilityai/stable-diffusion-xl-base-1.0"</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">"fp16"</span>, use_safetensors=<span class="hljs-literal">True</span> | |
| ).to(<span class="hljs-string">"cuda"</span>) | |
| prompt = <span class="hljs-string">"Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"</span> | |
| image = pipe( | |
| prompt=prompt, | |
| negative_original_size=(<span class="hljs-number">512</span>, <span class="hljs-number">512</span>), | |
| negative_crops_coords_top_left=(<span class="hljs-number">0</span>, <span class="hljs-number">0</span>), | |
| negative_target_size=(<span class="hljs-number">1024</span>, <span class="hljs-number">1024</span>), | |
| ).images[<span class="hljs-number">0</span>]`}}),Bt=new R({}),xt=new _({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uWExQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlJTBBKS50byglMjJjdWRhJTIyKSUwQSUwQSUyMyUyMHByb21wdCUyMGlzJTIwcGFzc2VkJTIwdG8lMjBPQUklMjBDTElQLVZpVCUyRkwtMTQlMEFwcm9tcHQlMjAlM0QlMjAlMjJBc3Ryb25hdXQlMjBpbiUyMGElMjBqdW5nbGUlMkMlMjBjb2xkJTIwY29sb3IlMjBwYWxldHRlJTJDJTIwbXV0ZWQlMjBjb2xvcnMlMkMlMjBkZXRhaWxlZCUyQyUyMDhrJTIyJTBBJTIzJTIwcHJvbXB0XzIlMjBpcyUyMHBhc3NlZCUyMHRvJTIwT3BlbkNMSVAtVmlUJTJGYmlnRy0xNCUwQXByb21wdF8yJTIwJTNEJTIwJTIyVmFuJTIwR29naCUyMHBhaW50aW5nJTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlM0Rwcm9tcHQlMkMlMjBwcm9tcHRfMiUzRHByb21wdF8yKS5pbWFnZXMlNUIwJTVE",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLPipeline | |
| <span class="hljs-keyword">import</span> torch | |
| pipeline = StableDiffusionXLPipeline.from_pretrained( | |
| <span class="hljs-string">"stabilityai/stable-diffusion-xl-base-1.0"</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">"fp16"</span>, use_safetensors=<span class="hljs-literal">True</span> | |
| ).to(<span class="hljs-string">"cuda"</span>) | |
| <span class="hljs-comment"># prompt is passed to OAI CLIP-ViT/L-14</span> | |
| prompt = <span class="hljs-string">"Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"</span> | |
| <span class="hljs-comment"># prompt_2 is passed to OpenCLIP-ViT/bigG-14</span> | |
| prompt_2 = <span class="hljs-string">"Van Gogh painting"</span> | |
| image = pipeline(prompt=prompt, prompt_2=prompt_2).images[<span class="hljs-number">0</span>]`}}),Ct=new R({}),Yt=new _({props:{code:"LSUyMGJhc2UudG8oJTIyY3VkYSUyMiklMEEtJTIwcmVmaW5lci50byglMjJjdWRhJTIyKSUwQSUyQiUyMGJhc2UuZW5hYmxlX21vZGVsX2NwdV9vZmZsb2FkJTBBJTJCJTIwcmVmaW5lci5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQ=",highlighted:`<span class="hljs-deletion">- base.to("cuda")</span> | |
| <span class="hljs-deletion">- refiner.to("cuda")</span> | |
| <span class="hljs-addition">+ base.enable_model_cpu_offload</span> | |
| <span class="hljs-addition">+ refiner.enable_model_cpu_offload</span>`}}),Dt=new _({props:{code:"JTJCJTIwYmFzZS51bmV0JTIwJTNEJTIwdG9yY2guY29tcGlsZShiYXNlLnVuZXQlMkMlMjBtb2RlJTNEJTIycmVkdWNlLW92ZXJoZWFkJTIyJTJDJTIwZnVsbGdyYXBoJTNEVHJ1ZSklMEElMkIlMjByZWZpbmVyLnVuZXQlMjAlM0QlMjB0b3JjaC5jb21waWxlKHJlZmluZXIudW5ldCUyQyUyMG1vZGUlM0QlMjJyZWR1Y2Utb3ZlcmhlYWQlMjIlMkMlMjBmdWxsZ3JhcGglM0RUcnVlKQ==",highlighted:`<span class="hljs-addition">+ base.unet = torch.compile(base.unet, mode="reduce-overhead", fullgraph=True)</span> | |
| <span class="hljs-addition">+ refiner.unet = torch.compile(refiner.unet, mode="reduce-overhead", fullgraph=True)</span>`}}),Ft=new _({props:{code:"JTJCJTIwYmFzZS5lbmFibGVfeGZvcm1lcnNfbWVtb3J5X2VmZmljaWVudF9hdHRlbnRpb24oKSUwQSUyQiUyMHJlZmluZXIuZW5hYmxlX3hmb3JtZXJzX21lbW9yeV9lZmZpY2llbnRfYXR0ZW50aW9uKCk=",highlighted:`<span class="hljs-addition">+ base.enable_xformers_memory_efficient_attention()</span> | |
| <span class="hljs-addition">+ refiner.enable_xformers_memory_efficient_attention()</span>`}}),At=new R({}),{c(){d=l("meta"),$=m(),w=l("h1"),Z=l("a"),G=l("span"),u(v.$$.fragment),j=m(),I=l("span"),J=n("Stable Diffusion XL"),T=m(),u(W.$$.fragment),k=m(),U=l("p"),B=l("a"),V=n("Stable Diffusion XL"),E=n(" (SDXL) is a powerful text-to-image generation model that iterates on the previous Stable Diffusion models in three key ways:"),Fe=m(),x=l("ol"),Me=l("li"),Ht=n("the UNet is 3x larger and SDXL combines a second text encoder (OpenCLIP ViT-bigG/14) with the original text encoder to significantly increase the number of parameters"),Hi=m(),Rs=l("li"),Pi=n("introduces size and crop-conditioning to preserve training data from being discarded and gain more control over how a generated image should be cropped"),Oi=m(),P=l("li"),Ki=n("introduces a two-stage model process; the "),xs=l("em"),eo=n("base"),to=n(" model (can also be run as a standalone model) generates an image as an input to the "),Vs=l("em"),so=n("refiner"),lo=n(" model which adds additional high-quality details"),Ol=m(),Pt=l("p"),ao=n("This guide will show you how to use SDXL for text-to-image, image-to-image, and inpainting."),Kl=m(),Ot=l("p"),io=n("Before you begin, make sure you have the following libraries installed:"),ea=m(),u(Ae.$$.fragment),ta=m(),u(Je.$$.fragment),sa=m(),O=l("h2"),we=l("a"),Cs=l("span"),u(Le.$$.fragment),oo=m(),Ns=l("span"),no=n("Load model checkpoints"),la=m(),ve=l("p"),ro=n("Model weights may be stored in separate subfolders on the Hub or locally, in which case, you should use the "),Kt=l("a"),po=n("from_pretrained()"),fo=n(" method:"),aa=m(),u(qe.$$.fragment),ia=m(),C=l("p"),mo=n("You can also use the "),es=l("a"),co=n("from_single_file()"),uo=n(" method to load a model checkpoint stored in a single file format ("),Ys=l("code"),ho=n(".ckpt"),yo=n(" or "),Qs=l("code"),bo=n(".safetensors"),go=n(") from the Hub or locally:"),oa=m(),u(He.$$.fragment),na=m(),K=l("h2"),Ue=l("a"),Ds=l("span"),u(Pe.$$.fragment),Mo=m(),zs=l("span"),Jo=n("Text-to-image"),ra=m(),F=l("p"),wo=n("For text-to-image, pass a text prompt. By default, SDXL generates a 1024x1024 image for the best results. You can try setting the "),Fs=l("code"),vo=n("height"),Uo=n(" and "),As=l("code"),To=n("width"),Zo=n(" parameters to 768x768 or 512x512, but anything below 512x512 is not likely to work."),pa=m(),u(Oe.$$.fragment),fa=m(),Ke=l("div"),ts=l("img"),ma=m(),ee=l("h2"),Te=l("a"),Ls=l("span"),u(et.$$.fragment),_o=m(),qs=l("span"),jo=n("Image-to-image"),ca=m(),ss=l("p"),Eo=n("For image-to-image, SDXL works especially well with image sizes between 768x768 and 1024x1024. Pass an initial image, and a text prompt to condition the image with:"),da=m(),u(tt.$$.fragment),ua=m(),st=l("div"),ls=l("img"),ha=m(),te=l("h2"),Ze=l("a"),Hs=l("span"),u(lt.$$.fragment),Io=m(),Ps=l("span"),Wo=n("Inpainting"),ya=m(),as=l("p"),Go=n("For inpainting, you\u2019ll need the original image and a mask of what you want to replace in the original image. Create a prompt to describe what you want to replace the masked area with."),ba=m(),u(at.$$.fragment),ga=m(),it=l("div"),is=l("img"),Ma=m(),se=l("h2"),_e=l("a"),Os=l("span"),u(ot.$$.fragment),ko=m(),Ks=l("span"),$o=n("Refine image quality"),Ja=m(),je=l("p"),Xo=n("SDXL includes a "),nt=l("a"),So=n("refiner model"),Bo=n(" specialized in denoising low-noise stage images to generate higher-quality images from the base model. There are two ways to use the refiner:"),wa=m(),Ee=l("ol"),el=l("li"),Ro=n("use the base and refiner model together to produce a refined image"),xo=m(),tl=l("li"),Vo=n("use the base model to produce an image, and subsequently use the refiner model to add more details to the image (this is how SDXL is originally trained)"),va=m(),le=l("h3"),Ie=l("a"),sl=l("span"),u(rt.$$.fragment),Co=m(),ll=l("span"),No=n("Base + refiner model"),Ua=m(),We=l("p"),Yo=n("When you use the base and refiner model together to generate an image, this is known as an ("),pt=l("a"),al=l("em"),Qo=n("ensemble of expert denoisers"),Do=n("). The ensemble of expert denoisers approach requires less overall denoising steps versus passing the base model\u2019s output to the refiner model, so it should be significantly faster to run. However, you won\u2019t be able to inspect the base model\u2019s output because it still contains a large amount of noise."),Ta=m(),os=l("p"),zo=n("As an ensemble of expert denoisers, the base model serves as the expert during the high-noise diffusion stage and the refiner model serves as the expert during the low-noise diffusion stage. Load the base and refiner model:"),Za=m(),u(ft.$$.fragment),_a=m(),A=l("p"),Fo=n("To use this approach, you need to define the number of timesteps for each model to run through their respective stages. For the base model, this is controlled by the "),mt=l("a"),il=l("code"),Ao=n("denoising_end"),Lo=n(" parameter and for the refiner model, it is controlled by the "),ct=l("a"),ol=l("code"),qo=n("denoising_start"),Ho=n(" parameter."),ja=m(),u(Ge.$$.fragment),Ea=m(),X=l("p"),Po=n("Let\u2019s set "),nl=l("code"),Oo=n("denoising_end=0.8"),Ko=n(" so the base model performs the first 80% of denoising the "),rl=l("strong"),en=n("high-noise"),tn=n(" timesteps and set "),pl=l("code"),sn=n("denoising_start=0.8"),ln=n(" so the refiner model performs the last 20% of denoising the "),fl=l("strong"),an=n("low-noise"),on=n(" timesteps. The base model output should be in "),ml=l("strong"),nn=n("latent"),rn=n(" space instead of a PIL image."),Ia=m(),u(dt.$$.fragment),Wa=m(),ae=l("div"),ut=l("div"),ht=l("img"),pn=m(),ns=l("figcaption"),fn=n("base model"),mn=m(),yt=l("div"),bt=l("img"),cn=m(),rs=l("figcaption"),dn=n("ensemble of expert denoisers"),Ga=m(),ke=l("p"),un=n("The refiner model can also be used for inpainting in the "),ps=l("a"),hn=n("StableDiffusionXLInpaintPipeline"),yn=n(":"),ka=m(),u(gt.$$.fragment),$a=m(),fs=l("p"),bn=n("This ensemble of expert denoisers method works well for all available schedulers!"),Xa=m(),ie=l("h3"),$e=l("a"),cl=l("span"),u(Mt.$$.fragment),gn=m(),dl=l("span"),Mn=n("Base to refiner model"),Sa=m(),ms=l("p"),Jn=n("SDXL gets a boost in image quality by using the refiner model to add additional high-quality details to the fully-denoised image from the base model, in an image-to-image setting."),Ba=m(),cs=l("p"),wn=n("Load the base and refiner models:"),Ra=m(),u(Jt.$$.fragment),xa=m(),Xe=l("p"),vn=n("Generate an image from the base model, and set the model output to "),ul=l("strong"),Un=n("latent"),Tn=n(" space:"),Va=m(),u(wt.$$.fragment),Ca=m(),ds=l("p"),Zn=n("Pass the generated image to the refiner model:"),Na=m(),u(vt.$$.fragment),Ya=m(),oe=l("div"),Ut=l("div"),Tt=l("img"),_n=m(),us=l("figcaption"),jn=n("base model"),En=m(),Zt=l("div"),_t=l("img"),In=m(),hs=l("figcaption"),Wn=n("base model + refiner model"),Qa=m(),N=l("p"),Gn=n("For inpainting, load the refiner model in the "),ys=l("a"),kn=n("StableDiffusionXLInpaintPipeline"),$n=n(", remove the "),hl=l("code"),Xn=n("denoising_end"),Sn=n(" and "),yl=l("code"),Bn=n("denoising_start"),Rn=n(" parameters, and choose a smaller number of inference steps for the refiner."),Da=m(),ne=l("h2"),Se=l("a"),bl=l("span"),u(jt.$$.fragment),xn=m(),gl=l("span"),Vn=n("Micro-conditioning"),za=m(),Be=l("p"),Cn=n("SDXL training involves several additional conditioning techniques, which are referred to as "),Ml=l("em"),Nn=n("micro-conditioning"),Yn=n(". These include original image size, target image size, and cropping parameters. The micro-conditionings can be used at inference time to create high-quality, centered images."),Fa=m(),u(Re.$$.fragment),Aa=m(),re=l("h3"),xe=l("a"),Jl=l("span"),u(Et.$$.fragment),Qn=m(),wl=l("span"),Dn=n("Size conditioning"),La=m(),bs=l("p"),zn=n("There are two types of size conditioning:"),qa=m(),Ve=l("ul"),vl=l("li"),Y=l("p"),It=l("a"),Ul=l("code"),Fn=n("original_size"),An=n(" conditioning comes from upscaled images in the training batch (because it would be wasteful to discard the smaller images which make up almost 40% of the total training data). This way, SDXL learns that upscaling artifacts are not supposed to be present in high-resolution images. During inference, you can use "),Tl=l("code"),Ln=n("original_size"),qn=n(" to indicate the original image resolution. Using the default value of "),Zl=l("code"),Hn=n("(1024, 1024)"),Pn=n(" produces higher-quality images that resemble the 1024x1024 images in the dataset. If you choose to use a lower resolution, such as "),_l=l("code"),On=n("(256, 256)"),Kn=n(", the model still generates 1024x1024 images, but they\u2019ll look like the low resolution images (simpler patterns, blurring) in the dataset."),er=m(),jl=l("li"),Q=l("p"),Wt=l("a"),El=l("code"),tr=n("target_size"),sr=n(" conditioning comes from finetuning SDXL to support different image aspect ratios. During inference, if you use the default value of "),Il=l("code"),lr=n("(1024, 1024)"),ar=n(", you\u2019ll get an image that resembles the composition of square images in the dataset. We recommend using the same value for "),Wl=l("code"),ir=n("target_size"),or=n(" and "),Gl=l("code"),nr=n("original_size"),rr=n(", but feel free to experiment with other options!"),Ha=m(),gs=l("p"),pr=n("\u{1F917} Diffusers also lets you specify negative conditions about an image\u2019s size to steer generation away from certain image resolutions:"),Pa=m(),u(Gt.$$.fragment),Oa=m(),pe=l("div"),kl=l("img"),fr=m(),Ms=l("figcaption"),mr=n("Images negative conditioned on image resolutions of (128, 128), (256, 256), and (512, 512)."),Ka=m(),fe=l("h3"),Ce=l("a"),$l=l("span"),u(kt.$$.fragment),cr=m(),Xl=l("span"),dr=n("Crop conditioning"),ei=m(),L=l("p"),ur=n("Images generated by previous Stable Diffusion models may sometimes appear to be cropped. This is because images are actually cropped during training so that all the images in a batch have the same size. By conditioning on crop coordinates, SDXL "),Sl=l("em"),hr=n("learns"),yr=n(" that no cropping - coordinates "),Bl=l("code"),br=n("(0, 0)"),gr=n(" - usually correlates with centered subjects and complete faces (this is the default value in \u{1F917} Diffusers). You can experiment with different coordinates if you want to generate off-centered compositions!"),ti=m(),u($t.$$.fragment),si=m(),Xt=l("div"),Js=l("img"),li=m(),ws=l("p"),Mr=n("You can also specify negative cropping coordinates to steer generation away from certain cropping parameters:"),ai=m(),u(St.$$.fragment),ii=m(),me=l("h2"),Ne=l("a"),Rl=l("span"),u(Bt.$$.fragment),Jr=m(),xl=l("span"),wr=n("Use a different prompt for each text-encoder"),oi=m(),S=l("p"),vr=n("SDXL uses two text-encoders, so it is possible to pass a different prompt to each text-encoder, which can "),Rt=l("a"),Ur=n("improve quality"),Tr=n(". Pass your original prompt to "),Vl=l("code"),Zr=n("prompt"),_r=n(" and the second prompt to "),Cl=l("code"),jr=n("prompt_2"),Er=n(" (use "),Nl=l("code"),Ir=n("negative_prompt"),Wr=n(" and "),Yl=l("code"),Gr=n("negative_prompt_2"),kr=n(" if you\u2019re using a negative prompts):"),ni=m(),u(xt.$$.fragment),ri=m(),Vt=l("div"),vs=l("img"),pi=m(),Us=l("p"),$r=n("The dual text-encoders also support textual inversion embeddings that need to be loaded separately as explained in the [SDXL textual inversion](textual_inversion_inference#stable-diffusion-xl] section."),fi=m(),ce=l("h2"),Ye=l("a"),Ql=l("span"),u(Ct.$$.fragment),Xr=m(),Dl=l("span"),Sr=n("Optimizations"),mi=m(),Ts=l("p"),Br=n("SDXL is a large model, and you may need to optimize memory to get it to run on your hardware. Here are some tips to save memory and speed up inference."),ci=m(),Zs=l("ol"),Nt=l("li"),Rr=n("Offload the model to the CPU with "),_s=l("a"),xr=n("enable_model_cpu_offload()"),Vr=n(" for out-of-memory errors:"),di=m(),u(Yt.$$.fragment),ui=m(),Qt=l("ol"),de=l("li"),Cr=n("Use "),zl=l("code"),Nr=n("torch.compile"),Yr=n(" for ~20% speed-up (you need "),Fl=l("code"),Qr=n("torch>2.0"),Dr=n("):"),hi=m(),u(Dt.$$.fragment),yi=m(),zt=l("ol"),ue=l("li"),zr=n("Enable "),js=l("a"),Fr=n("xFormers"),Ar=n(" to run SDXL if "),Al=l("code"),Lr=n("torch<2.0"),qr=n(":"),bi=m(),u(Ft.$$.fragment),gi=m(),he=l("h2"),Qe=l("a"),Ll=l("span"),u(At.$$.fragment),Hr=m(),ql=l("span"),Pr=n("Other resources"),Mi=m(),q=l("p"),Or=n("If you\u2019re interested in experimenting with a minimal version of the "),Es=l("a"),Kr=n("UNet2DConditionModel"),ep=n(" used in SDXL, take a look at the "),Lt=l("a"),tp=n("minSDXL"),sp=n(" implementation which is written in PyTorch and directly compatible with \u{1F917} Diffusers."),this.h()},l(e){const o=Sm('[data-svelte="svelte-1phssyn"]',document.head);d=a(o,"META",{name:!0,content:!0}),o.forEach(t),$=c(e),w=a(e,"H1",{class:!0});var qt=i(w);Z=a(qt,"A",{id:!0,class:!0,href:!0});var Hl=i(Z);G=a(Hl,"SPAN",{});var Pl=i(G);h(v.$$.fragment,Pl),Pl.forEach(t),Hl.forEach(t),j=c(qt),I=a(qt,"SPAN",{});var hp=i(I);J=r(hp,"Stable Diffusion XL"),hp.forEach(t),qt.forEach(t),T=c(e),h(W.$$.fragment,e),k=c(e),U=a(e,"P",{});var lp=i(U);B=a(lp,"A",{href:!0,rel:!0});var yp=i(B);V=r(yp,"Stable Diffusion XL"),yp.forEach(t),E=r(lp," (SDXL) is a powerful text-to-image generation model that iterates on the previous Stable Diffusion models in three key ways:"),lp.forEach(t),Fe=c(e),x=a(e,"OL",{});var Is=i(x);Me=a(Is,"LI",{});var bp=i(Me);Ht=r(bp,"the UNet is 3x larger and SDXL combines a second text encoder (OpenCLIP ViT-bigG/14) with the original text encoder to significantly increase the number of parameters"),bp.forEach(t),Hi=c(Is),Rs=a(Is,"LI",{});var gp=i(Rs);Pi=r(gp,"introduces size and crop-conditioning to preserve training data from being discarded and gain more control over how a generated image should be cropped"),gp.forEach(t),Oi=c(Is),P=a(Is,"LI",{});var Ws=i(P);Ki=r(Ws,"introduces a two-stage model process; the "),xs=a(Ws,"EM",{});var Mp=i(xs);eo=r(Mp,"base"),Mp.forEach(t),to=r(Ws," model (can also be run as a standalone model) generates an image as an input to the "),Vs=a(Ws,"EM",{});var Jp=i(Vs);so=r(Jp,"refiner"),Jp.forEach(t),lo=r(Ws," model which adds additional high-quality details"),Ws.forEach(t),Is.forEach(t),Ol=c(e),Pt=a(e,"P",{});var wp=i(Pt);ao=r(wp,"This guide will show you how to use SDXL for text-to-image, image-to-image, and inpainting."),wp.forEach(t),Kl=c(e),Ot=a(e,"P",{});var vp=i(Ot);io=r(vp,"Before you begin, make sure you have the following libraries installed:"),vp.forEach(t),ea=c(e),h(Ae.$$.fragment,e),ta=c(e),h(Je.$$.fragment,e),sa=c(e),O=a(e,"H2",{class:!0});var wi=i(O);we=a(wi,"A",{id:!0,class:!0,href:!0});var Up=i(we);Cs=a(Up,"SPAN",{});var Tp=i(Cs);h(Le.$$.fragment,Tp),Tp.forEach(t),Up.forEach(t),oo=c(wi),Ns=a(wi,"SPAN",{});var Zp=i(Ns);no=r(Zp,"Load model checkpoints"),Zp.forEach(t),wi.forEach(t),la=c(e),ve=a(e,"P",{});var vi=i(ve);ro=r(vi,"Model weights may be stored in separate subfolders on the Hub or locally, in which case, you should use the "),Kt=a(vi,"A",{href:!0});var _p=i(Kt);po=r(_p,"from_pretrained()"),_p.forEach(t),fo=r(vi," method:"),vi.forEach(t),aa=c(e),h(qe.$$.fragment,e),ia=c(e),C=a(e,"P",{});var De=i(C);mo=r(De,"You can also use the "),es=a(De,"A",{href:!0});var jp=i(es);co=r(jp,"from_single_file()"),jp.forEach(t),uo=r(De," method to load a model checkpoint stored in a single file format ("),Ys=a(De,"CODE",{});var Ep=i(Ys);ho=r(Ep,".ckpt"),Ep.forEach(t),yo=r(De," or "),Qs=a(De,"CODE",{});var Ip=i(Qs);bo=r(Ip,".safetensors"),Ip.forEach(t),go=r(De,") from the Hub or locally:"),De.forEach(t),oa=c(e),h(He.$$.fragment,e),na=c(e),K=a(e,"H2",{class:!0});var Ui=i(K);Ue=a(Ui,"A",{id:!0,class:!0,href:!0});var Wp=i(Ue);Ds=a(Wp,"SPAN",{});var Gp=i(Ds);h(Pe.$$.fragment,Gp),Gp.forEach(t),Wp.forEach(t),Mo=c(Ui),zs=a(Ui,"SPAN",{});var kp=i(zs);Jo=r(kp,"Text-to-image"),kp.forEach(t),Ui.forEach(t),ra=c(e),F=a(e,"P",{});var Gs=i(F);wo=r(Gs,"For text-to-image, pass a text prompt. By default, SDXL generates a 1024x1024 image for the best results. You can try setting the "),Fs=a(Gs,"CODE",{});var $p=i(Fs);vo=r($p,"height"),$p.forEach(t),Uo=r(Gs," and "),As=a(Gs,"CODE",{});var Xp=i(As);To=r(Xp,"width"),Xp.forEach(t),Zo=r(Gs," parameters to 768x768 or 512x512, but anything below 512x512 is not likely to work."),Gs.forEach(t),pa=c(e),h(Oe.$$.fragment,e),fa=c(e),Ke=a(e,"DIV",{class:!0});var Sp=i(Ke);ts=a(Sp,"IMG",{src:!0,alt:!0}),Sp.forEach(t),ma=c(e),ee=a(e,"H2",{class:!0});var Ti=i(ee);Te=a(Ti,"A",{id:!0,class:!0,href:!0});var Bp=i(Te);Ls=a(Bp,"SPAN",{});var Rp=i(Ls);h(et.$$.fragment,Rp),Rp.forEach(t),Bp.forEach(t),_o=c(Ti),qs=a(Ti,"SPAN",{});var xp=i(qs);jo=r(xp,"Image-to-image"),xp.forEach(t),Ti.forEach(t),ca=c(e),ss=a(e,"P",{});var Vp=i(ss);Eo=r(Vp,"For image-to-image, SDXL works especially well with image sizes between 768x768 and 1024x1024. Pass an initial image, and a text prompt to condition the image with:"),Vp.forEach(t),da=c(e),h(tt.$$.fragment,e),ua=c(e),st=a(e,"DIV",{class:!0});var Cp=i(st);ls=a(Cp,"IMG",{src:!0,alt:!0}),Cp.forEach(t),ha=c(e),te=a(e,"H2",{class:!0});var Zi=i(te);Ze=a(Zi,"A",{id:!0,class:!0,href:!0});var Np=i(Ze);Hs=a(Np,"SPAN",{});var Yp=i(Hs);h(lt.$$.fragment,Yp),Yp.forEach(t),Np.forEach(t),Io=c(Zi),Ps=a(Zi,"SPAN",{});var Qp=i(Ps);Wo=r(Qp,"Inpainting"),Qp.forEach(t),Zi.forEach(t),ya=c(e),as=a(e,"P",{});var Dp=i(as);Go=r(Dp,"For inpainting, you\u2019ll need the original image and a mask of what you want to replace in the original image. Create a prompt to describe what you want to replace the masked area with."),Dp.forEach(t),ba=c(e),h(at.$$.fragment,e),ga=c(e),it=a(e,"DIV",{class:!0});var zp=i(it);is=a(zp,"IMG",{src:!0,alt:!0}),zp.forEach(t),Ma=c(e),se=a(e,"H2",{class:!0});var _i=i(se);_e=a(_i,"A",{id:!0,class:!0,href:!0});var Fp=i(_e);Os=a(Fp,"SPAN",{});var Ap=i(Os);h(ot.$$.fragment,Ap),Ap.forEach(t),Fp.forEach(t),ko=c(_i),Ks=a(_i,"SPAN",{});var Lp=i(Ks);$o=r(Lp,"Refine image quality"),Lp.forEach(t),_i.forEach(t),Ja=c(e),je=a(e,"P",{});var ji=i(je);Xo=r(ji,"SDXL includes a "),nt=a(ji,"A",{href:!0,rel:!0});var qp=i(nt);So=r(qp,"refiner model"),qp.forEach(t),Bo=r(ji," specialized in denoising low-noise stage images to generate higher-quality images from the base model. There are two ways to use the refiner:"),ji.forEach(t),wa=c(e),Ee=a(e,"OL",{});var Ei=i(Ee);el=a(Ei,"LI",{});var Hp=i(el);Ro=r(Hp,"use the base and refiner model together to produce a refined image"),Hp.forEach(t),xo=c(Ei),tl=a(Ei,"LI",{});var Pp=i(tl);Vo=r(Pp,"use the base model to produce an image, and subsequently use the refiner model to add more details to the image (this is how SDXL is originally trained)"),Pp.forEach(t),Ei.forEach(t),va=c(e),le=a(e,"H3",{class:!0});var Ii=i(le);Ie=a(Ii,"A",{id:!0,class:!0,href:!0});var Op=i(Ie);sl=a(Op,"SPAN",{});var Kp=i(sl);h(rt.$$.fragment,Kp),Kp.forEach(t),Op.forEach(t),Co=c(Ii),ll=a(Ii,"SPAN",{});var ef=i(ll);No=r(ef,"Base + refiner model"),ef.forEach(t),Ii.forEach(t),Ua=c(e),We=a(e,"P",{});var Wi=i(We);Yo=r(Wi,"When you use the base and refiner model together to generate an image, this is known as an ("),pt=a(Wi,"A",{href:!0,rel:!0});var tf=i(pt);al=a(tf,"EM",{});var sf=i(al);Qo=r(sf,"ensemble of expert denoisers"),sf.forEach(t),tf.forEach(t),Do=r(Wi,"). The ensemble of expert denoisers approach requires less overall denoising steps versus passing the base model\u2019s output to the refiner model, so it should be significantly faster to run. However, you won\u2019t be able to inspect the base model\u2019s output because it still contains a large amount of noise."),Wi.forEach(t),Ta=c(e),os=a(e,"P",{});var lf=i(os);zo=r(lf,"As an ensemble of expert denoisers, the base model serves as the expert during the high-noise diffusion stage and the refiner model serves as the expert during the low-noise diffusion stage. Load the base and refiner model:"),lf.forEach(t),Za=c(e),h(ft.$$.fragment,e),_a=c(e),A=a(e,"P",{});var ks=i(A);Fo=r(ks,"To use this approach, you need to define the number of timesteps for each model to run through their respective stages. For the base model, this is controlled by the "),mt=a(ks,"A",{href:!0,rel:!0});var af=i(mt);il=a(af,"CODE",{});var of=i(il);Ao=r(of,"denoising_end"),of.forEach(t),af.forEach(t),Lo=r(ks," parameter and for the refiner model, it is controlled by the "),ct=a(ks,"A",{href:!0,rel:!0});var nf=i(ct);ol=a(nf,"CODE",{});var rf=i(ol);qo=r(rf,"denoising_start"),rf.forEach(t),nf.forEach(t),Ho=r(ks," parameter."),ks.forEach(t),ja=c(e),h(Ge.$$.fragment,e),Ea=c(e),X=a(e,"P",{});var D=i(X);Po=r(D,"Let\u2019s set "),nl=a(D,"CODE",{});var pf=i(nl);Oo=r(pf,"denoising_end=0.8"),pf.forEach(t),Ko=r(D," so the base model performs the first 80% of denoising the "),rl=a(D,"STRONG",{});var ff=i(rl);en=r(ff,"high-noise"),ff.forEach(t),tn=r(D," timesteps and set "),pl=a(D,"CODE",{});var mf=i(pl);sn=r(mf,"denoising_start=0.8"),mf.forEach(t),ln=r(D," so the refiner model performs the last 20% of denoising the "),fl=a(D,"STRONG",{});var cf=i(fl);an=r(cf,"low-noise"),cf.forEach(t),on=r(D," timesteps. The base model output should be in "),ml=a(D,"STRONG",{});var df=i(ml);nn=r(df,"latent"),df.forEach(t),rn=r(D," space instead of a PIL image."),D.forEach(t),Ia=c(e),h(dt.$$.fragment,e),Wa=c(e),ae=a(e,"DIV",{class:!0});var Gi=i(ae);ut=a(Gi,"DIV",{});var ki=i(ut);ht=a(ki,"IMG",{class:!0,src:!0,alt:!0}),pn=c(ki),ns=a(ki,"FIGCAPTION",{class:!0});var uf=i(ns);fn=r(uf,"base model"),uf.forEach(t),ki.forEach(t),mn=c(Gi),yt=a(Gi,"DIV",{});var $i=i(yt);bt=a($i,"IMG",{class:!0,src:!0,alt:!0}),cn=c($i),rs=a($i,"FIGCAPTION",{class:!0});var hf=i(rs);dn=r(hf,"ensemble of expert denoisers"),hf.forEach(t),$i.forEach(t),Gi.forEach(t),Ga=c(e),ke=a(e,"P",{});var Xi=i(ke);un=r(Xi,"The refiner model can also be used for inpainting in the "),ps=a(Xi,"A",{href:!0});var yf=i(ps);hn=r(yf,"StableDiffusionXLInpaintPipeline"),yf.forEach(t),yn=r(Xi,":"),Xi.forEach(t),ka=c(e),h(gt.$$.fragment,e),$a=c(e),fs=a(e,"P",{});var bf=i(fs);bn=r(bf,"This ensemble of expert denoisers method works well for all available schedulers!"),bf.forEach(t),Xa=c(e),ie=a(e,"H3",{class:!0});var Si=i(ie);$e=a(Si,"A",{id:!0,class:!0,href:!0});var gf=i($e);cl=a(gf,"SPAN",{});var Mf=i(cl);h(Mt.$$.fragment,Mf),Mf.forEach(t),gf.forEach(t),gn=c(Si),dl=a(Si,"SPAN",{});var Jf=i(dl);Mn=r(Jf,"Base to refiner model"),Jf.forEach(t),Si.forEach(t),Sa=c(e),ms=a(e,"P",{});var wf=i(ms);Jn=r(wf,"SDXL gets a boost in image quality by using the refiner model to add additional high-quality details to the fully-denoised image from the base model, in an image-to-image setting."),wf.forEach(t),Ba=c(e),cs=a(e,"P",{});var vf=i(cs);wn=r(vf,"Load the base and refiner models:"),vf.forEach(t),Ra=c(e),h(Jt.$$.fragment,e),xa=c(e),Xe=a(e,"P",{});var Bi=i(Xe);vn=r(Bi,"Generate an image from the base model, and set the model output to "),ul=a(Bi,"STRONG",{});var Uf=i(ul);Un=r(Uf,"latent"),Uf.forEach(t),Tn=r(Bi," space:"),Bi.forEach(t),Va=c(e),h(wt.$$.fragment,e),Ca=c(e),ds=a(e,"P",{});var Tf=i(ds);Zn=r(Tf,"Pass the generated image to the refiner model:"),Tf.forEach(t),Na=c(e),h(vt.$$.fragment,e),Ya=c(e),oe=a(e,"DIV",{class:!0});var Ri=i(oe);Ut=a(Ri,"DIV",{});var xi=i(Ut);Tt=a(xi,"IMG",{class:!0,src:!0,alt:!0}),_n=c(xi),us=a(xi,"FIGCAPTION",{class:!0});var Zf=i(us);jn=r(Zf,"base model"),Zf.forEach(t),xi.forEach(t),En=c(Ri),Zt=a(Ri,"DIV",{});var Vi=i(Zt);_t=a(Vi,"IMG",{class:!0,src:!0,alt:!0}),In=c(Vi),hs=a(Vi,"FIGCAPTION",{class:!0});var _f=i(hs);Wn=r(_f,"base model + refiner model"),_f.forEach(t),Vi.forEach(t),Ri.forEach(t),Qa=c(e),N=a(e,"P",{});var ze=i(N);Gn=r(ze,"For inpainting, load the refiner model in the "),ys=a(ze,"A",{href:!0});var jf=i(ys);kn=r(jf,"StableDiffusionXLInpaintPipeline"),jf.forEach(t),$n=r(ze,", remove the "),hl=a(ze,"CODE",{});var Ef=i(hl);Xn=r(Ef,"denoising_end"),Ef.forEach(t),Sn=r(ze," and "),yl=a(ze,"CODE",{});var If=i(yl);Bn=r(If,"denoising_start"),If.forEach(t),Rn=r(ze," parameters, and choose a smaller number of inference steps for the refiner."),ze.forEach(t),Da=c(e),ne=a(e,"H2",{class:!0});var Ci=i(ne);Se=a(Ci,"A",{id:!0,class:!0,href:!0});var Wf=i(Se);bl=a(Wf,"SPAN",{});var Gf=i(bl);h(jt.$$.fragment,Gf),Gf.forEach(t),Wf.forEach(t),xn=c(Ci),gl=a(Ci,"SPAN",{});var kf=i(gl);Vn=r(kf,"Micro-conditioning"),kf.forEach(t),Ci.forEach(t),za=c(e),Be=a(e,"P",{});var Ni=i(Be);Cn=r(Ni,"SDXL training involves several additional conditioning techniques, which are referred to as "),Ml=a(Ni,"EM",{});var $f=i(Ml);Nn=r($f,"micro-conditioning"),$f.forEach(t),Yn=r(Ni,". These include original image size, target image size, and cropping parameters. The micro-conditionings can be used at inference time to create high-quality, centered images."),Ni.forEach(t),Fa=c(e),h(Re.$$.fragment,e),Aa=c(e),re=a(e,"H3",{class:!0});var Yi=i(re);xe=a(Yi,"A",{id:!0,class:!0,href:!0});var Xf=i(xe);Jl=a(Xf,"SPAN",{});var Sf=i(Jl);h(Et.$$.fragment,Sf),Sf.forEach(t),Xf.forEach(t),Qn=c(Yi),wl=a(Yi,"SPAN",{});var Bf=i(wl);Dn=r(Bf,"Size conditioning"),Bf.forEach(t),Yi.forEach(t),La=c(e),bs=a(e,"P",{});var Rf=i(bs);zn=r(Rf,"There are two types of size conditioning:"),Rf.forEach(t),qa=c(e),Ve=a(e,"UL",{});var Qi=i(Ve);vl=a(Qi,"LI",{});var xf=i(vl);Y=a(xf,"P",{});var ye=i(Y);It=a(ye,"A",{href:!0,rel:!0});var Vf=i(It);Ul=a(Vf,"CODE",{});var Cf=i(Ul);Fn=r(Cf,"original_size"),Cf.forEach(t),Vf.forEach(t),An=r(ye," conditioning comes from upscaled images in the training batch (because it would be wasteful to discard the smaller images which make up almost 40% of the total training data). This way, SDXL learns that upscaling artifacts are not supposed to be present in high-resolution images. During inference, you can use "),Tl=a(ye,"CODE",{});var Nf=i(Tl);Ln=r(Nf,"original_size"),Nf.forEach(t),qn=r(ye," to indicate the original image resolution. Using the default value of "),Zl=a(ye,"CODE",{});var Yf=i(Zl);Hn=r(Yf,"(1024, 1024)"),Yf.forEach(t),Pn=r(ye," produces higher-quality images that resemble the 1024x1024 images in the dataset. If you choose to use a lower resolution, such as "),_l=a(ye,"CODE",{});var Qf=i(_l);On=r(Qf,"(256, 256)"),Qf.forEach(t),Kn=r(ye,", the model still generates 1024x1024 images, but they\u2019ll look like the low resolution images (simpler patterns, blurring) in the dataset."),ye.forEach(t),xf.forEach(t),er=c(Qi),jl=a(Qi,"LI",{});var Df=i(jl);Q=a(Df,"P",{});var be=i(Q);Wt=a(be,"A",{href:!0,rel:!0});var zf=i(Wt);El=a(zf,"CODE",{});var Ff=i(El);tr=r(Ff,"target_size"),Ff.forEach(t),zf.forEach(t),sr=r(be," conditioning comes from finetuning SDXL to support different image aspect ratios. During inference, if you use the default value of "),Il=a(be,"CODE",{});var Af=i(Il);lr=r(Af,"(1024, 1024)"),Af.forEach(t),ar=r(be,", you\u2019ll get an image that resembles the composition of square images in the dataset. We recommend using the same value for "),Wl=a(be,"CODE",{});var Lf=i(Wl);ir=r(Lf,"target_size"),Lf.forEach(t),or=r(be," and "),Gl=a(be,"CODE",{});var qf=i(Gl);nr=r(qf,"original_size"),qf.forEach(t),rr=r(be,", but feel free to experiment with other options!"),be.forEach(t),Df.forEach(t),Qi.forEach(t),Ha=c(e),gs=a(e,"P",{});var Hf=i(gs);pr=r(Hf,"\u{1F917} Diffusers also lets you specify negative conditions about an image\u2019s size to steer generation away from certain image resolutions:"),Hf.forEach(t),Pa=c(e),h(Gt.$$.fragment,e),Oa=c(e),pe=a(e,"DIV",{class:!0});var Di=i(pe);kl=a(Di,"IMG",{src:!0}),fr=c(Di),Ms=a(Di,"FIGCAPTION",{class:!0});var Pf=i(Ms);mr=r(Pf,"Images negative conditioned on image resolutions of (128, 128), (256, 256), and (512, 512)."),Pf.forEach(t),Di.forEach(t),Ka=c(e),fe=a(e,"H3",{class:!0});var zi=i(fe);Ce=a(zi,"A",{id:!0,class:!0,href:!0});var Of=i(Ce);$l=a(Of,"SPAN",{});var Kf=i($l);h(kt.$$.fragment,Kf),Kf.forEach(t),Of.forEach(t),cr=c(zi),Xl=a(zi,"SPAN",{});var em=i(Xl);dr=r(em,"Crop conditioning"),em.forEach(t),zi.forEach(t),ei=c(e),L=a(e,"P",{});var $s=i(L);ur=r($s,"Images generated by previous Stable Diffusion models may sometimes appear to be cropped. This is because images are actually cropped during training so that all the images in a batch have the same size. By conditioning on crop coordinates, SDXL "),Sl=a($s,"EM",{});var tm=i(Sl);hr=r(tm,"learns"),tm.forEach(t),yr=r($s," that no cropping - coordinates "),Bl=a($s,"CODE",{});var sm=i(Bl);br=r(sm,"(0, 0)"),sm.forEach(t),gr=r($s," - usually correlates with centered subjects and complete faces (this is the default value in \u{1F917} Diffusers). You can experiment with different coordinates if you want to generate off-centered compositions!"),$s.forEach(t),ti=c(e),h($t.$$.fragment,e),si=c(e),Xt=a(e,"DIV",{class:!0});var lm=i(Xt);Js=a(lm,"IMG",{src:!0,alt:!0}),lm.forEach(t),li=c(e),ws=a(e,"P",{});var am=i(ws);Mr=r(am,"You can also specify negative cropping coordinates to steer generation away from certain cropping parameters:"),am.forEach(t),ai=c(e),h(St.$$.fragment,e),ii=c(e),me=a(e,"H2",{class:!0});var Fi=i(me);Ne=a(Fi,"A",{id:!0,class:!0,href:!0});var im=i(Ne);Rl=a(im,"SPAN",{});var om=i(Rl);h(Bt.$$.fragment,om),om.forEach(t),im.forEach(t),Jr=c(Fi),xl=a(Fi,"SPAN",{});var nm=i(xl);wr=r(nm,"Use a different prompt for each text-encoder"),nm.forEach(t),Fi.forEach(t),oi=c(e),S=a(e,"P",{});var z=i(S);vr=r(z,"SDXL uses two text-encoders, so it is possible to pass a different prompt to each text-encoder, which can "),Rt=a(z,"A",{href:!0,rel:!0});var rm=i(Rt);Ur=r(rm,"improve quality"),rm.forEach(t),Tr=r(z,". Pass your original prompt to "),Vl=a(z,"CODE",{});var pm=i(Vl);Zr=r(pm,"prompt"),pm.forEach(t),_r=r(z," and the second prompt to "),Cl=a(z,"CODE",{});var fm=i(Cl);jr=r(fm,"prompt_2"),fm.forEach(t),Er=r(z," (use "),Nl=a(z,"CODE",{});var mm=i(Nl);Ir=r(mm,"negative_prompt"),mm.forEach(t),Wr=r(z," and "),Yl=a(z,"CODE",{});var cm=i(Yl);Gr=r(cm,"negative_prompt_2"),cm.forEach(t),kr=r(z," if you\u2019re using a negative prompts):"),z.forEach(t),ni=c(e),h(xt.$$.fragment,e),ri=c(e),Vt=a(e,"DIV",{class:!0});var dm=i(Vt);vs=a(dm,"IMG",{src:!0,alt:!0}),dm.forEach(t),pi=c(e),Us=a(e,"P",{});var um=i(Us);$r=r(um,"The dual text-encoders also support textual inversion embeddings that need to be loaded separately as explained in the [SDXL textual inversion](textual_inversion_inference#stable-diffusion-xl] section."),um.forEach(t),fi=c(e),ce=a(e,"H2",{class:!0});var Ai=i(ce);Ye=a(Ai,"A",{id:!0,class:!0,href:!0});var hm=i(Ye);Ql=a(hm,"SPAN",{});var ym=i(Ql);h(Ct.$$.fragment,ym),ym.forEach(t),hm.forEach(t),Xr=c(Ai),Dl=a(Ai,"SPAN",{});var bm=i(Dl);Sr=r(bm,"Optimizations"),bm.forEach(t),Ai.forEach(t),mi=c(e),Ts=a(e,"P",{});var gm=i(Ts);Br=r(gm,"SDXL is a large model, and you may need to optimize memory to get it to run on your hardware. Here are some tips to save memory and speed up inference."),gm.forEach(t),ci=c(e),Zs=a(e,"OL",{});var Mm=i(Zs);Nt=a(Mm,"LI",{});var Li=i(Nt);Rr=r(Li,"Offload the model to the CPU with "),_s=a(Li,"A",{href:!0});var Jm=i(_s);xr=r(Jm,"enable_model_cpu_offload()"),Jm.forEach(t),Vr=r(Li," for out-of-memory errors:"),Li.forEach(t),Mm.forEach(t),di=c(e),h(Yt.$$.fragment,e),ui=c(e),Qt=a(e,"OL",{start:!0});var wm=i(Qt);de=a(wm,"LI",{});var Xs=i(de);Cr=r(Xs,"Use "),zl=a(Xs,"CODE",{});var vm=i(zl);Nr=r(vm,"torch.compile"),vm.forEach(t),Yr=r(Xs," for ~20% speed-up (you need "),Fl=a(Xs,"CODE",{});var Um=i(Fl);Qr=r(Um,"torch>2.0"),Um.forEach(t),Dr=r(Xs,"):"),Xs.forEach(t),wm.forEach(t),hi=c(e),h(Dt.$$.fragment,e),yi=c(e),zt=a(e,"OL",{start:!0});var Tm=i(zt);ue=a(Tm,"LI",{});var Ss=i(ue);zr=r(Ss,"Enable "),js=a(Ss,"A",{href:!0});var Zm=i(js);Fr=r(Zm,"xFormers"),Zm.forEach(t),Ar=r(Ss," to run SDXL if "),Al=a(Ss,"CODE",{});var _m=i(Al);Lr=r(_m,"torch<2.0"),_m.forEach(t),qr=r(Ss,":"),Ss.forEach(t),Tm.forEach(t),bi=c(e),h(Ft.$$.fragment,e),gi=c(e),he=a(e,"H2",{class:!0});var qi=i(he);Qe=a(qi,"A",{id:!0,class:!0,href:!0});var jm=i(Qe);Ll=a(jm,"SPAN",{});var Em=i(Ll);h(At.$$.fragment,Em),Em.forEach(t),jm.forEach(t),Hr=c(qi),ql=a(qi,"SPAN",{});var Im=i(ql);Pr=r(Im,"Other resources"),Im.forEach(t),qi.forEach(t),Mi=c(e),q=a(e,"P",{});var Bs=i(q);Or=r(Bs,"If you\u2019re interested in experimenting with a minimal version of the "),Es=a(Bs,"A",{href:!0});var Wm=i(Es);Kr=r(Wm,"UNet2DConditionModel"),Wm.forEach(t),ep=r(Bs," used in SDXL, take a look at the "),Lt=a(Bs,"A",{href:!0,rel:!0});var Gm=i(Lt);tp=r(Gm,"minSDXL"),Gm.forEach(t),sp=r(Bs," implementation which is written in PyTorch and directly compatible with \u{1F917} Diffusers."),Bs.forEach(t),this.h()},h(){f(d,"name","hf:doc:metadata"),f(d,"content",JSON.stringify(Qm)),f(Z,"id","stable-diffusion-xl"),f(Z,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(Z,"href","#stable-diffusion-xl"),f(w,"class","relative group"),f(B,"href","https://huggingface.co/papers/2307.01952"),f(B,"rel","nofollow"),f(we,"id","load-model-checkpoints"),f(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"),f(we,"href","#load-model-checkpoints"),f(O,"class","relative group"),f(Kt,"href","/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline.from_pretrained"),f(es,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.from_single_file"),f(Ue,"id","texttoimage"),f(Ue,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(Ue,"href","#texttoimage"),f(K,"class","relative group"),H(ts.src,ip="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-text2img.png")||f(ts,"src",ip),f(ts,"alt","generated image of an astronaut in a jungle"),f(Ke,"class","flex justify-center"),f(Te,"id","imagetoimage"),f(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"),f(Te,"href","#imagetoimage"),f(ee,"class","relative group"),H(ls.src,op="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-img2img.png")||f(ls,"src",op),f(ls,"alt","generated image of a dog catching a frisbee in a jungle"),f(st,"class","flex justify-center"),f(Ze,"id","inpainting"),f(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"),f(Ze,"href","#inpainting"),f(te,"class","relative group"),H(is.src,np="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-inpaint.png")||f(is,"src",np),f(is,"alt","generated image of a deep sea diver in a jungle"),f(it,"class","flex justify-center"),f(_e,"id","refine-image-quality"),f(_e,"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"),f(_e,"href","#refine-image-quality"),f(se,"class","relative group"),f(nt,"href","https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0"),f(nt,"rel","nofollow"),f(Ie,"id","base-refiner-model"),f(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"),f(Ie,"href","#base-refiner-model"),f(le,"class","relative group"),f(pt,"href","https://research.nvidia.com/labs/dir/eDiff-I/"),f(pt,"rel","nofollow"),f(mt,"href","https://huggingface.co/docs/diffusers/main/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLPipeline.__call__.denoising_end"),f(mt,"rel","nofollow"),f(ct,"href","https://huggingface.co/docs/diffusers/main/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLImg2ImgPipeline.__call__.denoising_start"),f(ct,"rel","nofollow"),f(ht,"class","rounded-xl"),H(ht.src,rp="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/lion_base.png")||f(ht,"src",rp),f(ht,"alt","generated image of a lion on a rock at night"),f(ns,"class","mt-2 text-center text-sm text-gray-500"),f(bt,"class","rounded-xl"),H(bt.src,pp="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/lion_refined.png")||f(bt,"src",pp),f(bt,"alt","generated image of a lion on a rock at night in higher quality"),f(rs,"class","mt-2 text-center text-sm text-gray-500"),f(ae,"class","flex gap-4"),f(ps,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLInpaintPipeline"),f($e,"id","base-to-refiner-model"),f($e,"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"),f($e,"href","#base-to-refiner-model"),f(ie,"class","relative group"),f(Tt,"class","rounded-xl"),H(Tt.src,fp="https://huggingface.co/datasets/diffusers/docs-images/resolve/main/sd_xl/init_image.png")||f(Tt,"src",fp),f(Tt,"alt","generated image of an astronaut riding a green horse on Mars"),f(us,"class","mt-2 text-center text-sm text-gray-500"),f(_t,"class","rounded-xl"),H(_t.src,mp="https://huggingface.co/datasets/diffusers/docs-images/resolve/main/sd_xl/refined_image.png")||f(_t,"src",mp),f(_t,"alt","higher quality generated image of an astronaut riding a green horse on Mars"),f(hs,"class","mt-2 text-center text-sm text-gray-500"),f(oe,"class","flex gap-4"),f(ys,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLInpaintPipeline"),f(Se,"id","microconditioning"),f(Se,"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"),f(Se,"href","#microconditioning"),f(ne,"class","relative group"),f(xe,"id","size-conditioning"),f(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"),f(xe,"href","#size-conditioning"),f(re,"class","relative group"),f(It,"href","https://huggingface.co/docs/diffusers/main/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLPipeline.__call__.original_size"),f(It,"rel","nofollow"),f(Wt,"href","https://huggingface.co/docs/diffusers/main/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLPipeline.__call__.target_size"),f(Wt,"rel","nofollow"),H(kl.src,cp="https://huggingface.co/datasets/diffusers/docs-images/resolve/main/sd_xl/negative_conditions.png")||f(kl,"src",cp),f(Ms,"class","text-center"),f(pe,"class","flex flex-col justify-center"),f(Ce,"id","crop-conditioning"),f(Ce,"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"),f(Ce,"href","#crop-conditioning"),f(fe,"class","relative group"),H(Js.src,dp="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-cropped.png")||f(Js,"src",dp),f(Js,"alt","generated image of an astronaut in a jungle, slightly cropped"),f(Xt,"class","flex justify-center"),f(Ne,"id","use-a-different-prompt-for-each-textencoder"),f(Ne,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(Ne,"href","#use-a-different-prompt-for-each-textencoder"),f(me,"class","relative group"),f(Rt,"href","https://github.com/huggingface/diffusers/issues/4004#issuecomment-1627764201"),f(Rt,"rel","nofollow"),H(vs.src,up="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-double-prompt.png")||f(vs,"src",up),f(vs,"alt","generated image of an astronaut in a jungle in the style of a van gogh painting"),f(Vt,"class","flex justify-center"),f(Ye,"id","optimizations"),f(Ye,"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"),f(Ye,"href","#optimizations"),f(ce,"class","relative group"),f(_s,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/gligen#diffusers.StableDiffusionGLIGENTextImagePipeline.enable_model_cpu_offload"),f(Qt,"start","2"),f(js,"href","/optimization/xformers"),f(zt,"start","3"),f(Qe,"id","other-resources"),f(Qe,"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"),f(Qe,"href","#other-resources"),f(he,"class","relative group"),f(Es,"href","/docs/diffusers/main/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel"),f(Lt,"href","https://github.com/cloneofsimo/minSDXL"),f(Lt,"rel","nofollow")},m(e,o){s(document.head,d),p(e,$,o),p(e,w,o),s(w,Z),s(Z,G),y(v,G,null),s(w,j),s(w,I),s(I,J),p(e,T,o),y(W,e,o),p(e,k,o),p(e,U,o),s(U,B),s(B,V),s(U,E),p(e,Fe,o),p(e,x,o),s(x,Me),s(Me,Ht),s(x,Hi),s(x,Rs),s(Rs,Pi),s(x,Oi),s(x,P),s(P,Ki),s(P,xs),s(xs,eo),s(P,to),s(P,Vs),s(Vs,so),s(P,lo),p(e,Ol,o),p(e,Pt,o),s(Pt,ao),p(e,Kl,o),p(e,Ot,o),s(Ot,io),p(e,ea,o),y(Ae,e,o),p(e,ta,o),y(Je,e,o),p(e,sa,o),p(e,O,o),s(O,we),s(we,Cs),y(Le,Cs,null),s(O,oo),s(O,Ns),s(Ns,no),p(e,la,o),p(e,ve,o),s(ve,ro),s(ve,Kt),s(Kt,po),s(ve,fo),p(e,aa,o),y(qe,e,o),p(e,ia,o),p(e,C,o),s(C,mo),s(C,es),s(es,co),s(C,uo),s(C,Ys),s(Ys,ho),s(C,yo),s(C,Qs),s(Qs,bo),s(C,go),p(e,oa,o),y(He,e,o),p(e,na,o),p(e,K,o),s(K,Ue),s(Ue,Ds),y(Pe,Ds,null),s(K,Mo),s(K,zs),s(zs,Jo),p(e,ra,o),p(e,F,o),s(F,wo),s(F,Fs),s(Fs,vo),s(F,Uo),s(F,As),s(As,To),s(F,Zo),p(e,pa,o),y(Oe,e,o),p(e,fa,o),p(e,Ke,o),s(Ke,ts),p(e,ma,o),p(e,ee,o),s(ee,Te),s(Te,Ls),y(et,Ls,null),s(ee,_o),s(ee,qs),s(qs,jo),p(e,ca,o),p(e,ss,o),s(ss,Eo),p(e,da,o),y(tt,e,o),p(e,ua,o),p(e,st,o),s(st,ls),p(e,ha,o),p(e,te,o),s(te,Ze),s(Ze,Hs),y(lt,Hs,null),s(te,Io),s(te,Ps),s(Ps,Wo),p(e,ya,o),p(e,as,o),s(as,Go),p(e,ba,o),y(at,e,o),p(e,ga,o),p(e,it,o),s(it,is),p(e,Ma,o),p(e,se,o),s(se,_e),s(_e,Os),y(ot,Os,null),s(se,ko),s(se,Ks),s(Ks,$o),p(e,Ja,o),p(e,je,o),s(je,Xo),s(je,nt),s(nt,So),s(je,Bo),p(e,wa,o),p(e,Ee,o),s(Ee,el),s(el,Ro),s(Ee,xo),s(Ee,tl),s(tl,Vo),p(e,va,o),p(e,le,o),s(le,Ie),s(Ie,sl),y(rt,sl,null),s(le,Co),s(le,ll),s(ll,No),p(e,Ua,o),p(e,We,o),s(We,Yo),s(We,pt),s(pt,al),s(al,Qo),s(We,Do),p(e,Ta,o),p(e,os,o),s(os,zo),p(e,Za,o),y(ft,e,o),p(e,_a,o),p(e,A,o),s(A,Fo),s(A,mt),s(mt,il),s(il,Ao),s(A,Lo),s(A,ct),s(ct,ol),s(ol,qo),s(A,Ho),p(e,ja,o),y(Ge,e,o),p(e,Ea,o),p(e,X,o),s(X,Po),s(X,nl),s(nl,Oo),s(X,Ko),s(X,rl),s(rl,en),s(X,tn),s(X,p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xr),s(Nt,Vr),p(e,di,o),y(Yt,e,o),p(e,ui,o),p(e,Qt,o),s(Qt,de),s(de,Cr),s(de,zl),s(zl,Nr),s(de,Yr),s(de,Fl),s(Fl,Qr),s(de,Dr),p(e,hi,o),y(Dt,e,o),p(e,yi,o),p(e,zt,o),s(zt,ue),s(ue,zr),s(ue,js),s(js,Fr),s(ue,Ar),s(ue,Al),s(Al,Lr),s(ue,qr),p(e,bi,o),y(Ft,e,o),p(e,gi,o),p(e,he,o),s(he,Qe),s(Qe,Ll),y(At,Ll,null),s(he,Hr),s(he,ql),s(ql,Pr),p(e,Mi,o),p(e,q,o),s(q,Or),s(q,Es),s(Es,Kr),s(q,ep),s(q,Lt),s(Lt,tp),s(q,sp),Ji=!0},p(e,[o]){const qt={};o&2&&(qt.$$scope={dirty:o,ctx:e}),Je.$set(qt);const Hl={};o&2&&(Hl.$$scope={dirty:o,ctx:e}),Ge.$set(Hl);const Pl={};o&2&&(Pl.$$scope={dirty:o,ctx:e}),Re.$set(Pl)},i(e){Ji||(b(v.$$.fragment,e),b(W.$$.fragment,e),b(Ae.$$.fragment,e),b(Je.$$.fragment,e),b(Le.$$.fragment,e),b(qe.$$.fragment,e),b(He.$$.fragment,e),b(Pe.$$.fragment,e),b(Oe.$$.fragment,e),b(et.$$.fragment,e),b(tt.$$.fragment,e),b(lt.$$.fragment,e),b(at.$$.fragment,e),b(ot.$$.fragment,e),b(rt.$$.fragment,e),b(ft.$$.fragment,e),b(Ge.$$.fragment,e),b(dt.$$.fragment,e),b(gt.$$.fragment,e),b(Mt.$$.fragment,e),b(Jt.$$.fragment,e),b(wt.$$.fragment,e),b(vt.$$.fragment,e),b(jt.$$.fragment,e),b(Re.$$.fragment,e),b(Et.$$.fragment,e),b(Gt.$$.fragment,e),b(kt.$$.fragment,e),b($t.$$.fragment,e),b(St.$$.fragment,e),b(Bt.$$.fragment,e),b(xt.$$.fragment,e),b(Ct.$$.fragment,e),b(Yt.$$.fragment,e),b(Dt.$$.fragment,e),b(Ft.$$.fragment,e),b(At.$$.fragment,e),Ji=!0)},o(e){g(v.$$.fragment,e),g(W.$$.fragment,e),g(Ae.$$.fragment,e),g(Je.$$.fragment,e),g(Le.$$.fragment,e),g(qe.$$.fragment,e),g(He.$$.fragment,e),g(Pe.$$.fragment,e),g(Oe.$$.fragment,e),g(et.$$.fragment,e),g(tt.$$.fragment,e),g(lt.$$.fragment,e),g(at.$$.fragment,e),g(ot.$$.fragment,e),g(rt.$$.fragment,e),g(ft.$$.fragment,e),g(Ge.$$.fragment,e),g(dt.$$.fragment,e),g(gt.$$.fragment,e),g(Mt.$$.fragment,e),g(Jt.$$.fragment,e),g(wt.$$.fragment,e),g(vt.$$.fragment,e),g(jt.$$.fragment,e),g(Re.$$.fragment,e),g(Et.$$.fragment,e),g(Gt.$$.fragment,e),g(kt.$$.fragment,e),g($t.$$.fragment,e),g(St.$$.fragment,e),g(Bt.$$.fragment,e),g(xt.$$.fragment,e),g(Ct.$$.fragment,e),g(Yt.$$.fragment,e),g(Dt.$$.fragment,e),g(Ft.$$.fragment,e),g(At.$$.fragment,e),Ji=!1},d(e){t(d),e&&t($),e&&t(w),M(v),e&&t(T),M(W,e),e&&t(k),e&&t(U),e&&t(Fe),e&&t(x),e&&t(Ol),e&&t(Pt),e&&t(Kl),e&&t(Ot),e&&t(ea),M(Ae,e),e&&t(ta),M(Je,e),e&&t(sa),e&&t(O),M(Le),e&&t(la),e&&t(ve),e&&t(aa),M(qe,e),e&&t(ia),e&&t(C),e&&t(oa),M(He,e),e&&t(na),e&&t(K),M(Pe),e&&t(ra),e&&t(F),e&&t(pa),M(Oe,e),e&&t(fa),e&&t(Ke),e&&t(ma),e&&t(ee),M(et),e&&t(ca),e&&t(ss),e&&t(da),M(tt,e),e&&t(ua),e&&t(st),e&&t(ha),e&&t(te),M(lt),e&&t(ya),e&&t(as),e&&t(ba),M(at,e),e&&t(ga),e&&t(it),e&&t(Ma),e&&t(se),M(ot),e&&t(Ja),e&&t(je),e&&t(wa),e&&t(Ee),e&&t(va),e&&t(le),M(rt),e&&t(Ua),e&&t(We),e&&t(Ta),e&&t(os),e&&t(Za),M(ft,e),e&&t(_a),e&&t(A),e&&t(ja),M(Ge,e),e&&t(Ea),e&&t(X),e&&t(Ia),M(dt,e),e&&t(Wa),e&&t(ae),e&&t(Ga),e&&t(ke),e&&t(ka),M(gt,e),e&&t($a),e&&t(fs),e&&t(Xa),e&&t(ie),M(Mt),e&&t(Sa),e&&t(ms),e&&t(Ba),e&&t(cs),e&&t(Ra),M(Jt,e),e&&t(xa),e&&t(Xe),e&&t(Va),M(wt,e),e&&t(Ca),e&&t(ds),e&&t(Na),M(vt,e),e&&t(Ya),e&&t(oe),e&&t(Qa),e&&t(N),e&&t(Da),e&&t(ne),M(jt),e&&t(za),e&&t(Be),e&&t(Fa),M(Re,e),e&&t(Aa),e&&t(re),M(Et),e&&t(La),e&&t(bs),e&&t(qa),e&&t(Ve),e&&t(Ha),e&&t(gs),e&&t(Pa),M(Gt,e),e&&t(Oa),e&&t(pe),e&&t(Ka),e&&t(fe),M(kt),e&&t(ei),e&&t(L),e&&t(ti),M($t,e),e&&t(si),e&&t(Xt),e&&t(li),e&&t(ws),e&&t(ai),M(St,e),e&&t(ii),e&&t(me),M(Bt),e&&t(oi),e&&t(S),e&&t(ni),M(xt,e),e&&t(ri),e&&t(Vt),e&&t(pi),e&&t(Us),e&&t(fi),e&&t(ce),M(Ct),e&&t(mi),e&&t(Ts),e&&t(ci),e&&t(Zs),e&&t(di),M(Yt,e),e&&t(ui),e&&t(Qt),e&&t(hi),M(Dt,e),e&&t(yi),e&&t(zt),e&&t(bi),M(Ft,e),e&&t(gi),e&&t(he),M(At),e&&t(Mi),e&&t(q)}}}const Qm={local:"stable-diffusion-xl",sections:[{local:"load-model-checkpoints",title:"Load model checkpoints"},{local:"texttoimage",title:"Text-to-image"},{local:"imagetoimage",title:"Image-to-image"},{local:"inpainting",title:"Inpainting"},{local:"refine-image-quality",sections:[{local:"base-refiner-model",title:"Base + refiner model"},{local:"base-to-refiner-model",title:"Base to refiner model"}],title:"Refine image quality"},{local:"microconditioning",sections:[{local:"size-conditioning",title:"Size conditioning"},{local:"crop-conditioning",title:"Crop conditioning"}],title:"Micro-conditioning"},{local:"use-a-different-prompt-for-each-textencoder",title:"Use a different prompt for each text-encoder"},{local:"optimizations",title:"Optimizations"},{local:"other-resources",title:"Other resources"}],title:"Stable Diffusion XL"};function Dm(ge){return Bm(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Hm extends km{constructor(d){super();$m(this,d,Dm,Ym,Xm,{})}}export{Hm as default,Qm as metadata}; | |
Xet Storage Details
- Size:
- 86 kB
- Xet hash:
- 8a20273cd28b7caf12c6f84a89634c40282bb48e4d82781ea76598c22f495cce
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.