Buckets:

hf-doc-build/doc / diffusers /v0.21.0 /en /_app /pages /using-diffusers /sdxl.mdx-hf-doc-builder.js
rtrm's picture
download
raw
85.5 kB
import{S as Em,i as Im,s as Wm,e as l,k as m,w as u,t as n,M as Gm,c as a,d as s,m as c,a as i,x as h,h as r,b as f,N as H,G as t,g as p,y,q as b,o as g,B as M,v as km,L as $m}from"../../chunks/vendor-hf-doc-builder.js";import{T as tp}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 Sm(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(s),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(s),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),t(d,$),t(d,w),t(w,Z),t(d,G),p(J,v,T),y(j,J,T),I=!0},p:$m,i(J){I||(b(j.$$.fragment,J),I=!0)},o(J){g(j.$$.fragment,J),I=!1},d(J){J&&s(d),J&&s(v),M(j,J)}}}function Bm(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(s),G=r(U," and "),v=a(U,"CODE",{});var V=i(v);j=r(V,"denoising_start"),V.forEach(s),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(s),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(s)},m(k,U){p(k,d,U),t(d,$),t(d,w),t(w,Z),t(d,G),t(d,v),t(v,j),t(d,I),t(d,J),t(J,T),t(d,W)},d(k){k&&s(d)}}}function Rm(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(s),G=r(E,", "),v=a(E,"A",{href:!0});var x=i(v);j=r(x,"StableDiffusionXLImg2ImgPipeline"),x.forEach(s),I=r(E,", "),J=a(E,"A",{href:!0});var Me=i(J);T=r(Me,"StableDiffusionXLInpaintPipeline"),Me.forEach(s),W=r(E,", and "),k=a(E,"A",{href:!0});var Ht=i(k);U=r(Ht,"StableDiffusionXLControlNetPipeline"),Ht.forEach(s),B=r(E,"."),E.forEach(s),this.h()},h(){f(w,"href","/docs/diffusers/v0.21.0/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLPipeline"),f(v,"href","/docs/diffusers/v0.21.0/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLImg2ImgPipeline"),f(J,"href","/docs/diffusers/v0.21.0/en/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLInpaintPipeline"),f(k,"href","/docs/diffusers/v0.21.0/en/api/pipelines/controlnet_sdxl#diffusers.StableDiffusionXLControlNetPipeline")},m(V,E){p(V,d,E),t(d,$),t(d,w),t(w,Z),t(d,G),t(d,v),t(v,j),t(d,I),t(d,J),t(J,T),t(d,W),t(d,k),t(k,U),t(d,B)},d(V){V&&s(d)}}}function xm(ge){let d,$,w,Z,G,v,j,I,J,T,W,k,U,B,V,E,Fe,x,Me,Ht,Li,Bs,qi,Hi,P,Pi,Rs,Oi,Ki,xs,eo,to,Pl,Pt,so,Ol,Ot,lo,Kl,Ae,ea,Je,ta,O,we,Vs,Le,ao,Cs,io,sa,ve,oo,Kt,no,ro,la,qe,aa,C,po,es,fo,mo,Ns,co,uo,Ys,ho,yo,ia,He,oa,K,Ue,Qs,Pe,bo,Ds,go,na,F,Mo,zs,Jo,wo,Fs,vo,Uo,ra,Oe,pa,Ke,ts,sp,fa,ee,Te,As,et,To,Ls,Zo,ma,ss,_o,ca,tt,da,st,ls,lp,ua,te,Ze,qs,lt,jo,Hs,Eo,ha,as,Io,ya,at,ba,it,is,ap,ga,se,_e,Ps,ot,Wo,Os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r,_s,Qr,Dr,Fl,zr,Fr,hi,Ft,yi,he,Qe,Al,At,Ar,Ll,Lr,bi,q,qr,js,Hr,Pr,Lt,Or,Kr,gi;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&gt;=0.2.0</span>`}}),Je=new tp({props:{warning:!0,$$slots:{default:[Sm]},$$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">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
refiner = StableDiffusionXLImg2ImgPipeline.from_single_file(
<span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-refiner-1.0&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)`}}),He=new _({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblhMUGlwZWxpbmUlMkMlMjBTdGFibGVEaWZmdXNpb25YTEltZzJJbWdQaXBlbGluZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25YTFBpcGVsaW5lLmZyb21fc2luZ2xlX2ZpbGUoJTBBJTIwJTIwJTIwJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi14bC1iYXNlLTEuMCUyRmJsb2IlMkZtYWluJTJGc2RfeGxfYmFzZV8xLjAuc2FmZXRlbnNvcnMlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUlMEEpLnRvKCUyMmN1ZGElMjIpJTBBJTBBcmVmaW5lciUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblhMSW1nMkltZ1BpcGVsaW5lLmZyb21fc2luZ2xlX2ZpbGUoJTBBJTIwJTIwJTIwJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRnN0YWJpbGl0eWFpJTJGc3RhYmxlLWRpZmZ1c2lvbi14bC1yZWZpbmVyLTEuMCUyRmJsb2IlMkZtYWluJTJGc2RfeGxfcmVmaW5lcl8xLjAuc2FmZXRlbnNvcnMlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlJTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIlMEEpLnRvKCUyMmN1ZGElMjIp",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_single_file(
<span class="hljs-string">&quot;https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0.safetensors&quot;</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
refiner = StableDiffusionXLImg2ImgPipeline.from_single_file(
<span class="hljs-string">&quot;https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/blob/main/sd_xl_refiner_1.0.safetensors&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>
).to(<span class="hljs-string">&quot;cuda&quot;</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">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>
).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 = 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">&quot;cuda&quot;</span>)
url = <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-img2img.png&quot;</span>
init_image = load_image(url).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
prompt = <span class="hljs-string">&quot;a dog catching a frisbee in the jungle&quot;</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:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvcklucGFpbnRpbmclMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZ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YWdlJTJDJTIwc3RyZW5ndGglM0QwLjg1JTJDJTIwZ3VpZGFuY2Vfc2NhbGUlM0QxMi41KS5pbWFnZXMlNUIwJTVE",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-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">&quot;cuda&quot;</span>)
img_url = <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-text2img.png&quot;</span>
mask_url = <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-inpaint-mask.png&quot;</span>
init_image = load_image(img_url).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
mask_image = load_image(mask_url).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
prompt = <span class="hljs-string">&quot;A deep sea diver floating&quot;</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">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
refiner = DiffusionPipeline.from_pretrained(
<span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-refiner-1.0&quot;</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">&quot;fp16&quot;</span>,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)`}}),Ge=new tp({props:{$$slots:{default:[Bm]},$$scope:{ctx:ge}}}),dt=new _({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMG1hamVzdGljJTIwbGlvbiUyMGp1bXBpbmclMjBmcm9tJTIwYSUyMGJpZyUyMHN0b25lJTIwYXQlMjBuaWdodCUyMiUwQSUwQWltYWdlJTIwJTNEJTIwYmFzZSglMEElMjAlMjAlMjAlMjBwcm9tcHQlM0Rwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENDAlMkMlMEElMjAlMjAlMjAlMjBkZW5vaXNpbmdfZW5kJTNEMC44JTJDJTBBJTIwJTIwJTIwJTIwb3V0cHV0X3R5cGUlM0QlMjJsYXRlbnQlMjIlMkMlMEEpLmltYWdlcyUwQWltYWdlJTIwJTNEJTIwcmVmaW5lciglMEElMjAlMjAlMjAlMjBwcm9tcHQlM0Rwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENDAlMkMlMEElMjAlMjAlMjAlMjBkZW5vaXNpbmdfc3RhcnQlM0QwLjglMkMlMEElMjAlMjAlMjAlMjBpbWFnZSUzRGltYWdlJTJDJTBBKS5pbWFnZXMlNUIwJTVE",highlighted:`prompt = <span class="hljs-string">&quot;A majestic lion jumping from a big stone at night&quot;</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">&quot;latent&quot;</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:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblhMSW5wYWludFBpcGVsaW5lJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEElMEFiYXNlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uWExJbnBhaW50UGlwZWxpbmUuZnJvbV9wcmV0cmFp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AlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEbnVtX2luZmVyZW5jZV9zdGVwcyUyQyUwQSUyMCUyMCUyMCUyMGRlbm9pc2luZ19zdGFydCUzRGhpZ2hfbm9pc2VfZnJhYyUyQyUwQSkuaW1hZ2VzJTVCMCU1RA==",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">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
refiner = StableDiffusionXLInpaintPipeline.from_pretrained(
<span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-refiner-1.0&quot;</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">&quot;fp16&quot;</span>,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
img_url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png&quot;</span>
mask_url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png&quot;</span>
init_image = load_image(img_url).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
mask_image = load_image(mask_url).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
prompt = <span class="hljs-string">&quot;A majestic tiger sitting on a bench&quot;</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">&quot;latent&quot;</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">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
refiner = DiffusionPipeline.from_pretrained(
<span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-refiner-1.0&quot;</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">&quot;fp16&quot;</span>,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)`}}),wt=new _({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQXN0cm9uYXV0JTIwaW4lMjBhJTIwanVuZ2xlJTJDJTIwY29sZCUyMGNvbG9yJTIwcGFsZXR0ZSUyQyUyMG11dGVkJTIwY29sb3JzJTJDJTIwZGV0YWlsZWQlMkMlMjA4ayUyMiUwQSUwQWltYWdlJTIwJTNEJTIwYmFzZShwcm9tcHQlM0Rwcm9tcHQlMkMlMjBvdXRwdXRfdHlwZSUzRCUyMmxhdGVudCUyMikuaW1hZ2VzJTVCMCU1RA==",highlighted:`prompt = <span class="hljs-string">&quot;Astronaut in a jungle, cold color palette, muted colors, detailed, 8k&quot;</span>
image = base(prompt=prompt, output_type=<span class="hljs-string">&quot;latent&quot;</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 tp({props:{$$slots:{default:[Rm]},$$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">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>
).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,
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">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>
).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 = 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">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>
).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,
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">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">&quot;fp16&quot;</span>, use_safetensors=<span class="hljs-literal">True</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-comment"># prompt is passed to OAI CLIP-ViT/L-14</span>
prompt = <span class="hljs-string">&quot;Astronaut in a jungle, cold color palette, muted colors, detailed, 8k&quot;</span>
<span class="hljs-comment"># prompt_2 is passed to OpenCLIP-ViT/bigG-14</span>
prompt_2 = <span class="hljs-string">&quot;Van Gogh painting&quot;</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(&quot;cuda&quot;)</span>
<span class="hljs-deletion">- refiner.to(&quot;cuda&quot;)</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=&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>`}}),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"),Li=m(),Bs=l("li"),qi=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"),Hi=m(),P=l("li"),Pi=n("introduces a two-stage model process; the "),Rs=l("em"),Oi=n("base"),Ki=n(" model (can also be run as a standalone model) generates an image as an input to the "),xs=l("em"),eo=n("refiner"),to=n(" model which adds additional high-quality details"),Pl=m(),Pt=l("p"),so=n("This guide will show you how to use SDXL for text-to-image, image-to-image, and inpainting."),Ol=m(),Ot=l("p"),lo=n("Before you begin, make sure you have the following libraries installed:"),Kl=m(),u(Ae.$$.fragment),ea=m(),u(Je.$$.fragment),ta=m(),O=l("h2"),we=l("a"),Vs=l("span"),u(Le.$$.fragment),ao=m(),Cs=l("span"),io=n("Load model checkpoints"),sa=m(),ve=l("p"),oo=n("Model weights may be stored in separate subfolders on the Hub or locally, in which case, you should use the "),Kt=l("a"),no=n("from_pretrained()"),ro=n(" method:"),la=m(),u(qe.$$.fragment),aa=m(),C=l("p"),po=n("You can also use the "),es=l("a"),fo=n("from_single_file()"),mo=n(" method to load a model checkpoint stored in a single file format ("),Ns=l("code"),co=n(".ckpt"),uo=n(" or "),Ys=l("code"),ho=n(".safetensors"),yo=n(") from the Hub or locally:"),ia=m(),u(He.$$.fragment),oa=m(),K=l("h2"),Ue=l("a"),Qs=l("span"),u(Pe.$$.fragment),bo=m(),Ds=l("span"),go=n("Text-to-image"),na=m(),F=l("p"),Mo=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 "),zs=l("code"),Jo=n("height"),wo=n(" and "),Fs=l("code"),vo=n("width"),Uo=n(" parameters to 768x768 or 512x512, but anything below 512x512 is not likely to work."),ra=m(),u(Oe.$$.fragment),pa=m(),Ke=l("div"),ts=l("img"),fa=m(),ee=l("h2"),Te=l("a"),As=l("span"),u(et.$$.fragment),To=m(),Ls=l("span"),Zo=n("Image-to-image"),ma=m(),ss=l("p"),_o=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:"),ca=m(),u(tt.$$.fragment),da=m(),st=l("div"),ls=l("img"),ua=m(),te=l("h2"),Ze=l("a"),qs=l("span"),u(lt.$$.fragment),jo=m(),Hs=l("span"),Eo=n("Inpainting"),ha=m(),as=l("p"),Io=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."),ya=m(),u(at.$$.fragment),ba=m(),it=l("div"),is=l("img"),ga=m(),se=l("h2"),_e=l("a"),Ps=l("span"),u(ot.$$.fragment),Wo=m(),Os=l("span"),Go=n("Refine image quality"),Ma=m(),je=l("p"),ko=n("SDXL includes a "),nt=l("a"),$o=n("refiner model"),Xo=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:"),Ja=m(),Ee=l("ol"),Ks=l("li"),So=n("use the base and refiner model together to produce a refined image"),Bo=m(),el=l("li"),Ro=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)"),wa=m(),le=l("h3"),Ie=l("a"),tl=l("span"),u(rt.$$.fragment),xo=m(),sl=l("span"),Vo=n("Base + refiner model"),va=m(),We=l("p"),Co=n("When you use the base and refiner model together to generate an image, this is known as an ("),pt=l("a"),ll=l("em"),No=n("ensemble of expert denoisers"),Yo=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."),Ua=m(),os=l("p"),Qo=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:"),Ta=m(),u(ft.$$.fragment),Za=m(),A=l("p"),Do=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"),al=l("code"),zo=n("denoising_end"),Fo=n(" parameter and for the refiner model, it is controlled by the "),ct=l("a"),il=l("code"),Ao=n("denoising_start"),Lo=n(" parameter."),_a=m(),u(Ge.$$.fragment),ja=m(),X=l("p"),qo=n("Let\u2019s set "),ol=l("code"),Ho=n("denoising_end=0.8"),Po=n(" so the base model performs the first 80% of denoising the "),nl=l("strong"),Oo=n("high-noise"),Ko=n(" timesteps and set "),rl=l("code"),en=n("denoising_start=0.8"),tn=n(" so the refiner model performs the last 20% of denoising the "),pl=l("strong"),sn=n("low-noise"),ln=n(" timesteps. The base model output should be in "),fl=l("strong"),an=n("latent"),on=n(" space instead of a PIL image."),Ea=m(),u(dt.$$.fragment),Ia=m(),ae=l("div"),ut=l("div"),ht=l("img"),nn=m(),ns=l("figcaption"),rn=n("base model"),pn=m(),yt=l("div"),bt=l("img"),fn=m(),rs=l("figcaption"),mn=n("ensemble of expert denoisers"),Wa=m(),ke=l("p"),cn=n("The refiner model can also be used for inpainting in the "),ps=l("a"),dn=n("StableDiffusionXLInpaintPipeline"),un=n(":"),Ga=m(),u(gt.$$.fragment),ka=m(),fs=l("p"),hn=n("This ensemble of expert denoisers method works well for all available schedulers!"),$a=m(),ie=l("h3"),$e=l("a"),ml=l("span"),u(Mt.$$.fragment),yn=m(),cl=l("span"),bn=n("Base to refiner model"),Xa=m(),ms=l("p"),gn=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."),Sa=m(),cs=l("p"),Mn=n("Load the base and refiner models:"),Ba=m(),u(Jt.$$.fragment),Ra=m(),Xe=l("p"),Jn=n("Generate an image from the base model, and set the model output to "),dl=l("strong"),wn=n("latent"),vn=n(" space:"),xa=m(),u(wt.$$.fragment),Va=m(),ds=l("p"),Un=n("Pass the generated image to the refiner model:"),Ca=m(),u(vt.$$.fragment),Na=m(),oe=l("div"),Ut=l("div"),Tt=l("img"),Tn=m(),us=l("figcaption"),Zn=n("base model"),_n=m(),Zt=l("div"),_t=l("img"),jn=m(),hs=l("figcaption"),En=n("base model + refiner model"),Ya=m(),N=l("p"),In=n("For inpainting, load the refiner model in the "),ys=l("a"),Wn=n("StableDiffusionXLInpaintPipeline"),Gn=n(", remove the "),ul=l("code"),kn=n("denoising_end"),$n=n(" and "),hl=l("code"),Xn=n("denoising_start"),Sn=n(" parameters, and choose a smaller number of inference steps for the refiner."),Qa=m(),ne=l("h2"),Se=l("a"),yl=l("span"),u(jt.$$.fragment),Bn=m(),bl=l("span"),Rn=n("Micro-conditioning"),Da=m(),Be=l("p"),xn=n("SDXL training involves several additional conditioning techniques, which are referred to as "),gl=l("em"),Vn=n("micro-conditioning"),Cn=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."),za=m(),u(Re.$$.fragment),Fa=m(),re=l("h3"),xe=l("a"),Ml=l("span"),u(Et.$$.fragment),Nn=m(),Jl=l("span"),Yn=n("Size conditioning"),Aa=m(),bs=l("p"),Qn=n("There are two types of size conditioning:"),La=m(),Ve=l("ul"),wl=l("li"),Y=l("p"),It=l("a"),vl=l("code"),Dn=n("original_size"),zn=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 "),Ul=l("code"),Fn=n("original_size"),An=n(" to indicate the original image resolution. Using the default value of "),Tl=l("code"),Ln=n("(1024, 1024)"),qn=n(" produces higher-quality images that resemble the 1024x1024 images in the dataset. If you choose to use a lower resolution, such as "),Zl=l("code"),Hn=n("(256, 256)"),Pn=n(", the model still generates 1024x1024 images, but they\u2019ll look like the low resolution images (simpler patterns, blurring) in the dataset."),On=m(),_l=l("li"),Q=l("p"),Wt=l("a"),jl=l("code"),Kn=n("target_size"),er=n(" conditioning comes from finetuning SDXL to support different image aspect ratios. During inference, if you use the default value of "),El=l("code"),tr=n("(1024, 1024)"),sr=n(", you\u2019ll get an image that resembles the composition of square images in the dataset. We recommend using the same value for "),Il=l("code"),lr=n("target_size"),ar=n(" and "),Wl=l("code"),ir=n("original_size"),or=n(", but feel free to experiment with other options!"),qa=m(),gs=l("p"),nr=n("\u{1F917} Diffusers also lets you specify negative conditions about an image\u2019s size to steer generation away from certain image resolutions:"),Ha=m(),u(Gt.$$.fragment),Pa=m(),pe=l("div"),Gl=l("img"),rr=m(),Ms=l("figcaption"),pr=n("Images negative conditioned on image resolutions of (128, 128), (256, 256), and (512, 512)."),Oa=m(),fe=l("h3"),Ce=l("a"),kl=l("span"),u(kt.$$.fragment),fr=m(),$l=l("span"),mr=n("Crop conditioning"),Ka=m(),L=l("p"),cr=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 "),Xl=l("em"),dr=n("learns"),ur=n(" that no cropping - coordinates "),Sl=l("code"),hr=n("(0, 0)"),yr=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!"),ei=m(),u($t.$$.fragment),ti=m(),Xt=l("div"),Js=l("img"),si=m(),ws=l("p"),br=n("You can also specify negative cropping coordinates to steer generation away from certain cropping parameters:"),li=m(),u(St.$$.fragment),ai=m(),me=l("h2"),Ne=l("a"),Bl=l("span"),u(Bt.$$.fragment),gr=m(),Rl=l("span"),Mr=n("Use a different prompt for each text-encoder"),ii=m(),S=l("p"),Jr=n("SDXL uses two text-encoders, so it is possible to pass a different prompt to each text-encoder, which can "),Rt=l("a"),wr=n("improve quality"),vr=n(". Pass your original prompt to "),xl=l("code"),Ur=n("prompt"),Tr=n(" and the second prompt to "),Vl=l("code"),Zr=n("prompt_2"),_r=n(" (use "),Cl=l("code"),jr=n("negative_prompt"),Er=n(" and "),Nl=l("code"),Ir=n("negative_prompt_2"),Wr=n(" if you\u2019re using a negative prompts):"),oi=m(),u(xt.$$.fragment),ni=m(),Vt=l("div"),vs=l("img"),ri=m(),ce=l("h2"),Ye=l("a"),Yl=l("span"),u(Ct.$$.fragment),Gr=m(),Ql=l("span"),kr=n("Optimizations"),pi=m(),Us=l("p"),$r=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."),fi=m(),Ts=l("ol"),Nt=l("li"),Xr=n("Offload the model to the CPU with "),Zs=l("a"),Sr=n("enable_model_cpu_offload()"),Br=n(" for out-of-memory errors:"),mi=m(),u(Yt.$$.fragment),ci=m(),Qt=l("ol"),de=l("li"),Rr=n("Use "),Dl=l("code"),xr=n("torch.compile"),Vr=n(" for ~20% speed-up (you need "),zl=l("code"),Cr=n("torch>2.0"),Nr=n("):"),di=m(),u(Dt.$$.fragment),ui=m(),zt=l("ol"),ue=l("li"),Yr=n("Enable "),_s=l("a"),Qr=n("xFormers"),Dr=n(" to run SDXL if "),Fl=l("code"),zr=n("torch<2.0"),Fr=n(":"),hi=m(),u(Ft.$$.fragment),yi=m(),he=l("h2"),Qe=l("a"),Al=l("span"),u(At.$$.fragment),Ar=m(),Ll=l("span"),Lr=n("Other resources"),bi=m(),q=l("p"),qr=n("If you\u2019re interested in experimenting with a minimal version of the "),js=l("a"),Hr=n("UNet2DConditionModel"),Pr=n(" used in SDXL, take a look at the "),Lt=l("a"),Or=n("minSDXL"),Kr=n(" implementation which is written in PyTorch and directly compatible with \u{1F917} Diffusers."),this.h()},l(e){const o=Gm('[data-svelte="svelte-1phssyn"]',document.head);d=a(o,"META",{name:!0,content:!0}),o.forEach(s),$=c(e),w=a(e,"H1",{class:!0});var qt=i(w);Z=a(qt,"A",{id:!0,class:!0,href:!0});var ql=i(Z);G=a(ql,"SPAN",{});var Hl=i(G);h(v.$$.fragment,Hl),Hl.forEach(s),ql.forEach(s),j=c(qt),I=a(qt,"SPAN",{});var cp=i(I);J=r(cp,"Stable Diffusion XL"),cp.forEach(s),qt.forEach(s),T=c(e),h(W.$$.fragment,e),k=c(e),U=a(e,"P",{});var ep=i(U);B=a(ep,"A",{href:!0,rel:!0});var dp=i(B);V=r(dp,"Stable Diffusion XL"),dp.forEach(s),E=r(ep," (SDXL) is a powerful text-to-image generation model that iterates on the previous Stable Diffusion models in three key ways:"),ep.forEach(s),Fe=c(e),x=a(e,"OL",{});var Es=i(x);Me=a(Es,"LI",{});var up=i(Me);Ht=r(up,"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"),up.forEach(s),Li=c(Es),Bs=a(Es,"LI",{});var hp=i(Bs);qi=r(hp,"introduces size and crop-conditioning to preserve training data from being discarded and gain more control over how a generated image should be cropped"),hp.forEach(s),Hi=c(Es),P=a(Es,"LI",{});var Is=i(P);Pi=r(Is,"introduces a two-stage model process; the "),Rs=a(Is,"EM",{});var yp=i(Rs);Oi=r(yp,"base"),yp.forEach(s),Ki=r(Is," model (can also be run as a standalone model) generates an image as an input to the "),xs=a(Is,"EM",{});var bp=i(xs);eo=r(bp,"refiner"),bp.forEach(s),to=r(Is," model which adds additional high-quality details"),Is.forEach(s),Es.forEach(s),Pl=c(e),Pt=a(e,"P",{});var gp=i(Pt);so=r(gp,"This guide will show you how to use SDXL for text-to-image, image-to-image, and inpainting."),gp.forEach(s),Ol=c(e),Ot=a(e,"P",{});var Mp=i(Ot);lo=r(Mp,"Before you begin, make sure you have the following libraries installed:"),Mp.forEach(s),Kl=c(e),h(Ae.$$.fragment,e),ea=c(e),h(Je.$$.fragment,e),ta=c(e),O=a(e,"H2",{class:!0});var Mi=i(O);we=a(Mi,"A",{id:!0,class:!0,href:!0});var Jp=i(we);Vs=a(Jp,"SPAN",{});var wp=i(Vs);h(Le.$$.fragment,wp),wp.forEach(s),Jp.forEach(s),ao=c(Mi),Cs=a(Mi,"SPAN",{});var vp=i(Cs);io=r(vp,"Load model checkpoints"),vp.forEach(s),Mi.forEach(s),sa=c(e),ve=a(e,"P",{});var Ji=i(ve);oo=r(Ji,"Model weights may be stored in separate subfolders on the Hub or locally, in which case, you should use the "),Kt=a(Ji,"A",{href:!0});var Up=i(Kt);no=r(Up,"from_pretrained()"),Up.forEach(s),ro=r(Ji," method:"),Ji.forEach(s),la=c(e),h(qe.$$.fragment,e),aa=c(e),C=a(e,"P",{});var De=i(C);po=r(De,"You can also use the "),es=a(De,"A",{href:!0});var Tp=i(es);fo=r(Tp,"from_single_file()"),Tp.forEach(s),mo=r(De," method to load a model checkpoint stored in a single file format ("),Ns=a(De,"CODE",{});var Zp=i(Ns);co=r(Zp,".ckpt"),Zp.forEach(s),uo=r(De," or "),Ys=a(De,"CODE",{});var _p=i(Ys);ho=r(_p,".safetensors"),_p.forEach(s),yo=r(De,") from the Hub or locally:"),De.forEach(s),ia=c(e),h(He.$$.fragment,e),oa=c(e),K=a(e,"H2",{class:!0});var wi=i(K);Ue=a(wi,"A",{id:!0,class:!0,href:!0});var jp=i(Ue);Qs=a(jp,"SPAN",{});var Ep=i(Qs);h(Pe.$$.fragment,Ep),Ep.forEach(s),jp.forEach(s),bo=c(wi),Ds=a(wi,"SPAN",{});var Ip=i(Ds);go=r(Ip,"Text-to-image"),Ip.forEach(s),wi.forEach(s),na=c(e),F=a(e,"P",{});var Ws=i(F);Mo=r(Ws,"For text-to-image, pass a text prompt. By default, SDXL generates a 1024x1024 image for the best results. You can try setting the "),zs=a(Ws,"CODE",{});var Wp=i(zs);Jo=r(Wp,"height"),Wp.forEach(s),wo=r(Ws," and "),Fs=a(Ws,"CODE",{});var Gp=i(Fs);vo=r(Gp,"width"),Gp.forEach(s),Uo=r(Ws," parameters to 768x768 or 512x512, but anything below 512x512 is not likely to work."),Ws.forEach(s),ra=c(e),h(Oe.$$.fragment,e),pa=c(e),Ke=a(e,"DIV",{class:!0});var kp=i(Ke);ts=a(kp,"IMG",{src:!0,alt:!0}),kp.forEach(s),fa=c(e),ee=a(e,"H2",{class:!0});var vi=i(ee);Te=a(vi,"A",{id:!0,class:!0,href:!0});var $p=i(Te);As=a($p,"SPAN",{});var Xp=i(As);h(et.$$.fragment,Xp),Xp.forEach(s),$p.forEach(s),To=c(vi),Ls=a(vi,"SPAN",{});var Sp=i(Ls);Zo=r(Sp,"Image-to-image"),Sp.forEach(s),vi.forEach(s),ma=c(e),ss=a(e,"P",{});var Bp=i(ss);_o=r(Bp,"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:"),Bp.forEach(s),ca=c(e),h(tt.$$.fragment,e),da=c(e),st=a(e,"DIV",{class:!0});var Rp=i(st);ls=a(Rp,"IMG",{src:!0,alt:!0}),Rp.forEach(s),ua=c(e),te=a(e,"H2",{class:!0});var Ui=i(te);Ze=a(Ui,"A",{id:!0,class:!0,href:!0});var xp=i(Ze);qs=a(xp,"SPAN",{});var Vp=i(qs);h(lt.$$.fragment,Vp),Vp.forEach(s),xp.forEach(s),jo=c(Ui),Hs=a(Ui,"SPAN",{});var Cp=i(Hs);Eo=r(Cp,"Inpainting"),Cp.forEach(s),Ui.forEach(s),ha=c(e),as=a(e,"P",{});var Np=i(as);Io=r(Np,"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."),Np.forEach(s),ya=c(e),h(at.$$.fragment,e),ba=c(e),it=a(e,"DIV",{class:!0});var Yp=i(it);is=a(Yp,"IMG",{src:!0,alt:!0}),Yp.forEach(s),ga=c(e),se=a(e,"H2",{class:!0});var Ti=i(se);_e=a(Ti,"A",{id:!0,class:!0,href:!0});var Qp=i(_e);Ps=a(Qp,"SPAN",{});var Dp=i(Ps);h(ot.$$.fragment,Dp),Dp.forEach(s),Qp.forEach(s),Wo=c(Ti),Os=a(Ti,"SPAN",{});var zp=i(Os);Go=r(zp,"Refine image quality"),zp.forEach(s),Ti.forEach(s),Ma=c(e),je=a(e,"P",{});var Zi=i(je);ko=r(Zi,"SDXL includes a "),nt=a(Zi,"A",{href:!0,rel:!0});var Fp=i(nt);$o=r(Fp,"refiner model"),Fp.forEach(s),Xo=r(Zi," specialized in denoising low-noise stage images to generate higher-quality images from the base model. There are two ways to use the refiner:"),Zi.forEach(s),Ja=c(e),Ee=a(e,"OL",{});var _i=i(Ee);Ks=a(_i,"LI",{});var Ap=i(Ks);So=r(Ap,"use the base and refiner model together to produce a refined image"),Ap.forEach(s),Bo=c(_i),el=a(_i,"LI",{});var Lp=i(el);Ro=r(Lp,"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)"),Lp.forEach(s),_i.forEach(s),wa=c(e),le=a(e,"H3",{class:!0});var ji=i(le);Ie=a(ji,"A",{id:!0,class:!0,href:!0});var qp=i(Ie);tl=a(qp,"SPAN",{});var Hp=i(tl);h(rt.$$.fragment,Hp),Hp.forEach(s),qp.forEach(s),xo=c(ji),sl=a(ji,"SPAN",{});var Pp=i(sl);Vo=r(Pp,"Base + refiner model"),Pp.forEach(s),ji.forEach(s),va=c(e),We=a(e,"P",{});var Ei=i(We);Co=r(Ei,"When you use the base and refiner model together to generate an image, this is known as an ("),pt=a(Ei,"A",{href:!0,rel:!0});var Op=i(pt);ll=a(Op,"EM",{});var Kp=i(ll);No=r(Kp,"ensemble of expert denoisers"),Kp.forEach(s),Op.forEach(s),Yo=r(Ei,"). 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."),Ei.forEach(s),Ua=c(e),os=a(e,"P",{});var ef=i(os);Qo=r(ef,"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:"),ef.forEach(s),Ta=c(e),h(ft.$$.fragment,e),Za=c(e),A=a(e,"P",{});var Gs=i(A);Do=r(Gs,"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(Gs,"A",{href:!0,rel:!0});var tf=i(mt);al=a(tf,"CODE",{});var sf=i(al);zo=r(sf,"denoising_end"),sf.forEach(s),tf.forEach(s),Fo=r(Gs," parameter and for the refiner model, it is controlled by the "),ct=a(Gs,"A",{href:!0,rel:!0});var lf=i(ct);il=a(lf,"CODE",{});var af=i(il);Ao=r(af,"denoising_start"),af.forEach(s),lf.forEach(s),Lo=r(Gs," parameter."),Gs.forEach(s),_a=c(e),h(Ge.$$.fragment,e),ja=c(e),X=a(e,"P",{});var D=i(X);qo=r(D,"Let\u2019s set "),ol=a(D,"CODE",{});var of=i(ol);Ho=r(of,"denoising_end=0.8"),of.forEach(s),Po=r(D," so the base model performs the first 80% of denoising the "),nl=a(D,"STRONG",{});var nf=i(nl);Oo=r(nf,"high-noise"),nf.forEach(s),Ko=r(D," timesteps and set "),rl=a(D,"CODE",{});var rf=i(rl);en=r(rf,"denoising_start=0.8"),rf.forEach(s),tn=r(D," so the refiner model performs the last 20% of denoising the "),pl=a(D,"STRONG",{});var pf=i(pl);sn=r(pf,"low-noise"),pf.forEach(s),ln=r(D," timesteps. The base model output should be in "),fl=a(D,"STRONG",{});var ff=i(fl);an=r(ff,"latent"),ff.forEach(s),on=r(D," space instead of a PIL image."),D.forEach(s),Ea=c(e),h(dt.$$.fragment,e),Ia=c(e),ae=a(e,"DIV",{class:!0});var Ii=i(ae);ut=a(Ii,"DIV",{});var Wi=i(ut);ht=a(Wi,"IMG",{class:!0,src:!0,alt:!0}),nn=c(Wi),ns=a(Wi,"FIGCAPTION",{class:!0});var mf=i(ns);rn=r(mf,"base model"),mf.forEach(s),Wi.forEach(s),pn=c(Ii),yt=a(Ii,"DIV",{});var Gi=i(yt);bt=a(Gi,"IMG",{class:!0,src:!0,alt:!0}),fn=c(Gi),rs=a(Gi,"FIGCAPTION",{class:!0});var cf=i(rs);mn=r(cf,"ensemble of expert denoisers"),cf.forEach(s),Gi.forEach(s),Ii.forEach(s),Wa=c(e),ke=a(e,"P",{});var ki=i(ke);cn=r(ki,"The refiner model can also be used for inpainting in the "),ps=a(ki,"A",{href:!0});var df=i(ps);dn=r(df,"StableDiffusionXLInpaintPipeline"),df.forEach(s),un=r(ki,":"),ki.forEach(s),Ga=c(e),h(gt.$$.fragment,e),ka=c(e),fs=a(e,"P",{});var uf=i(fs);hn=r(uf,"This ensemble of expert denoisers method works well for all available schedulers!"),uf.forEach(s),$a=c(e),ie=a(e,"H3",{class:!0});var $i=i(ie);$e=a($i,"A",{id:!0,class:!0,href:!0});var hf=i($e);ml=a(hf,"SPAN",{});var yf=i(ml);h(Mt.$$.fragment,yf),yf.forEach(s),hf.forEach(s),yn=c($i),cl=a($i,"SPAN",{});var bf=i(cl);bn=r(bf,"Base to refiner model"),bf.forEach(s),$i.forEach(s),Xa=c(e),ms=a(e,"P",{});var gf=i(ms);gn=r(gf,"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."),gf.forEach(s),Sa=c(e),cs=a(e,"P",{});var Mf=i(cs);Mn=r(Mf,"Load the base and refiner models:"),Mf.forEach(s),Ba=c(e),h(Jt.$$.fragment,e),Ra=c(e),Xe=a(e,"P",{});var Xi=i(Xe);Jn=r(Xi,"Generate an image from the base model, and set the model output to "),dl=a(Xi,"STRONG",{});var Jf=i(dl);wn=r(Jf,"latent"),Jf.forEach(s),vn=r(Xi," space:"),Xi.forEach(s),xa=c(e),h(wt.$$.fragment,e),Va=c(e),ds=a(e,"P",{});var wf=i(ds);Un=r(wf,"Pass the generated image to the refiner model:"),wf.forEach(s),Ca=c(e),h(vt.$$.fragment,e),Na=c(e),oe=a(e,"DIV",{class:!0});var Si=i(oe);Ut=a(Si,"DIV",{});var Bi=i(Ut);Tt=a(Bi,"IMG",{class:!0,src:!0,alt:!0}),Tn=c(Bi),us=a(Bi,"FIGCAPTION",{class:!0});var vf=i(us);Zn=r(vf,"base model"),vf.forEach(s),Bi.forEach(s),_n=c(Si),Zt=a(Si,"DIV",{});var Ri=i(Zt);_t=a(Ri,"IMG",{class:!0,src:!0,alt:!0}),jn=c(Ri),hs=a(Ri,"FIGCAPTION",{class:!0});var Uf=i(hs);En=r(Uf,"base model + refiner model"),Uf.forEach(s),Ri.forEach(s),Si.forEach(s),Ya=c(e),N=a(e,"P",{});var ze=i(N);In=r(ze,"For inpainting, load the refiner model in the "),ys=a(ze,"A",{href:!0});var Tf=i(ys);Wn=r(Tf,"StableDiffusionXLInpaintPipeline"),Tf.forEach(s),Gn=r(ze,", remove the "),ul=a(ze,"CODE",{});var Zf=i(ul);kn=r(Zf,"denoising_end"),Zf.forEach(s),$n=r(ze," and "),hl=a(ze,"CODE",{});var _f=i(hl);Xn=r(_f,"denoising_start"),_f.forEach(s),Sn=r(ze," parameters, and choose a smaller number of inference steps for the refiner."),ze.forEach(s),Qa=c(e),ne=a(e,"H2",{class:!0});var xi=i(ne);Se=a(xi,"A",{id:!0,class:!0,href:!0});var jf=i(Se);yl=a(jf,"SPAN",{});var Ef=i(yl);h(jt.$$.fragment,Ef),Ef.forEach(s),jf.forEach(s),Bn=c(xi),bl=a(xi,"SPAN",{});var If=i(bl);Rn=r(If,"Micro-conditioning"),If.forEach(s),xi.forEach(s),Da=c(e),Be=a(e,"P",{});var Vi=i(Be);xn=r(Vi,"SDXL training involves several additional conditioning techniques, which are referred to as "),gl=a(Vi,"EM",{});var Wf=i(gl);Vn=r(Wf,"micro-conditioning"),Wf.forEach(s),Cn=r(Vi,". 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."),Vi.forEach(s),za=c(e),h(Re.$$.fragment,e),Fa=c(e),re=a(e,"H3",{class:!0});var Ci=i(re);xe=a(Ci,"A",{id:!0,class:!0,href:!0});var Gf=i(xe);Ml=a(Gf,"SPAN",{});var kf=i(Ml);h(Et.$$.fragment,kf),kf.forEach(s),Gf.forEach(s),Nn=c(Ci),Jl=a(Ci,"SPAN",{});var $f=i(Jl);Yn=r($f,"Size conditioning"),$f.forEach(s),Ci.forEach(s),Aa=c(e),bs=a(e,"P",{});var Xf=i(bs);Qn=r(Xf,"There are two types of size conditioning:"),Xf.forEach(s),La=c(e),Ve=a(e,"UL",{});var Ni=i(Ve);wl=a(Ni,"LI",{});var Sf=i(wl);Y=a(Sf,"P",{});var ye=i(Y);It=a(ye,"A",{href:!0,rel:!0});var Bf=i(It);vl=a(Bf,"CODE",{});var Rf=i(vl);Dn=r(Rf,"original_size"),Rf.forEach(s),Bf.forEach(s),zn=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 "),Ul=a(ye,"CODE",{});var xf=i(Ul);Fn=r(xf,"original_size"),xf.forEach(s),An=r(ye," to indicate the original image resolution. Using the default value of "),Tl=a(ye,"CODE",{});var Vf=i(Tl);Ln=r(Vf,"(1024, 1024)"),Vf.forEach(s),qn=r(ye," produces higher-quality images that resemble the 1024x1024 images in the dataset. If you choose to use a lower resolution, such as "),Zl=a(ye,"CODE",{});var Cf=i(Zl);Hn=r(Cf,"(256, 256)"),Cf.forEach(s),Pn=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(s),Sf.forEach(s),On=c(Ni),_l=a(Ni,"LI",{});var Nf=i(_l);Q=a(Nf,"P",{});var be=i(Q);Wt=a(be,"A",{href:!0,rel:!0});var Yf=i(Wt);jl=a(Yf,"CODE",{});var Qf=i(jl);Kn=r(Qf,"target_size"),Qf.forEach(s),Yf.forEach(s),er=r(be," conditioning comes from finetuning SDXL to support different image aspect ratios. During inference, if you use the default value of "),El=a(be,"CODE",{});var Df=i(El);tr=r(Df,"(1024, 1024)"),Df.forEach(s),sr=r(be,", you\u2019ll get an image that resembles the composition of square images in the dataset. We recommend using the same value for "),Il=a(be,"CODE",{});var zf=i(Il);lr=r(zf,"target_size"),zf.forEach(s),ar=r(be," and "),Wl=a(be,"CODE",{});var Ff=i(Wl);ir=r(Ff,"original_size"),Ff.forEach(s),or=r(be,", but feel free to experiment with other options!"),be.forEach(s),Nf.forEach(s),Ni.forEach(s),qa=c(e),gs=a(e,"P",{});var Af=i(gs);nr=r(Af,"\u{1F917} Diffusers also lets you specify negative conditions about an image\u2019s size to steer generation away from certain image resolutions:"),Af.forEach(s),Ha=c(e),h(Gt.$$.fragment,e),Pa=c(e),pe=a(e,"DIV",{class:!0});var Yi=i(pe);Gl=a(Yi,"IMG",{src:!0}),rr=c(Yi),Ms=a(Yi,"FIGCAPTION",{class:!0});var Lf=i(Ms);pr=r(Lf,"Images negative conditioned on image resolutions of (128, 128), (256, 256), and (512, 512)."),Lf.forEach(s),Yi.forEach(s),Oa=c(e),fe=a(e,"H3",{class:!0});var Qi=i(fe);Ce=a(Qi,"A",{id:!0,class:!0,href:!0});var qf=i(Ce);kl=a(qf,"SPAN",{});var Hf=i(kl);h(kt.$$.fragment,Hf),Hf.forEach(s),qf.forEach(s),fr=c(Qi),$l=a(Qi,"SPAN",{});var Pf=i($l);mr=r(Pf,"Crop conditioning"),Pf.forEach(s),Qi.forEach(s),Ka=c(e),L=a(e,"P",{});var ks=i(L);cr=r(ks,"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 "),Xl=a(ks,"EM",{});var Of=i(Xl);dr=r(Of,"learns"),Of.forEach(s),ur=r(ks," that no cropping - coordinates "),Sl=a(ks,"CODE",{});var Kf=i(Sl);hr=r(Kf,"(0, 0)"),Kf.forEach(s),yr=r(ks," - 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!"),ks.forEach(s),ei=c(e),h($t.$$.fragment,e),ti=c(e),Xt=a(e,"DIV",{class:!0});var em=i(Xt);Js=a(em,"IMG",{src:!0,alt:!0}),em.forEach(s),si=c(e),ws=a(e,"P",{});var tm=i(ws);br=r(tm,"You can also specify negative cropping coordinates to steer generation away from certain cropping parameters:"),tm.forEach(s),li=c(e),h(St.$$.fragment,e),ai=c(e),me=a(e,"H2",{class:!0});var Di=i(me);Ne=a(Di,"A",{id:!0,class:!0,href:!0});var sm=i(Ne);Bl=a(sm,"SPAN",{});var lm=i(Bl);h(Bt.$$.fragment,lm),lm.forEach(s),sm.forEach(s),gr=c(Di),Rl=a(Di,"SPAN",{});var am=i(Rl);Mr=r(am,"Use a different prompt for each text-encoder"),am.forEach(s),Di.forEach(s),ii=c(e),S=a(e,"P",{});var z=i(S);Jr=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 im=i(Rt);wr=r(im,"improve quality"),im.forEach(s),vr=r(z,". Pass your original prompt to "),xl=a(z,"CODE",{});var om=i(xl);Ur=r(om,"prompt"),om.forEach(s),Tr=r(z," and the second prompt to "),Vl=a(z,"CODE",{});var nm=i(Vl);Zr=r(nm,"prompt_2"),nm.forEach(s),_r=r(z," (use "),Cl=a(z,"CODE",{});var rm=i(Cl);jr=r(rm,"negative_prompt"),rm.forEach(s),Er=r(z," and "),Nl=a(z,"CODE",{});var pm=i(Nl);Ir=r(pm,"negative_prompt_2"),pm.forEach(s),Wr=r(z," if you\u2019re using a negative prompts):"),z.forEach(s),oi=c(e),h(xt.$$.fragment,e),ni=c(e),Vt=a(e,"DIV",{class:!0});var fm=i(Vt);vs=a(fm,"IMG",{src:!0,alt:!0}),fm.forEach(s),ri=c(e),ce=a(e,"H2",{class:!0});var zi=i(ce);Ye=a(zi,"A",{id:!0,class:!0,href:!0});var mm=i(Ye);Yl=a(mm,"SPAN",{});var cm=i(Yl);h(Ct.$$.fragment,cm),cm.forEach(s),mm.forEach(s),Gr=c(zi),Ql=a(zi,"SPAN",{});var dm=i(Ql);kr=r(dm,"Optimizations"),dm.forEach(s),zi.forEach(s),pi=c(e),Us=a(e,"P",{});var um=i(Us);$r=r(um,"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."),um.forEach(s),fi=c(e),Ts=a(e,"OL",{});var hm=i(Ts);Nt=a(hm,"LI",{});var Fi=i(Nt);Xr=r(Fi,"Offload the model to the CPU with "),Zs=a(Fi,"A",{href:!0});var ym=i(Zs);Sr=r(ym,"enable_model_cpu_offload()"),ym.forEach(s),Br=r(Fi," for out-of-memory errors:"),Fi.forEach(s),hm.forEach(s),mi=c(e),h(Yt.$$.fragment,e),ci=c(e),Qt=a(e,"OL",{start:!0});var bm=i(Qt);de=a(bm,"LI",{});var $s=i(de);Rr=r($s,"Use "),Dl=a($s,"CODE",{});var gm=i(Dl);xr=r(gm,"torch.compile"),gm.forEach(s),Vr=r($s," for ~20% speed-up (you need "),zl=a($s,"CODE",{});var Mm=i(zl);Cr=r(Mm,"torch>2.0"),Mm.forEach(s),Nr=r($s,"):"),$s.forEach(s),bm.forEach(s),di=c(e),h(Dt.$$.fragment,e),ui=c(e),zt=a(e,"OL",{start:!0});var Jm=i(zt);ue=a(Jm,"LI",{});var Xs=i(ue);Yr=r(Xs,"Enable "),_s=a(Xs,"A",{href:!0});var wm=i(_s);Qr=r(wm,"xFormers"),wm.forEach(s),Dr=r(Xs," to run SDXL if "),Fl=a(Xs,"CODE",{});var vm=i(Fl);zr=r(vm,"torch<2.0"),vm.forEach(s),Fr=r(Xs,":"),Xs.forEach(s),Jm.forEach(s),hi=c(e),h(Ft.$$.fragment,e),yi=c(e),he=a(e,"H2",{class:!0});var Ai=i(he);Qe=a(Ai,"A",{id:!0,class:!0,href:!0});var Um=i(Qe);Al=a(Um,"SPAN",{});var Tm=i(Al);h(At.$$.fragment,Tm),Tm.forEach(s),Um.forEach(s),Ar=c(Ai),Ll=a(Ai,"SPAN",{});var Zm=i(Ll);Lr=r(Zm,"Other resources"),Zm.forEach(s),Ai.forEach(s),bi=c(e),q=a(e,"P",{});var Ss=i(q);qr=r(Ss,"If you\u2019re interested in experimenting with a minimal version of the "),js=a(Ss,"A",{href:!0});var _m=i(js);Hr=r(_m,"UNet2DConditionModel"),_m.forEach(s),Pr=r(Ss," used in SDXL, take a look at the "),Lt=a(Ss,"A",{href:!0,rel:!0});var jm=i(Lt);Or=r(jm,"minSDXL"),jm.forEach(s),Kr=r(Ss," implementation which is written in PyTorch and directly compatible with \u{1F917} Diffusers."),Ss.forEach(s),this.h()},h(){f(d,"name","hf:doc:metadata"),f(d,"content",JSON.stringify(Vm)),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/v0.21.0/en/api/pipelines/overview#diffusers.DiffusionPipeline.from_pretrained"),f(es,"href","/docs/diffusers/v0.21.0/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline.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,sp="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-text2img.png")||f(ts,"src",sp),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,lp="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-img2img.png")||f(ls,"src",lp),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,ap="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-inpaint.png")||f(is,"src",ap),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,ip="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/lion_base.png")||f(ht,"src",ip),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,op="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/lion_refined.png")||f(bt,"src",op),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/v0.21.0/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,np="https://huggingface.co/datasets/diffusers/docs-images/resolve/main/sd_xl/init_image.png")||f(Tt,"src",np),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,rp="https://huggingface.co/datasets/diffusers/docs-images/resolve/main/sd_xl/refined_image.png")||f(_t,"src",rp),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/v0.21.0/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(Gl.src,pp="https://huggingface.co/datasets/diffusers/docs-images/resolve/main/sd_xl/negative_conditions.png")||f(Gl,"src",pp),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,fp="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-cropped.png")||f(Js,"src",fp),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,mp="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/sdxl-double-prompt.png")||f(vs,"src",mp),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(Zs,"href","/docs/diffusers/v0.21.0/en/api/pipelines/stable_diffusion/gligen#diffusers.StableDiffusionGLIGENTextImagePipeline.enable_model_cpu_offload"),f(Qt,"start","2"),f(_s,"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(js,"href","/docs/diffusers/v0.21.0/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel"),f(Lt,"href","https://github.com/cloneofsimo/minSDXL"),f(Lt,"rel","nofollow")},m(e,o){t(document.head,d),p(e,$,o),p(e,w,o),t(w,Z),t(Z,G),y(v,G,null),t(w,j),t(w,I),t(I,J),p(e,T,o),y(W,e,o),p(e,k,o),p(e,U,o),t(U,B),t(B,V),t(U,E),p(e,Fe,o),p(e,x,o),t(x,Me),t(Me,Ht),t(x,Li),t(x,Bs),t(Bs,qi),t(x,Hi),t(x,P),t(P,Pi),t(P,Rs),t(Rs,Oi),t(P,Ki),t(P,xs),t(xs,eo),t(P,to),p(e,Pl,o),p(e,Pt,o),t(Pt,so),p(e,Ol,o),p(e,Ot,o),t(Ot,lo),p(e,Kl,o),y(Ae,e,o),p(e,ea,o),y(Je,e,o),p(e,ta,o),p(e,O,o),t(O,we),t(we,Vs),y(Le,Vs,null),t(O,ao),t(O,Cs),t(Cs,io),p(e,sa,o),p(e,ve,o),t(ve,oo),t(ve,Kt),t(Kt,no),t(ve,ro),p(e,la,o),y(qe,e,o),p(e,aa,o),p(e,C,o),t(C,po),t(C,es),t(es,fo),t(C,mo),t(C,Ns),t(Ns,co),t(C,uo),t(C,Ys),t(Ys,ho),t(C,yo),p(e,ia,o),y(He,e,o),p(e,oa,o),p(e,K,o),t(K,Ue),t(Ue,Qs),y(Pe,Qs,null),t(K,bo),t(K,Ds),t(Ds,go),p(e,na,o),p(e,F,o),t(F,Mo),t(F,zs),t(zs,Jo),t(F,wo),t(F,Fs),t(Fs,vo),t(F,Uo),p(e,ra,o),y(Oe,e,o),p(e,pa,o),p(e,Ke,o),t(Ke,ts),p(e,fa,o),p(e,ee,o),t(ee,Te),t(Te,As),y(et,As,null),t(ee,To),t(ee,Ls),t(Ls,Zo),p(e,ma,o),p(e,ss,o),t(ss,_o),p(e,ca,o),y(tt,e,o),p(e,da,o),p(e,st,o),t(st,ls),p(e,ua,o),p(e,te,o),t(te,Ze),t(Ze,qs),y(lt,qs,null),t(te,jo),t(te,Hs),t(Hs,Eo),p(e,ha,o),p(e,as,o),t(as,Io),p(e,ya,o),y(at,e,o),p(e,ba,o),p(e,it,o),t(it,is),p(e,ga,o),p(e,se,o),t(se,_e),t(_e,Ps),y(ot,Ps,null),t(se,Wo),t(se,Os),t(Os,Go),p(e,Ma,o),p(e,je,o),t(je,ko),t(je,nt),t(nt,$o),t(je,Xo),p(e,Ja,o),p(e,Ee,o),t(Ee,Ks),t(Ks,So),t(Ee,Bo),t(Ee,el),t(el,Ro),p(e,wa,o),p(e,le,o),t(le,Ie),t(Ie,tl),y(rt,tl,null),t(le,xo),t(le,sl),t(sl,Vo),p(e,va,o),p(e,We,o),t(We,Co),t(We,pt),t(pt,ll),t(ll,No),t(We,Yo),p(e,Ua,o),p(e,os,o),t(os,Qo),p(e,Ta,o),y(ft,e,o),p(e,Za,o),p(e,A,o),t(A,Do),t(A,mt),t(mt,al),t(al,zo),t(A,Fo),t(A,ct),t(ct,il),t(il,Ao),t(A,Lo),p(e,_a,o),y(Ge,e,o),p(e,ja,o),p(e,X,o),t(X,qo),t(X,ol),t(ol,Ho),t(X,Po),t(X,nl),t(nl,Oo),t(X,Ko),t(X,rl),t(rl,en),t(X,tn),t(X,pl),t(pl,sn),t(X,ln),t(X,fl),t(fl,an),t(X,on),p(e,Ea,o),y(dt,e,o),p(e,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),p(e,di,o),y(Dt,e,o),p(e,ui,o),p(e,zt,o),t(zt,ue),t(ue,Yr),t(ue,_s),t(_s,Qr),t(ue,Dr),t(ue,Fl),t(Fl,zr),t(ue,Fr),p(e,hi,o),y(Ft,e,o),p(e,yi,o),p(e,he,o),t(he,Qe),t(Qe,Al),y(At,Al,null),t(he,Ar),t(he,Ll),t(Ll,Lr),p(e,bi,o),p(e,q,o),t(q,qr),t(q,js),t(js,Hr),t(q,Pr),t(q,Lt),t(Lt,Or),t(q,Kr),gi=!0},p(e,[o]){const qt={};o&2&&(qt.$$scope={dirty:o,ctx:e}),Je.$set(qt);const ql={};o&2&&(ql.$$scope={dirty:o,ctx:e}),Ge.$set(ql);const Hl={};o&2&&(Hl.$$scope={dirty:o,ctx:e}),Re.$set(Hl)},i(e){gi||(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),gi=!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),gi=!1},d(e){s(d),e&&s($),e&&s(w),M(v),e&&s(T),M(W,e),e&&s(k),e&&s(U),e&&s(Fe),e&&s(x),e&&s(Pl),e&&s(Pt),e&&s(Ol),e&&s(Ot),e&&s(Kl),M(Ae,e),e&&s(ea),M(Je,e),e&&s(ta),e&&s(O),M(Le),e&&s(sa),e&&s(ve),e&&s(la),M(qe,e),e&&s(aa),e&&s(C),e&&s(ia),M(He,e),e&&s(oa),e&&s(K),M(Pe),e&&s(na),e&&s(F),e&&s(ra),M(Oe,e),e&&s(pa),e&&s(Ke),e&&s(fa),e&&s(ee),M(et),e&&s(ma),e&&s(ss),e&&s(ca),M(tt,e),e&&s(da),e&&s(st),e&&s(ua),e&&s(te),M(lt),e&&s(ha),e&&s(as),e&&s(ya),M(at,e),e&&s(ba),e&&s(it),e&&s(ga),e&&s(se),M(ot),e&&s(Ma),e&&s(je),e&&s(Ja),e&&s(Ee),e&&s(wa),e&&s(le),M(rt),e&&s(va),e&&s(We),e&&s(Ua),e&&s(os),e&&s(Ta),M(ft,e),e&&s(Za),e&&s(A),e&&s(_a),M(Ge,e),e&&s(ja),e&&s(X),e&&s(Ea),M(dt,e),e&&s(Ia),e&&s(ae),e&&s(Wa),e&&s(ke),e&&s(Ga),M(gt,e),e&&s(ka),e&&s(fs),e&&s($a),e&&s(ie),M(Mt),e&&s(Xa),e&&s(ms),e&&s(Sa),e&&s(cs),e&&s(Ba),M(Jt,e),e&&s(Ra),e&&s(Xe),e&&s(xa),M(wt,e),e&&s(Va),e&&s(ds),e&&s(Ca),M(vt,e),e&&s(Na),e&&s(oe),e&&s(Ya),e&&s(N),e&&s(Qa),e&&s(ne),M(jt),e&&s(Da),e&&s(Be),e&&s(za),M(Re,e),e&&s(Fa),e&&s(re),M(Et),e&&s(Aa),e&&s(bs),e&&s(La),e&&s(Ve),e&&s(qa),e&&s(gs),e&&s(Ha),M(Gt,e),e&&s(Pa),e&&s(pe),e&&s(Oa),e&&s(fe),M(kt),e&&s(Ka),e&&s(L),e&&s(ei),M($t,e),e&&s(ti),e&&s(Xt),e&&s(si),e&&s(ws),e&&s(li),M(St,e),e&&s(ai),e&&s(me),M(Bt),e&&s(ii),e&&s(S),e&&s(oi),M(xt,e),e&&s(ni),e&&s(Vt),e&&s(ri),e&&s(ce),M(Ct),e&&s(pi),e&&s(Us),e&&s(fi),e&&s(Ts),e&&s(mi),M(Yt,e),e&&s(ci),e&&s(Qt),e&&s(di),M(Dt,e),e&&s(ui),e&&s(zt),e&&s(hi),M(Ft,e),e&&s(yi),e&&s(he),M(At),e&&s(bi),e&&s(q)}}}const Vm={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 Cm(ge){return km(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Fm extends Em{constructor(d){super();Im(this,d,Cm,xm,Wm,{})}}export{Fm as default,Vm as metadata};

Xet Storage Details

Size:
85.5 kB
·
Xet hash:
0af2c3fe87a3bff5e9a69b25c59ebd1a99df469107276fc4f8869621b32da1e4

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.