import{S as Vm,i as Nm,s as Rm,e as o,k as f,w as u,t as s,M as Dm,c as n,d as t,m as c,a as i,x as h,h as a,b as d,G as l,g as p,y as m,q as y,o as M,B as J,v as $m}from"../../chunks/vendor-hf-doc-builder.js";import{T as Wm}from"../../chunks/Tip-hf-doc-builder.js";import{I as se}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as T}from"../../chunks/CodeBlock-hf-doc-builder.js";function Bm(rt){let w,R,b,_,V,Z,x,N;return{c(){w=o("p"),R=s("\u{1F4A1} Skip to the "),b=o("a"),_=s("DiffusionPipeline explained"),V=s(" section if you interested in learning in more detail about how the "),Z=o("a"),x=s("DiffusionPipeline"),N=s(" class works."),this.h()},l(I){w=n(I,"P",{});var j=i(w);R=a(j,"\u{1F4A1} Skip to the "),b=n(j,"A",{href:!0});var C=i(b);_=a(C,"DiffusionPipeline explained"),C.forEach(t),V=a(j," section if you interested in learning in more detail about how the "),Z=n(j,"A",{href:!0});var ae=i(Z);x=a(ae,"DiffusionPipeline"),ae.forEach(t),N=a(j," class works."),j.forEach(t),this.h()},h(){d(b,"href","#diffusionpipeline-explained"),d(Z,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline")},m(I,j){p(I,w,j),l(w,R),l(w,b),l(b,_),l(w,V),l(w,Z),l(Z,x),l(w,N)},d(I){I&&t(w)}}}function Gm(rt){let w,R,b,_,V,Z,x,N;return{c(){w=o("p"),R=s("\u{1F4A1} When the checkpoints have identical model structures, but they were trained on different datasets and with a different training setup, they should be stored in separate repositories instead of variations (for example, "),b=o("code"),_=s("stable-diffusion-v1-4"),V=s(" and "),Z=o("code"),x=s("stable-diffusion-v1-5"),N=s(").")},l(I){w=n(I,"P",{});var j=i(w);R=a(j,"\u{1F4A1} When the checkpoints have identical model structures, but they were trained on different datasets and with a different training setup, they should be stored in separate repositories instead of variations (for example, "),b=n(j,"CODE",{});var C=i(b);_=a(C,"stable-diffusion-v1-4"),C.forEach(t),V=a(j," and "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ld,Le,Pa,td,sd,St,ad,od,jn,tt,Zn,Ke,nd,st,Ya,id,rd,En,at,_n,Qt,pd,kn,ot,In,le,fd,za,cd,dd,Xt,ud,hd,Cn,te,qt,md,Fa,yd,Md,xt,Jd,Ha,wd,Ud,P,vd,Oa,Td,bd,La,jd,Zd,Ka,Ed,_d,gn,nt,Wn;return Z=new se({}),pl=new se({}),Te=new Wm({props:{$$slots:{default:[Bm]},$$scope:{ctx:rt}}}),cl=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcmVwb19pZCUyMCUzRCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChyZXBvX2lkKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

repo_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
pipe = DiffusionPipeline.from_pretrained(repo_id)`}}),dl=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcmVwb19pZCUyMCUzRCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChyZXBvX2lkKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline

repo_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
pipe = StableDiffusionPipeline.from_pretrained(repo_id)`}}),ml=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvbkltZzJJbWdQaXBlbGluZSUwQSUwQXJlcG9faWQlMjAlM0QlMjAlMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUwQXBpcGUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25JbWcySW1nUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKHJlcG9faWQp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionImg2ImgPipeline

repo_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(repo_id)`}}),yl=new se({}),wl=new T({props:{code:"Z2l0JTIwbGZzJTIwaW5zdGFsbCUwQWdpdCUyMGNsb25lJTIwaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01",highlighted:`git lfs install
git <span class="hljs-built_in">clone</span> https://huggingface.co/runwayml/stable-diffusion-v1-5`}}),Ul=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcmVwb19pZCUyMCUzRCUyMCUyMi4lMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMEFzdGFibGVfZGlmZnVzaW9uJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKHJlcG9faWQp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

repo_id = <span class="hljs-string">&quot;./stable-diffusion-v1-5&quot;</span>
stable_diffusion = DiffusionPipeline.from_pretrained(repo_id)`}}),vl=new se({}),Tl=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcmVwb19pZCUyMCUzRCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBc3RhYmxlX2RpZmZ1c2lvbiUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChyZXBvX2lkKSUwQXN0YWJsZV9kaWZmdXNpb24uc2NoZWR1bGVyLmNvbXBhdGlibGVz",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

repo_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
stable_diffusion = DiffusionPipeline.from_pretrained(repo_id)
stable_diffusion.scheduler.compatibles`}}),jl=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTJDJTIwRXVsZXJEaXNjcmV0ZVNjaGVkdWxlciUyQyUyMERQTVNvbHZlck11bHRpc3RlcFNjaGVkdWxlciUwQSUwQXJlcG9faWQlMjAlM0QlMjAlMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUwQSUwQXNjaGVkdWxlciUyMCUzRCUyMEV1bGVyRGlzY3JldGVTY2hlZHVsZXIuZnJvbV9wcmV0cmFpbmVkKHJlcG9faWQlMkMlMjBzdWJmb2xkZXIlM0QlMjJzY2hlZHVsZXIlMjIpJTBBJTBBc3RhYmxlX2RpZmZ1c2lvbiUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChyZXBvX2lkJTJDJTIwc2NoZWR1bGVyJTNEc2NoZWR1bGVyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline, EulerDiscreteScheduler, DPMSolverMultistepScheduler

repo_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>

scheduler = EulerDiscreteScheduler.from_pretrained(repo_id, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)

stable_diffusion = DiffusionPipeline.from_pretrained(repo_id, scheduler=scheduler)`}}),Zl=new se({}),_l=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcmVwb19pZCUyMCUzRCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBc3RhYmxlX2RpZmZ1c2lvbiUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChyZXBvX2lkJTJDJTIwc2FmZXR5X2NoZWNrZXIlM0ROb25lKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

repo_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
stable_diffusion = DiffusionPipeline.from_pretrained(repo_id, safety_checker=<span class="hljs-literal">None</span>)`}}),kl=new se({}),Il=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTJDJTIwU3RhYmxlRGlmZnVzaW9uSW1nMkltZ1BpcGVsaW5lJTBBJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUwQXN0YWJsZV9kaWZmdXNpb25fdHh0MmltZyUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCklMEElMEFjb21wb25lbnRzJTIwJTNEJTIwc3RhYmxlX2RpZmZ1c2lvbl90eHQyaW1nLmNvbXBvbmVudHM=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline, StableDiffusionImg2ImgPipeline

model_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
stable_diffusion_txt2img = StableDiffusionPipeline.from_pretrained(model_id)

components = stable_diffusion_txt2img.components`}}),Cl=new T({props:{code:"c3RhYmxlX2RpZmZ1c2lvbl9pbWcyaW1nJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uSW1nMkltZ1BpcGVsaW5lKCoqY29tcG9uZW50cyk=",highlighted:"stable_diffusion_img2img = StableDiffusionImg2ImgPipeline(**components)"}}),gl=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTJDJTIwU3RhYmxlRGlmZnVzaW9uSW1nMkltZ1BpcGVsaW5lJTBBJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUwQXN0YWJsZV9kaWZmdXNpb25fdHh0MmltZyUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCklMEFzdGFibGVfZGlmZnVzaW9uX2ltZzJpbWclMjAlM0QlMjBTdGFibGVEaWZmdXNpb25JbWcySW1nUGlwZWxpbmUoJTBBJTIwJTIwJTIwJTIwdmFlJTNEc3RhYmxlX2RpZmZ1c2lvbl90eHQyaW1nLnZhZSUyQyUwQSUyMCUyMCUyMCUyMHRleHRfZW5jb2RlciUzRHN0YWJsZV9kaWZmdXNpb25fdHh0MmltZy50ZXh0X2VuY29kZXIlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0RzdGFibGVfZGlmZnVzaW9uX3R4dDJpbWcudG9rZW5pemVyJTJDJTBBJTIwJTIwJTIwJTIwdW5ldCUzRHN0YWJsZV9kaWZmdXNpb25fdHh0MmltZy51bmV0JTJDJTBBJTIwJTIwJTIwJTIwc2NoZWR1bGVyJTNEc3RhYmxlX2RpZmZ1c2lvbl90eHQyaW1nLnNjaGVkdWxlciUyQyUwQSUyMCUyMCUyMCUyMHNhZmV0eV9jaGVja2VyJTNETm9uZSUyQyUwQSUyMCUyMCUyMCUyMGZlYXR1cmVfZXh0cmFjdG9yJTNETm9uZSUyQyUwQSUyMCUyMCUyMCUyMHJlcXVpcmVzX3NhZmV0eV9jaGVja2VyJTNERmFsc2UlMkMlMEEp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline, StableDiffusionImg2ImgPipeline

model_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
stable_diffusion_txt2img = StableDiffusionPipeline.from_pretrained(model_id)
stable_diffusion_img2img = StableDiffusionImg2ImgPipeline(
    vae=stable_diffusion_txt2img.vae,
    text_encoder=stable_diffusion_txt2img.text_encoder,
    tokenizer=stable_diffusion_txt2img.tokenizer,
    unet=stable_diffusion_txt2img.unet,
    scheduler=stable_diffusion_txt2img.scheduler,
    safety_checker=<span class="hljs-literal">None</span>,
    feature_extractor=<span class="hljs-literal">None</span>,
    requires_safety_checker=<span class="hljs-literal">False</span>,
)`}}),Wl=new se({}),Re=new Wm({props:{$$slots:{default:[Gm]},$$scope:{ctx:rt}}}),$l=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBJTIzJTIwbG9hZCUyMGZwMTYlMjB2YXJpYW50JTBBc3RhYmxlX2RpZmZ1c2lvbiUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUyQyUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKSUwQSUyMyUyMGxvYWQlMjBub25fZW1hJTIwdmFyaWFudCUwQXN0YWJsZV9kaWZmdXNpb24lMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMkMlMjB2YXJpYW50JTNEJTIybm9uX2VtYSUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

<span class="hljs-comment"># load fp16 variant</span>
stable_diffusion = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16
)
<span class="hljs-comment"># load non_ema variant</span>
stable_diffusion = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>, variant=<span class="hljs-string">&quot;non_ema&quot;</span>)`}}),Bl=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBJTIzJTIwc2F2ZSUyMGFzJTIwZnAxNiUyMHZhcmlhbnQlMEFzdGFibGVfZGlmZnVzaW9uLnNhdmVfcHJldHJhaW5lZCglMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUyQyUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyKSUwQSUyMyUyMHNhdmUlMjBhcyUyMG5vbi1lbWElMjB2YXJpYW50JTBBc3RhYmxlX2RpZmZ1c2lvbi5zYXZlX3ByZXRyYWluZWQoJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMkMlMjB2YXJpYW50JTNEJTIybm9uX2VtYSUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

<span class="hljs-comment"># save as fp16 variant</span>
stable_diffusion.save_pretrained(<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>)
<span class="hljs-comment"># save as non-ema variant</span>
stable_diffusion.save_pretrained(<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>, variant=<span class="hljs-string">&quot;non_ema&quot;</span>)`}}),Gl=new T({props:{code:"JTIzJTIwJUYwJTlGJTkxJThFJTIwdGhpcyUyMHdvbid0JTIwd29yayUwQXN0YWJsZV9kaWZmdXNpb24lMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyLiUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEElMjMlMjAlRjAlOUYlOTElOEQlMjB0aGlzJTIwd29ya3MlMEFzdGFibGVfZGlmZnVzaW9uJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMi4lMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSk=",highlighted:`<span class="hljs-comment"># \u{1F44E} this won&#x27;t work</span>
stable_diffusion = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;./stable-diffusion-v1-5&quot;</span>, torch_dtype=torch.float16)
<span class="hljs-comment"># \u{1F44D} this works</span>
stable_diffusion = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;./stable-diffusion-v1-5&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16
)`}}),Al=new se({}),Ql=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFVOZXQyRENvbmRpdGlvbk1vZGVsJTBBJTBBcmVwb19pZCUyMCUzRCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBbW9kZWwlMjAlM0QlMjBVTmV0MkRDb25kaXRpb25Nb2RlbC5mcm9tX3ByZXRyYWluZWQocmVwb19pZCUyQyUyMHN1YmZvbGRlciUzRCUyMnVuZXQlMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> UNet2DConditionModel

repo_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
model = UNet2DConditionModel.from_pretrained(repo_id, subfolder=<span class="hljs-string">&quot;unet&quot;</span>)`}}),ql=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFVOZXQyRE1vZGVsJTBBJTBBcmVwb19pZCUyMCUzRCUyMCUyMmdvb2dsZSUyRmRkcG0tY2lmYXIxMC0zMiUyMiUwQW1vZGVsJTIwJTNEJTIwVU5ldDJETW9kZWwuZnJvbV9wcmV0cmFpbmVkKHJlcG9faWQp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> UNet2DModel

repo_id = <span class="hljs-string">&quot;google/ddpm-cifar10-32&quot;</span>
model = UNet2DModel.from_pretrained(repo_id)`}}),xl=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFVOZXQyRENvbmRpdGlvbk1vZGVsJTBBJTBBbW9kZWwlMjAlM0QlMjBVTmV0MkRDb25kaXRpb25Nb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJ1bmV0JTIyJTJDJTIwdmFyaWFudCUzRCUyMm5vbi1lbWElMjIpJTBBbW9kZWwuc2F2ZV9wcmV0cmFpbmVkKCUyMi4lMkZsb2NhbC11bmV0JTIyJTJDJTIwdmFyaWFudCUzRCUyMm5vbi1lbWElMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> UNet2DConditionModel

model = UNet2DConditionModel.from_pretrained(<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>, subfolder=<span class="hljs-string">&quot;unet&quot;</span>, variant=<span class="hljs-string">&quot;non-ema&quot;</span>)
model.save_pretrained(<span class="hljs-string">&quot;./local-unet&quot;</span>, variant=<span class="hljs-string">&quot;non-ema&quot;</span>)`}}),Pl=new se({}),Yl=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMCglMEElMjAlMjAlMjAlMjBERFBNU2NoZWR1bGVyJTJDJTBBJTIwJTIwJTIwJTIwRERJTVNjaGVkdWxlciUyQyUwQSUyMCUyMCUyMCUyMFBORE1TY2hlZHVsZXIlMkMlMEElMjAlMjAlMjAlMjBMTVNEaXNjcmV0ZVNjaGVkdWxlciUyQyUwQSUyMCUyMCUyMCUyMEV1bGVyRGlzY3JldGVTY2hlZHVsZXIlMkMlMEElMjAlMjAlMjAlMjBFdWxlckFuY2VzdHJhbERpc2NyZXRlU2NoZWR1bGVyJTJDJTBBJTIwJTIwJTIwJTIwRFBNU29sdmVyTXVsdGlzdGVwU2NoZWR1bGVyJTJDJTBBKSUwQSUwQXJlcG9faWQlMjAlM0QlMjAlMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiUwQSUwQWRkcG0lMjAlM0QlMjBERFBNU2NoZWR1bGVyLmZyb21fcHJldHJhaW5lZChyZXBvX2lkJTJDJTIwc3ViZm9sZGVyJTNEJTIyc2NoZWR1bGVyJTIyKSUwQWRkaW0lMjAlM0QlMjBERElNU2NoZWR1bGVyLmZyb21fcHJldHJhaW5lZChyZXBvX2lkJTJDJTIwc3ViZm9sZGVyJTNEJTIyc2NoZWR1bGVyJTIyKSUwQXBuZG0lMjAlM0QlMjBQTkRNU2NoZWR1bGVyLmZyb21fcHJldHJhaW5lZChyZXBvX2lkJTJDJTIwc3ViZm9sZGVyJTNEJTIyc2NoZWR1bGVyJTIyKSUwQWxtcyUyMCUzRCUyMExNU0Rpc2NyZXRlU2NoZWR1bGVyLmZyb21fcHJldHJhaW5lZChyZXBvX2lkJTJDJTIwc3ViZm9sZGVyJTNEJTIyc2NoZWR1bGVyJTIyKSUwQWV1bGVyX2FuYyUyMCUzRCUyMEV1bGVyQW5jZXN0cmFsRGlzY3JldGVTY2hlZHVsZXIuZnJvbV9wcmV0cmFpbmVkKHJlcG9faWQlMkMlMjBzdWJmb2xkZXIlM0QlMjJzY2hlZHVsZXIlMjIpJTBBZXVsZXIlMjAlM0QlMjBFdWxlckRpc2NyZXRlU2NoZWR1bGVyLmZyb21fcHJldHJhaW5lZChyZXBvX2lkJTJDJTIwc3ViZm9sZGVyJTNEJTIyc2NoZWR1bGVyJTIyKSUwQWRwbSUyMCUzRCUyMERQTVNvbHZlck11bHRpc3RlcFNjaGVkdWxlci5mcm9tX3ByZXRyYWluZWQocmVwb19pZCUyQyUyMHN1YmZvbGRlciUzRCUyMnNjaGVkdWxlciUyMiklMEElMEElMjMlMjByZXBsYWNlJTIwJTYwZHBtJTYwJTIwd2l0aCUyMGFueSUyMG9mJTIwJTYwZGRwbSU2MCUyQyUyMCU2MGRkaW0lNjAlMkMlMjAlNjBwbmRtJTYwJTJDJTIwJTYwbG1zJTYwJTJDJTIwJTYwZXVsZXJfYW5jJTYwJTJDJTIwJTYwZXVsZXIlNjAlMEFwaXBlbGluZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChyZXBvX2lkJTJDJTIwc2NoZWR1bGVyJTNEZHBtKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> (
    DDPMScheduler,
    DDIMScheduler,
    PNDMScheduler,
    LMSDiscreteScheduler,
    EulerDiscreteScheduler,
    EulerAncestralDiscreteScheduler,
    DPMSolverMultistepScheduler,
)

repo_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>

ddpm = DDPMScheduler.from_pretrained(repo_id, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)
ddim = DDIMScheduler.from_pretrained(repo_id, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)
pndm = PNDMScheduler.from_pretrained(repo_id, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)
lms = LMSDiscreteScheduler.from_pretrained(repo_id, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)
euler_anc = EulerAncestralDiscreteScheduler.from_pretrained(repo_id, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)
euler = EulerDiscreteScheduler.from_pretrained(repo_id, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)
dpm = DPMSolverMultistepScheduler.from_pretrained(repo_id, subfolder=<span class="hljs-string">&quot;scheduler&quot;</span>)

<span class="hljs-comment"># replace \`dpm\` with any of \`ddpm\`, \`ddim\`, \`pndm\`, \`lms\`, \`euler_anc\`, \`euler\`</span>
pipeline = StableDiffusionPipeline.from_pretrained(repo_id, scheduler=dpm)`}}),zl=new se({}),Ol=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBcmVwb19pZCUyMCUzRCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBcGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQocmVwb19pZCklMEFwcmludChwaXBlbGluZSk=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

repo_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
pipeline = DiffusionPipeline.from_pretrained(repo_id)
<span class="hljs-built_in">print</span>(pipeline)`}}),tt=new T({props:{code:"U3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUlMjAlN0IlMEElMjAlMjAlMj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mdXNlcnMlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjJBdXRvZW5jb2RlcktMJTIyJTBBJTIwJTIwJTVEJTBBJTdE",highlighted:`StableDiffusionPipeline <span class="hljs-punctuation">{</span>
  <span class="hljs-attr">&quot;feature_extractor&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
    <span class="hljs-string">&quot;transformers&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-string">&quot;CLIPImageProcessor&quot;</span>
  <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;safety_checker&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
    <span class="hljs-string">&quot;stable_diffusion&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-string">&quot;StableDiffusionSafetyChecker&quot;</span>
  <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;scheduler&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
    <span class="hljs-string">&quot;diffusers&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-string">&quot;PNDMScheduler&quot;</span>
  <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;text_encoder&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
    <span class="hljs-string">&quot;transformers&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-string">&quot;CLIPTextModel&quot;</span>
  <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;tokenizer&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
    <span class="hljs-string">&quot;transformers&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-string">&quot;CLIPTokenizer&quot;</span>
  <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;unet&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
    <span class="hljs-string">&quot;diffusers&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-string">&quot;UNet2DConditionModel&quot;</span>
  <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;vae&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
    <span class="hljs-string">&quot;diffusers&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-string">&quot;AutoencoderKL&quot;</span>
  <span class="hljs-punctuation">]</span>
<span class="hljs-punctuation">}</span>`}}),at=new T({props:{code:"LiUwQSVFMiU5NCU5QyVFMiU5NCU4MCVFMiU5NCU4MCUyMGZlYXR1cmVfZXh0cmFjdG9yJTBBJUUyJTk0JTgyJUMyJUEwJUMyJUEwJTIwJUUyJTk0JTk0JUUyJTk0JTgwJUUyJTk0JTgwJTIwcHJlcHJvY2Vzc29yX2NvbmZpZy5qc29uJTBBJUUyJTk0JTlDJUUyJTk0JTgwJUUyJTk0JTgwJTIwbW9kZWxfaW5kZXguanNvbiUwQSVFMiU5NCU5QyVFMiU5NCU4MCVFMiU5NCU4MCUyMHNhZmV0eV9jaGVja2VyJTBBJUUyJTk0JTgyJUMyJUEwJUMyJUEwJTIwJUUyJTk0JTlDJUUyJTk0JTgwJUUyJTk0JTgwJTIwY29uZmlnLmpzb24lMEElRTIlOTQlODIlQzIlQTAlQzIlQTAlMjAlRTIlOTQlOTQlRTIlOTQlODAlRTIlOTQlODAlMjBweXRvcmNoX21vZGVsLmJpbiUwQSVFMiU5NCU5QyVFMiU5NCU4MCVFMiU5NCU4MCUyMHNjaGVkdWxlciUwQSVFMiU5NCU4MiVDMiVBMCVDMiVBMCUyMCVFMiU5NCU5NCVFMiU5NCU4MCVFMiU5NCU4MCUyMHNjaGVkdWxlcl9jb25maWcuanNvbiUwQSVFMiU5NCU5QyVFMiU5NCU4MCVFMiU5NCU4MCUyMHRleHRfZW5jb2RlciUwQSVFMiU5NCU4M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BkaWZmdXNpb25fcHl0b3JjaF9tb2RlbC5iaW4=",highlighted:`.
\u251C\u2500\u2500 feature_extractor
\u2502\xA0\xA0 \u2514\u2500\u2500 preprocessor_config.<span class="hljs-keyword">json
</span>\u251C\u2500\u2500 model_index.<span class="hljs-keyword">json
</span>\u251C\u2500\u2500 safety_checker
\u2502\xA0\xA0 \u251C\u2500\u2500 <span class="hljs-built_in">config</span>.<span class="hljs-keyword">json
</span>\u2502\xA0\xA0 \u2514\u2500\u2500 pytorch_model.<span class="hljs-keyword">bin
</span>\u251C\u2500\u2500 <span class="hljs-keyword">scheduler
</span>\u2502\xA0\xA0 \u2514\u2500\u2500 <span class="hljs-keyword">scheduler_config.json
</span>\u251C\u2500\u2500 text_encoder
\u2502\xA0\xA0 \u251C\u2500\u2500 <span class="hljs-built_in">config</span>.<span class="hljs-keyword">json
</span>\u2502\xA0\xA0 \u2514\u2500\u2500 pytorch_model.<span class="hljs-keyword">bin
</span>\u251C\u2500\u2500 tokenizer
\u2502\xA0\xA0 \u251C\u2500\u2500 merges.txt
\u2502\xA0\xA0 \u251C\u2500\u2500 special_tokens_map.<span class="hljs-keyword">json
</span>\u2502\xA0\xA0 \u251C\u2500\u2500 tokenizer_config.<span class="hljs-keyword">json
</span>\u2502\xA0\xA0 \u2514\u2500\u2500 vocab.<span class="hljs-keyword">json
</span>\u251C\u2500\u2500 unet
\u2502\xA0\xA0 \u251C\u2500\u2500 <span class="hljs-built_in">config</span>.<span class="hljs-keyword">json
</span>\u2502\xA0\xA0 \u251C\u2500\u2500 <span class="hljs-keyword">diffusion_pytorch_model.bin
</span>\u2514\u2500\u2500 vae
    \u251C\u2500\u2500 <span class="hljs-built_in">config</span>.<span class="hljs-keyword">json
</span>    \u251C\u2500\u2500 <span class="hljs-keyword">diffusion_pytorch_model.bin</span>`}}),ot=new T({props:{code:"cGlwZWxpbmUudG9rZW5pemVyJTBBQ0xJUFRva2VuaXplciglMEElMjAlMjAlMjAlMjBuYW1lX29yX3BhdG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b2tlbiUyMiUzQSUyMEFkZGVkVG9rZW4oJTIyJTNDJTdDZW5kb2Z0ZXh0JTdDJTNFJTIyJTJDJTIwcnN0cmlwJTNERmFsc2UlMkMlMjBsc3RyaXAlM0RGYWxzZSUyQyUyMHNpbmdsZV93b3JkJTNERmFsc2UlMkMlMjBub3JtYWxpemVkJTNEVHJ1ZSklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJwYWRfdG9rZW4lMjIlM0ElMjAlMjIlM0MlN0NlbmRvZnRleHQlN0MlM0UlMjIlMkMlMEElMjAlMjAlMjAlMjAlN0QlMkMlMEEp",highlighted:`pipeline.tokenizer
CLIPTokenizer(
    name_or_path=<span class="hljs-string">&quot;/root/.cache/huggingface/hub/models--runwayml--stable-diffusion-v1-5/snapshots/39593d5650112b4cc580433f6b0435385882d819/tokenizer&quot;</span>,
    vocab_size=<span class="hljs-number">49408</span>,
    model_max_length=<span class="hljs-number">77</span>,
    is_fast=<span class="hljs-literal">False</span>,
    padding_side=<span class="hljs-string">&quot;right&quot;</span>,
    truncation_side=<span class="hljs-string">&quot;right&quot;</span>,
    special_tokens={
        <span class="hljs-string">&quot;bos_token&quot;</span>: AddedToken(<span class="hljs-string">&quot;&lt;|startoftext|&gt;&quot;</span>, rstrip=<span class="hljs-literal">False</span>, lstrip=<span class="hljs-literal">False</span>, single_word=<span class="hljs-literal">False</span>, normalized=<span class="hljs-literal">True</span>),
        <span class="hljs-string">&quot;eos_token&quot;</span>: AddedToken(<span class="hljs-string">&quot;&lt;|endoftext|&gt;&quot;</span>, rstrip=<span class="hljs-literal">False</span>, lstrip=<span class="hljs-literal">False</span>, single_word=<span class="hljs-literal">False</span>, normalized=<span class="hljs-literal">True</span>),
        <span class="hljs-string">&quot;unk_token&quot;</span>: AddedToken(<span class="hljs-string">&quot;&lt;|endoftext|&gt;&quot;</span>, rstrip=<span class="hljs-literal">False</span>, lstrip=<span class="hljs-literal">False</span>, single_word=<span class="hljs-literal">False</span>, normalized=<span class="hljs-literal">True</span>),
        <span class="hljs-string">&quot;pad_token&quot;</span>: <span class="hljs-string">&quot;&lt;|endoftext|&gt;&quot;</span>,
    },
)`}}),nt=new T({props:{code:"JTdCJTBBJTIwJTIwJTIyX2NsYXNzX25hbWUlMjIlM0ElMjAlMjJTdGFibGVEaWZmdXNpb25QaXBlbGluZSUyMiUyQyUwQSUyMCUyMCUyMl9kaWZmdXNlcnNfdmVyc2lvbiUyMiUzQSUyMCUyMjAuNi4wJTIyJTJDJTBBJTIwJTIwJTIyZmVhdHVyZV9leHRyYWN0b3IlMjIlM0ElMjAlNUIlMEElMjAlMjAlMjAlMjAlMjJ0cmFuc2Zvcm1lcnMlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjJDTElQSW1hZ2VQcm9jZXNzb3IlMjIlMEElMjAlMjAlNUQlMkMlMEElMjAlMjAlMjJzYWZldHlfY2hlY2tlciUyMiUzQSUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMnN0YWJsZV9kaWZmdXNpb24lMjIlMkMlMEElMjAlMjAlMjAlMjAlMjJTdGFibGVEaWZmdXNpb25TYWZldHlDaGVja2VyJTIyJTBBJTIwJTIwJTVEJTJDJTBBJTIwJTIwJTIyc2NoZWR1bGVyJTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIyZGlmZnVzZXJzJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIyUE5ETVNjaGVkdWxlciUyMiUwQSUyMCUyMCU1RCUyQyUwQSUyMCUyMCUyMnRleHRfZW5jb2RlciUyMiUzQSUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMnRyYW5zZm9ybWVycyUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMkNMSVBUZXh0TW9kZWwlMjIlMEElMjAlMjAlNUQlMkMlMEElMjAlMjAlMjJ0b2tlbml6ZXIlMjIlM0ElMjAlNUIlMEElMjAlMjAlMjAlMjAlMjJ0cmFuc2Zvcm1lcnMlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjJDTElQVG9rZW5pemVyJTIyJTBBJTIwJTIwJTVEJTJDJTBBJTIwJTIwJTIydW5ldCUyMiUzQSUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMmRpZmZ1c2VycyUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMlVOZXQyRENvbmRpdGlvbk1vZGVsJTIyJTBBJTIwJTIwJTVEJTJDJTBBJTIwJTIwJTIydmFlJTIyJTNBJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIyZGlmZnVzZXJzJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIyQXV0b2VuY29kZXJLTCUyMiUwQSUyMCUyMCU1RCUwQSU3RA==",highlighted:`<span class="hljs-punctuation">{</span>
  <span class="hljs-attr">&quot;_class_name&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;StableDiffusionPipeline&quot;</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;_diffusers_version&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;0.6.0&quot;</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;feature_extractor&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
    <span class="hljs-string">&quot;transformers&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-string">&quot;CLIPImageProcessor&quot;</span>
  <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;safety_checker&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
    <span class="hljs-string">&quot;stable_diffusion&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-string">&quot;StableDiffusionSafetyChecker&quot;</span>
  <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;scheduler&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
    <span class="hljs-string">&quot;diffusers&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-string">&quot;PNDMScheduler&quot;</span>
  <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;text_encoder&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
    <span class="hljs-string">&quot;transformers&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-string">&quot;CLIPTextModel&quot;</span>
  <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;tokenizer&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
    <span class="hljs-string">&quot;transformers&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-string">&quot;CLIPTokenizer&quot;</span>
  <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;unet&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
    <span class="hljs-string">&quot;diffusers&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-string">&quot;UNet2DConditionModel&quot;</span>
  <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span>
  <span class="hljs-attr">&quot;vae&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span>
    <span class="hljs-string">&quot;diffusers&quot;</span><span class="hljs-punctuation">,</span>
    <span class="hljs-string">&quot;AutoencoderKL&quot;</span>
  <span class="hljs-punctuation">]</span>
<span class="hljs-punctuation">}</span>`}}),{c(){w=o("meta"),R=f(),b=o("h1"),_=o("a"),V=o("span"),u(Z.$$.fragment),x=f(),N=o("span"),I=s("Load pipelines, models, and schedulers"),j=f(),C=o("p"),ae=s("Having an easy way to use a diffusion system for inference is essential to \u{1F9E8} Diffusers. Diffusion systems often consist of multiple components like parameterized models, tokenizers, and schedulers that interact in complex ways. That is why we designed the "),pt=o("a"),ri=s("DiffusionPipeline"),pi=s(" to wrap the complexity of the entire diffusion system into an easy-to-use API, while remaining flexible enough to be adapted for other use cases, such as loading each component individually as building blocks to assemble your own diffusion system."),ro=f(),Ue=o("p"),fi=s("Everything you need for inference or training is accessible with the "),is=o("code"),ci=s("from_pretrained()"),di=s(" method."),po=f(),ft=o("p"),ui=s("This guide will show you how to load:"),fo=f(),D=o("ul"),rs=o("li"),hi=s("pipelines from the Hub and locally"),mi=f(),ps=o("li"),yi=s("different components into a pipeline"),Mi=f(),fs=o("li"),Ji=s("checkpoint variants such as different floating point types or non-exponential mean averaged (EMA) weights"),wi=f(),cs=o("li"),Ui=s("models and schedulers"),co=f(),oe=o("h2"),ve=o("a"),ds=o("span"),u(pl.$$.fragment),vi=f(),us=o("span"),Ti=s("Diffusion Pipeline"),uo=f(),u(Te.$$.fragment),ho=f(),$=o("p"),bi=s("The "),ct=o("a"),ji=s("DiffusionPipeline"),Zi=s(" class is the simplest and most generic way to load any diffusion model from the "),fl=o("a"),Ei=s("Hub"),_i=s(". The "),dt=o("a"),ki=s("DiffusionPipeline.from_pretrained()"),Ii=s(" method automatically detects the correct pipeline class from the checkpoint, downloads and caches all the required configuration and weight files, and returns a pipeline instance ready for inference."),mo=f(),u(cl.$$.fragment),yo=f(),be=o("p"),Ci=s("You can also load a checkpoint with it\u2019s specific pipeline class. The example above loaded a Stable Diffusion model; to get the same result, use the "),ut=o("a"),gi=s("StableDiffusionPipeline"),Wi=s(" class:"),Mo=f(),u(dl.$$.fragment),Jo=f(),z=o("p"),Vi=s("A checkpoint (such as "),ul=o("a"),hs=o("code"),Ni=s("CompVis/stable-diffusion-v1-4"),Ri=s(" or "),hl=o("a"),ms=o("code"),Di=s("runwayml/stable-diffusion-v1-5"),$i=s(") may also be used for more than one task, like text-to-image or image-to-image. To differentiate what task you want to use the checkpoint for, you have to load it directly with it\u2019s corresponding task-specific pipeline class:"),wo=f(),u(ml.$$.fragment),Uo=f(),ne=o("h3"),je=o("a"),ys=o("span"),u(yl.$$.fragment),Bi=f(),Ms=o("span"),Gi=s("Local pipeline"),vo=f(),B=o("p"),Ai=s("To load a diffusion pipeline locally, use "),Ml=o("a"),Js=o("code"),Si=s("git-lfs"),Qi=s(" to manually download the checkpoint (in this case, "),Jl=o("a"),ws=o("code"),Xi=s("runwayml/stable-diffusion-v1-5"),qi=s(") to your local disk. This creates a local folder, "),Us=o("code"),xi=s("./stable-diffusion-v1-5"),Pi=s(", on your disk:"),To=f(),u(wl.$$.fragment),bo=f(),Ze=o("p"),Yi=s("Then pass the local path to "),ht=o("a"),zi=s("from_pretrained()"),Fi=s(":"),jo=f(),u(Ul.$$.fragment),Zo=f(),Ee=o("p"),Hi=s("The "),mt=o("a"),Oi=s("from_pretrained()"),Li=s(" method won\u2019t download any files from the Hub when it detects a local path, but this also means it won\u2019t download and cache the latest changes to a checkpoint."),Eo=f(),ie=o("h3"),_e=o("a"),vs=o("span"),u(vl.$$.fragment),Ki=f(),Ts=o("span"),er=s("Swap components in a pipeline"),_o=f(),yt=o("p"),lr=s("You can customize the default components of any pipeline with another compatible component. Customization is important because:"),ko=f(),F=o("ul"),bs=o("li"),tr=s("Changing the scheduler is important for exploring the trade-off between generation speed and quality."),sr=f(),js=o("li"),ar=s("Different components of a model are typically trained independently and you can swap out a component with a better-performing one."),or=f(),Zs=o("li"),nr=s("During finetuning, usually only some components - like the UNet or text encoder - are trained."),Io=f(),ke=o("p"),ir=s("To find out which schedulers are compatible for customization, you can use the "),Es=o("code"),rr=s("compatibles"),pr=s(" method:"),Co=f(),u(Tl.$$.fragment),go=f(),k=o("p"),fr=s("Let\u2019s use the "),Mt=o("a"),cr=s("SchedulerMixin.from_pretrained()"),dr=s(" method to replace the default "),Jt=o("a"),ur=s("PNDMScheduler"),hr=s(" with a more performant scheduler, "),wt=o("a"),mr=s("EulerDiscreteScheduler"),yr=s(". The "),_s=o("code"),Mr=s('subfolder="scheduler"'),Jr=s(" argument is required to load the scheduler configuration from the correct "),bl=o("a"),wr=s("subfolder"),Ur=s(" of the pipeline repository."),Wo=f(),G=o("p"),vr=s("Then you can pass the new "),Ut=o("a"),Tr=s("EulerDiscreteScheduler"),br=s(" instance to the "),ks=o("code"),jr=s("scheduler"),Zr=s(" argument in "),vt=o("a"),Er=s("DiffusionPipeline"),_r=s(":"),Vo=f(),u(jl.$$.fragment),No=f(),re=o("h3"),Ie=o("a"),Is=o("span"),u(Zl.$$.fragment),kr=f(),Cs=o("span"),Ir=s("Safety checker"),Ro=f(),A=o("p"),Cr=s("Diffusion models like Stable Diffusion can generate harmful content, which is why \u{1F9E8} Diffusers has a "),El=o("a"),gr=s("safety checker"),Wr=s(" to check generated outputs against known hardcoded NSFW content. If you\u2019d like to disable the safety checker for whatever reason, pass "),gs=o("code"),Vr=s("None"),Nr=s(" to the "),Ws=o("code"),Rr=s("safety_checker"),Dr=s(" argument:"),Do=f(),u(_l.$$.fragment),$o=f(),pe=o("h3"),Ce=o("a"),Vs=o("span"),u(kl.$$.fragment),$r=f(),Ns=o("span"),Br=s("Reuse components across pipelines"),Bo=f(),ge=o("p"),Gr=s("You can also reuse the same components in multiple pipelines to avoid loading the weights into RAM twice. Use the "),Tt=o("a"),Ar=s("components"),Sr=s(" method to save the components:"),Go=f(),u(Il.$$.fragment),Ao=f(),We=o("p"),Qr=s("Then you can pass the "),Rs=o("code"),Xr=s("components"),qr=s(" to another pipeline without reloading the weights into RAM:"),So=f(),u(Cl.$$.fragment),Qo=f(),bt=o("p"),xr=s("You can also pass the components individually to the pipeline if you want more flexibility over which components to reuse or disable. For example, to reuse the same components in the text-to-image pipeline, except for the safety checker and feature extractor, in the image-to-image pipeline:"),Xo=f(),u(gl.$$.fragment),qo=f(),fe=o("h2"),Ve=o("a"),Ds=o("span"),u(Wl.$$.fragment),Pr=f(),$s=o("span"),Yr=s("Checkpoint variants"),xo=f(),jt=o("p"),zr=s("A checkpoint variant is usually a checkpoint where it\u2019s weights are:"),Po=f(),Ne=o("ul"),Vl=o("li"),Fr=s("Stored in a different floating point type for lower precision and lower storage, such as "),Nl=o("a"),Bs=o("code"),Hr=s("torch.float16"),Or=s(", because it only requires half the bandwidth and storage to download. You can\u2019t use this variant if you\u2019re continuing training or using a CPU."),Lr=f(),Gs=o("li"),Kr=s("Non-exponential mean averaged (EMA) weights which shouldn\u2019t be used for inference. You should use these to continue finetuning a model."),Yo=f(),u(Re.$$.fragment),zo=f(),H=o("p"),ep=s("Otherwise, a variant is "),As=o("strong"),lp=s("identical"),tp=s(" to the original checkpoint. They have exactly the same serialization format (like "),Zt=o("a"),sp=s("Safetensors"),ap=s("), model structure, and weights have identical tensor shapes."),Fo=f(),De=o("table"),Ss=o("thead"),ce=o("tr"),Qs=o("th"),Xs=o("strong"),op=s("checkpoint type"),np=f(),qs=o("th"),xs=o("strong"),ip=s("weight name"),rp=f(),Ps=o("th"),Ys=o("strong"),pp=s("argument for loading weights"),fp=f(),de=o("tbody"),ue=o("tr"),zs=o("td"),cp=s("original"),dp=f(),Fs=o("td"),up=s("diffusion_pytorch_model.bin"),hp=f(),Ho=o("td"),mp=f(),he=o("tr"),Hs=o("td"),yp=s("floating point"),Mp=f(),Os=o("td"),Jp=s("diffusion_pytorch_model.fp16.bin"),wp=f(),Rl=o("td"),Ls=o("code"),Up=s("variant"),vp=s(", "),Ks=o("code"),Tp=s("torch_dtype"),bp=f(),me=o("tr"),ea=o("td"),jp=s("non-EMA"),Zp=f(),la=o("td"),Ep=s("diffusion_pytorch_model.non_ema.bin"),_p=f(),ta=o("td"),sa=o("code"),kp=s("variant"),Oo=f(),Et=o("p"),Ip=s("There are two important arguments to know for loading variants:"),Lo=f(),$e=o("ul"),aa=o("li"),U=o("p"),oa=o("code"),Cp=s("torch_dtype"),gp=s(" defines the floating point precision of the loaded checkpoints. For example, if you want to save bandwidth by loading a "),na=o("code"),Wp=s("fp16"),Vp=s(" variant, you should specify "),ia=o("code"),Np=s("torch_dtype=torch.float16"),Rp=s(" to "),ra=o("em"),Dp=s("convert the weights"),$p=s(" to "),pa=o("code"),Bp=s("fp16"),Gp=s(". Otherwise, the "),fa=o("code"),Ap=s("fp16"),Sp=s(" weights are converted to the default "),ca=o("code"),Qp=s("fp32"),Xp=s(" precision. You can also load the original checkpoint without defining the "),da=o("code"),qp=s("variant"),xp=s(" argument, and convert it to "),ua=o("code"),Pp=s("fp16"),Yp=s(" with "),ha=o("code"),zp=s("torch_dtype=torch.float16"),Fp=s(". In this case, the default "),ma=o("code"),Hp=s("fp32"),Op=s(" weights are downloaded first, and then they\u2019re converted to "),ya=o("code"),Lp=s("fp16"),Kp=s(" after loading."),ef=f(),Ma=o("li"),g=o("p"),Ja=o("code"),lf=s("variant"),tf=s(" defines which files should be loaded from the repository. For example, if you want to load a "),wa=o("code"),sf=s("non_ema"),af=s(" variant from the "),Dl=o("a"),Ua=o("code"),of=s("diffusers/stable-diffusion-variants"),nf=s(" repository, you should specify "),va=o("code"),rf=s('variant="non_ema"'),pf=s(" to download the "),Ta=o("code"),ff=s("non_ema"),cf=s(" files."),Ko=f(),u($l.$$.fragment),en=f(),O=o("p"),df=s("To save a checkpoint stored in a different floating point type or as a non-EMA variant, use the "),_t=o("a"),uf=s("DiffusionPipeline.save_pretrained()"),hf=s(" method and specify the "),ba=o("code"),mf=s("variant"),yf=s(" argument. You should try and save a variant to the same folder as the original checkpoint, so you can load both from the same folder:"),ln=f(),u(Bl.$$.fragment),tn=f(),L=o("p"),Mf=s("If you don\u2019t save the variant to an existing folder, you must specify the "),ja=o("code"),Jf=s("variant"),wf=s(" argument otherwise it\u2019ll throw an "),Za=o("code"),Uf=s("Exception"),vf=s(" because it can\u2019t find the original checkpoint:"),sn=f(),u(Gl.$$.fragment),an=f(),ye=o("h2"),Be=o("a"),Ea=o("span"),u(Al.$$.fragment),Tf=f(),_a=o("span"),bf=s("Models"),on=f(),K=o("p"),jf=s("Models are loaded from the "),kt=o("a"),Zf=s("ModelMixin.from_pretrained()"),Ef=s(" method, which downloads and caches the latest version of the model weights and configurations. If the latest files are available in the local cache, "),It=o("a"),_f=s("from_pretrained()"),kf=s(" reuses files in the cache instead of redownloading them."),nn=f(),S=o("p"),If=s("Models can be loaded from a subfolder with the "),ka=o("code"),Cf=s("subfolder"),gf=s(" argument. For example, the model weights for "),Ia=o("code"),Wf=s("runwayml/stable-diffusion-v1-5"),Vf=s(" are stored in the "),Sl=o("a"),Ca=o("code"),Nf=s("unet"),Rf=s(" subfolder:"),rn=f(),u(Ql.$$.fragment),pn=f(),Ge=o("p"),Df=s("Or directly from a repository\u2019s "),Xl=o("a"),$f=s("directory"),Bf=s(":"),fn=f(),u(ql.$$.fragment),cn=f(),Q=o("p"),Gf=s("You can also load and save model variants by specifying the "),ga=o("code"),Af=s("variant"),Sf=s(" argument in "),Ct=o("a"),Qf=s("ModelMixin.from_pretrained()"),Xf=s(" and "),gt=o("a"),qf=s("ModelMixin.save_pretrained()"),xf=s(":"),dn=f(),u(xl.$$.fragment),un=f(),Me=o("h2"),Ae=o("a"),Wa=o("span"),u(Pl.$$.fragment),Pf=f(),Va=o("span"),Yf=s("Schedulers"),hn=f(),X=o("p"),zf=s("Schedulers are loaded from the "),Wt=o("a"),Ff=s("SchedulerMixin.from_pretrained()"),Hf=s(" method, and unlike models, schedulers are "),Na=o("strong"),Of=s("not parameterized"),Lf=s(" or "),Ra=o("strong"),Kf=s("trained"),ec=s("; they are defined by a configuration file."),mn=f(),Se=o("p"),lc=s(`Loading schedulers does not consume any significant amount of memory and the same configuration file can be used for a variety of different schedulers.
For example, the following schedulers are compatible with `),Vt=o("a"),tc=s("StableDiffusionPipeline"),sc=s(" which means you can load the same scheduler configuration file in any of these classes:"),yn=f(),u(Yl.$$.fragment),Mn=f(),Je=o("h2"),Qe=o("a"),Da=o("span"),u(zl.$$.fragment),ac=f(),$a=o("span"),oc=s("DiffusionPipeline explained"),Jn=f(),Xe=o("p"),nc=s("As a class method, "),Nt=o("a"),ic=s("DiffusionPipeline.from_pretrained()"),rc=s(" is responsible for two things:"),wn=f(),qe=o("ul"),Fl=o("li"),pc=s("Download the latest version of the folder structure required for inference and cache it. If the latest folder structure is available in the local cache, "),Rt=o("a"),fc=s("DiffusionPipeline.from_pretrained()"),cc=s(" reuses the cache and won\u2019t redownload the files."),dc=f(),we=o("li"),uc=s("Load the cached weights into the correct pipeline "),Dt=o("a"),hc=s("class"),mc=s(" - retrieved from the "),Ba=o("code"),yc=s("model_index.json"),Mc=s(" file - and return an instance of it."),Un=f(),ee=o("p"),Jc=s("The pipelines underlying folder structure corresponds directly with their class instances. For example, the "),$t=o("a"),wc=s("StableDiffusionPipeline"),Uc=s(" corresponds to the folder structure in "),Hl=o("a"),Ga=o("code"),vc=s("runwayml/stable-diffusion-v1-5"),Tc=s("."),vn=f(),u(Ol.$$.fragment),Tn=f(),xe=o("p"),bc=s("You\u2019ll see pipeline is an instance of "),Bt=o("a"),jc=s("StableDiffusionPipeline"),Zc=s(", which consists of seven components:"),bn=f(),E=o("ul"),Pe=o("li"),Aa=o("code"),Ec=s('"feature_extractor"'),_c=s(": a "),Ll=o("a"),kc=s("CLIPFeatureExtractor"),Ic=s(" from \u{1F917} Transformers."),Cc=f(),Ye=o("li"),Sa=o("code"),gc=s('"safety_checker"'),Wc=s(": a "),Kl=o("a"),Vc=s("component"),Nc=s(" for screening against harmful content."),Rc=f(),ze=o("li"),Qa=o("code"),Dc=s('"scheduler"'),$c=s(": an instance of "),Gt=o("a"),Bc=s("PNDMScheduler"),Gc=s("."),Ac=f(),Fe=o("li"),Xa=o("code"),Sc=s('"text_encoder"'),Qc=s(": a "),et=o("a"),Xc=s("CLIPTextModel"),qc=s(" from \u{1F917} Transformers."),xc=f(),He=o("li"),qa=o("code"),Pc=s('"tokenizer"'),Yc=s(": a "),lt=o("a"),zc=s("CLIPTokenizer"),Fc=s(" from \u{1F917} Transformers."),Hc=f(),Oe=o("li"),xa=o("code"),Oc=s('"unet"'),Lc=s(": an instance of "),At=o("a"),Kc=s("UNet2DConditionModel"),ed=s("."),ld=f(),Le=o("li"),Pa=o("code"),td=s('"vae"'),sd=s(" an instance of "),St=o("a"),ad=s("AutoencoderKL"),od=s("."),jn=f(),u(tt.$$.fragment),Zn=f(),Ke=o("p"),nd=s("Compare the components of the pipeline instance to the "),st=o("a"),Ya=o("code"),id=s("runwayml/stable-diffusion-v1-5"),rd=s(" folder structure, and you\u2019ll see there is a separate folder for each of the components in the repository:"),En=f(),u(at.$$.fragment),_n=f(),Qt=o("p"),pd=s("You can access each of the components of the pipeline as an attribute to view its configuration:"),kn=f(),u(ot.$$.fragment),In=f(),le=o("p"),fd=s("Every pipeline expects a "),za=o("code"),cd=s("model_index.json"),dd=s(" file that tells the "),Xt=o("a"),ud=s("DiffusionPipeline"),hd=s(":"),Cn=f(),te=o("ul"),qt=o("li"),md=s("which pipeline class to load from "),Fa=o("code"),yd=s("_class_name"),Md=f(),xt=o("li"),Jd=s("which version of \u{1F9E8} Diffusers was used to create the model in "),Ha=o("code"),wd=s("_diffusers_version"),Ud=f(),P=o("li"),vd=s("what components from which library are stored in the subfolders ("),Oa=o("code"),Td=s("name"),bd=s(" corresponds to the component and subfolder name, "),La=o("code"),jd=s("library"),Zd=s(" corresponds to the name of the library to load the class from, and "),Ka=o("code"),Ed=s("class"),_d=s(" corresponds to the class name)"),gn=f(),u(nt.$$.fragment),this.h()},l(e){const r=Dm('[data-svelte="svelte-1phssyn"]',document.head);w=n(r,"META",{name:!0,content:!0}),r.forEach(t),R=c(e),b=n(e,"H1",{class:!0});var it=i(b);_=n(it,"A",{id:!0,class:!0,href:!0});var eo=i(_);V=n(eo,"SPAN",{});var Cd=i(V);h(Z.$$.fragment,Cd),Cd.forEach(t),eo.forEach(t),x=c(it),N=n(it,"SPAN",{});var gd=i(N);I=a(gd,"Load pipelines, models, and schedulers"),gd.forEach(t),it.forEach(t),j=c(e),C=n(e,"P",{});var Vn=i(C);ae=a(Vn,"Having an easy way to use a diffusion system for inference is essential to \u{1F9E8} Diffusers. Diffusion systems often consist of multiple components like parameterized models, tokenizers, and schedulers that interact in complex ways. That is why we designed the "),pt=n(Vn,"A",{href:!0});var Wd=i(pt);ri=a(Wd,"DiffusionPipeline"),Wd.forEach(t),pi=a(Vn," to wrap the complexity of the entire diffusion system into an easy-to-use API, while remaining flexible enough to be adapted for other use cases, such as loading each component individually as building blocks to assemble your own diffusion system."),Vn.forEach(t),ro=c(e),Ue=n(e,"P",{});var Nn=i(Ue);fi=a(Nn,"Everything you need for inference or training is accessible with the "),is=n(Nn,"CODE",{});var Vd=i(is);ci=a(Vd,"from_pretrained()"),Vd.forEach(t),di=a(Nn," method."),Nn.forEach(t),po=c(e),ft=n(e,"P",{});var Nd=i(ft);ui=a(Nd,"This guide will show you how to load:"),Nd.forEach(t),fo=c(e),D=n(e,"UL",{});var el=i(D);rs=n(el,"LI",{});var Rd=i(rs);hi=a(Rd,"pipelines from the Hub and locally"),Rd.forEach(t),mi=c(el),ps=n(el,"LI",{});var Dd=i(ps);yi=a(Dd,"different components into a pipeline"),Dd.forEach(t),Mi=c(el),fs=n(el,"LI",{});var $d=i(fs);Ji=a($d,"checkpoint variants such as different floating point types or non-exponential mean averaged (EMA) weights"),$d.forEach(t),wi=c(el),cs=n(el,"LI",{});var Bd=i(cs);Ui=a(Bd,"models and schedulers"),Bd.forEach(t),el.forEach(t),co=c(e),oe=n(e,"H2",{class:!0});var Rn=i(oe);ve=n(Rn,"A",{id:!0,class:!0,href:!0});var Gd=i(ve);ds=n(Gd,"SPAN",{});var Ad=i(ds);h(pl.$$.fragment,Ad),Ad.forEach(t),Gd.forEach(t),vi=c(Rn),us=n(Rn,"SPAN",{});var Sd=i(us);Ti=a(Sd,"Diffusion Pipeline"),Sd.forEach(t),Rn.forEach(t),uo=c(e),h(Te.$$.fragment,e),ho=c(e),$=n(e,"P",{});var ll=i($);bi=a(ll,"The "),ct=n(ll,"A",{href:!0});var Qd=i(ct);ji=a(Qd,"DiffusionPipeline"),Qd.forEach(t),Zi=a(ll," class is the simplest and most generic way to load any diffusion model from the "),fl=n(ll,"A",{href:!0,rel:!0});var Xd=i(fl);Ei=a(Xd,"Hub"),Xd.forEach(t),_i=a(ll,". The "),dt=n(ll,"A",{href:!0});var qd=i(dt);ki=a(qd,"DiffusionPipeline.from_pretrained()"),qd.forEach(t),Ii=a(ll," method automatically detects the correct pipeline class from the checkpoint, downloads and caches all the required configuration and weight files, and returns a pipeline instance ready for inference."),ll.forEach(t),mo=c(e),h(cl.$$.fragment,e),yo=c(e),be=n(e,"P",{});var Dn=i(be);Ci=a(Dn,"You can also load a checkpoint with it\u2019s specific pipeline class. The example above loaded a Stable Diffusion model; to get the same result, use the "),ut=n(Dn,"A",{href:!0});var xd=i(ut);gi=a(xd,"StableDiffusionPipeline"),xd.forEach(t),Wi=a(Dn," class:"),Dn.forEach(t),Mo=c(e),h(dl.$$.fragment,e),Jo=c(e),z=n(e,"P",{});var Pt=i(z);Vi=a(Pt,"A checkpoint (such as "),ul=n(Pt,"A",{href:!0,rel:!0});var Pd=i(ul);hs=n(Pd,"CODE",{});var Yd=i(hs);Ni=a(Yd,"CompVis/stable-diffusion-v1-4"),Yd.forEach(t),Pd.forEach(t),Ri=a(Pt," or "),hl=n(Pt,"A",{href:!0,rel:!0});var zd=i(hl);ms=n(zd,"CODE",{});var Fd=i(ms);Di=a(Fd,"runwayml/stable-diffusion-v1-5"),Fd.forEach(t),zd.forEach(t),$i=a(Pt,") may also be used for more than one task, like text-to-image or image-to-image. To differentiate what task you want to use the checkpoint for, you have to load it directly with it\u2019s corresponding task-specific pipeline class:"),Pt.forEach(t),wo=c(e),h(ml.$$.fragment,e),Uo=c(e),ne=n(e,"H3",{class:!0});var $n=i(ne);je=n($n,"A",{id:!0,class:!0,href:!0});var Hd=i(je);ys=n(Hd,"SPAN",{});var Od=i(ys);h(yl.$$.fragment,Od),Od.forEach(t),Hd.forEach(t),Bi=c($n),Ms=n($n,"SPAN",{});var Ld=i(Ms);Gi=a(Ld,"Local pipeline"),Ld.forEach(t),$n.forEach(t),vo=c(e),B=n(e,"P",{});var tl=i(B);Ai=a(tl,"To load a diffusion pipeline locally, use "),Ml=n(tl,"A",{href:!0,rel:!0});var Kd=i(Ml);Js=n(Kd,"CODE",{});var eu=i(Js);Si=a(eu,"git-lfs"),eu.forEach(t),Kd.forEach(t),Qi=a(tl," to manually download the checkpoint (in this case, "),Jl=n(tl,"A",{href:!0,rel:!0});var lu=i(Jl);ws=n(lu,"CODE",{});var tu=i(ws);Xi=a(tu,"runwayml/stable-diffusion-v1-5"),tu.forEach(t),lu.forEach(t),qi=a(tl,") to your local disk. This creates a local folder, "),Us=n(tl,"CODE",{});var su=i(Us);xi=a(su,"./stable-diffusion-v1-5"),su.forEach(t),Pi=a(tl,", on your disk:"),tl.forEach(t),To=c(e),h(wl.$$.fragment,e),bo=c(e),Ze=n(e,"P",{});var Bn=i(Ze);Yi=a(Bn,"Then pass the local path to "),ht=n(Bn,"A",{href:!0});var au=i(ht);zi=a(au,"from_pretrained()"),au.forEach(t),Fi=a(Bn,":"),Bn.forEach(t),jo=c(e),h(Ul.$$.fragment,e),Zo=c(e),Ee=n(e,"P",{});var Gn=i(Ee);Hi=a(Gn,"The "),mt=n(Gn,"A",{href:!0});var ou=i(mt);Oi=a(ou,"from_pretrained()"),ou.forEach(t),Li=a(Gn," method won\u2019t download any files from the Hub when it detects a local path, but this also means it won\u2019t download and cache the latest changes to a checkpoint."),Gn.forEach(t),Eo=c(e),ie=n(e,"H3",{class:!0});var An=i(ie);_e=n(An,"A",{id:!0,class:!0,href:!0});var nu=i(_e);vs=n(nu,"SPAN",{});var iu=i(vs);h(vl.$$.fragment,iu),iu.forEach(t),nu.forEach(t),Ki=c(An),Ts=n(An,"SPAN",{});var ru=i(Ts);er=a(ru,"Swap components in a pipeline"),ru.forEach(t),An.forEach(t),_o=c(e),yt=n(e,"P",{});var pu=i(yt);lr=a(pu,"You can customize the default components of any pipeline with another compatible component. Customization is important because:"),pu.forEach(t),ko=c(e),F=n(e,"UL",{});var Yt=i(F);bs=n(Yt,"LI",{});var fu=i(bs);tr=a(fu,"Changing the scheduler is important for exploring the trade-off between generation speed and quality."),fu.forEach(t),sr=c(Yt),js=n(Yt,"LI",{});var cu=i(js);ar=a(cu,"Different components of a model are typically trained independently and you can swap out a component with a better-performing one."),cu.forEach(t),or=c(Yt),Zs=n(Yt,"LI",{});var du=i(Zs);nr=a(du,"During finetuning, usually only some components - like the UNet or text encoder - are trained."),du.forEach(t),Yt.forEach(t),Io=c(e),ke=n(e,"P",{});var Sn=i(ke);ir=a(Sn,"To find out which schedulers are compatible for customization, you can use the "),Es=n(Sn,"CODE",{});var uu=i(Es);rr=a(uu,"compatibles"),uu.forEach(t),pr=a(Sn," method:"),Sn.forEach(t),Co=c(e),h(Tl.$$.fragment,e),go=c(e),k=n(e,"P",{});var q=i(k);fr=a(q,"Let\u2019s use the "),Mt=n(q,"A",{href:!0});var hu=i(Mt);cr=a(hu,"SchedulerMixin.from_pretrained()"),hu.forEach(t),dr=a(q," method to replace the default "),Jt=n(q,"A",{href:!0});var mu=i(Jt);ur=a(mu,"PNDMScheduler"),mu.forEach(t),hr=a(q," with a more performant scheduler, "),wt=n(q,"A",{href:!0});var yu=i(wt);mr=a(yu,"EulerDiscreteScheduler"),yu.forEach(t),yr=a(q,". The "),_s=n(q,"CODE",{});var Mu=i(_s);Mr=a(Mu,'subfolder="scheduler"'),Mu.forEach(t),Jr=a(q," argument is required to load the scheduler configuration from the correct "),bl=n(q,"A",{href:!0,rel:!0});var Ju=i(bl);wr=a(Ju,"subfolder"),Ju.forEach(t),Ur=a(q," of the pipeline repository."),q.forEach(t),Wo=c(e),G=n(e,"P",{});var sl=i(G);vr=a(sl,"Then you can pass the new "),Ut=n(sl,"A",{href:!0});var wu=i(Ut);Tr=a(wu,"EulerDiscreteScheduler"),wu.forEach(t),br=a(sl," instance to the "),ks=n(sl,"CODE",{});var Uu=i(ks);jr=a(Uu,"scheduler"),Uu.forEach(t),Zr=a(sl," argument in "),vt=n(sl,"A",{href:!0});var vu=i(vt);Er=a(vu,"DiffusionPipeline"),vu.forEach(t),_r=a(sl,":"),sl.forEach(t),Vo=c(e),h(jl.$$.fragment,e),No=c(e),re=n(e,"H3",{class:!0});var Qn=i(re);Ie=n(Qn,"A",{id:!0,class:!0,href:!0});var Tu=i(Ie);Is=n(Tu,"SPAN",{});var bu=i(Is);h(Zl.$$.fragment,bu),bu.forEach(t),Tu.forEach(t),kr=c(Qn),Cs=n(Qn,"SPAN",{});var ju=i(Cs);Ir=a(ju,"Safety checker"),ju.forEach(t),Qn.forEach(t),Ro=c(e),A=n(e,"P",{});var al=i(A);Cr=a(al,"Diffusion models like Stable Diffusion can generate harmful content, which is why \u{1F9E8} Diffusers has a "),El=n(al,"A",{href:!0,rel:!0});var Zu=i(El);gr=a(Zu,"safety checker"),Zu.forEach(t),Wr=a(al," to check generated outputs against known hardcoded NSFW content. If you\u2019d like to disable the safety checker for whatever reason, pass "),gs=n(al,"CODE",{});var Eu=i(gs);Vr=a(Eu,"None"),Eu.forEach(t),Nr=a(al," to the "),Ws=n(al,"CODE",{});var _u=i(Ws);Rr=a(_u,"safety_checker"),_u.forEach(t),Dr=a(al," argument:"),al.forEach(t),Do=c(e),h(_l.$$.fragment,e),$o=c(e),pe=n(e,"H3",{class:!0});var Xn=i(pe);Ce=n(Xn,"A",{id:!0,class:!0,href:!0});var ku=i(Ce);Vs=n(ku,"SPAN",{});var Iu=i(Vs);h(kl.$$.fragment,Iu),Iu.forEach(t),ku.forEach(t),$r=c(Xn),Ns=n(Xn,"SPAN",{});var Cu=i(Ns);Br=a(Cu,"Reuse components across pipelines"),Cu.forEach(t),Xn.forEach(t),Bo=c(e),ge=n(e,"P",{});var qn=i(ge);Gr=a(qn,"You can also reuse the same components in multiple pipelines to avoid loading the weights into RAM twice. Use the "),Tt=n(qn,"A",{href:!0});var gu=i(Tt);Ar=a(gu,"components"),gu.forEach(t),Sr=a(qn," method to save the components:"),qn.forEach(t),Go=c(e),h(Il.$$.fragment,e),Ao=c(e),We=n(e,"P",{});var xn=i(We);Qr=a(xn,"Then you can pass the "),Rs=n(xn,"CODE",{});var Wu=i(Rs);Xr=a(Wu,"components"),Wu.forEach(t),qr=a(xn," to another pipeline without reloading the weights into RAM:"),xn.forEach(t),So=c(e),h(Cl.$$.fragment,e),Qo=c(e),bt=n(e,"P",{});var Vu=i(bt);xr=a(Vu,"You can also pass the components individually to the pipeline if you want more flexibility over which components to reuse or disable. For example, to reuse the same components in the text-to-image pipeline, except for the safety checker and feature extractor, in the image-to-image pipeline:"),Vu.forEach(t),Xo=c(e),h(gl.$$.fragment,e),qo=c(e),fe=n(e,"H2",{class:!0});var Pn=i(fe);Ve=n(Pn,"A",{id:!0,class:!0,href:!0});var Nu=i(Ve);Ds=n(Nu,"SPAN",{});var Ru=i(Ds);h(Wl.$$.fragment,Ru),Ru.forEach(t),Nu.forEach(t),Pr=c(Pn),$s=n(Pn,"SPAN",{});var Du=i($s);Yr=a(Du,"Checkpoint variants"),Du.forEach(t),Pn.forEach(t),xo=c(e),jt=n(e,"P",{});var $u=i(jt);zr=a($u,"A checkpoint variant is usually a checkpoint where it\u2019s weights are:"),$u.forEach(t),Po=c(e),Ne=n(e,"UL",{});var Yn=i(Ne);Vl=n(Yn,"LI",{});var zn=i(Vl);Fr=a(zn,"Stored in a different floating point type for lower precision and lower storage, such as "),Nl=n(zn,"A",{href:!0,rel:!0});var Bu=i(Nl);Bs=n(Bu,"CODE",{});var Gu=i(Bs);Hr=a(Gu,"torch.float16"),Gu.forEach(t),Bu.forEach(t),Or=a(zn,", because it only requires half the bandwidth and storage to download. You can\u2019t use this variant if you\u2019re continuing training or using a CPU."),zn.forEach(t),Lr=c(Yn),Gs=n(Yn,"LI",{});var Au=i(Gs);Kr=a(Au,"Non-exponential mean averaged (EMA) weights which shouldn\u2019t be used for inference. You should use these to continue finetuning a model."),Au.forEach(t),Yn.forEach(t),Yo=c(e),h(Re.$$.fragment,e),zo=c(e),H=n(e,"P",{});var zt=i(H);ep=a(zt,"Otherwise, a variant is "),As=n(zt,"STRONG",{});var Su=i(As);lp=a(Su,"identical"),Su.forEach(t),tp=a(zt," to the original checkpoint. They have exactly the same serialization format (like "),Zt=n(zt,"A",{href:!0});var Qu=i(Zt);sp=a(Qu,"Safetensors"),Qu.forEach(t),ap=a(zt,"), model structure, and weights have identical tensor shapes."),zt.forEach(t),Fo=c(e),De=n(e,"TABLE",{});var Fn=i(De);Ss=n(Fn,"THEAD",{});var Xu=i(Ss);ce=n(Xu,"TR",{});var Ft=i(ce);Qs=n(Ft,"TH",{});var qu=i(Qs);Xs=n(qu,"STRONG",{});var xu=i(Xs);op=a(xu,"checkpoint type"),xu.forEach(t),qu.forEach(t),np=c(Ft),qs=n(Ft,"TH",{});var Pu=i(qs);xs=n(Pu,"STRONG",{});var Yu=i(xs);ip=a(Yu,"weight name"),Yu.forEach(t),Pu.forEach(t),rp=c(Ft),Ps=n(Ft,"TH",{});var zu=i(Ps);Ys=n(zu,"STRONG",{});var Fu=i(Ys);pp=a(Fu,"argument for loading weights"),Fu.forEach(t),zu.forEach(t),Ft.forEach(t),Xu.forEach(t),fp=c(Fn),de=n(Fn,"TBODY",{});var Ht=i(de);ue=n(Ht,"TR",{});var Ot=i(ue);zs=n(Ot,"TD",{});var Hu=i(zs);cp=a(Hu,"original"),Hu.forEach(t),dp=c(Ot),Fs=n(Ot,"TD",{});var Ou=i(Fs);up=a(Ou,"diffusion_pytorch_model.bin"),Ou.forEach(t),hp=c(Ot),Ho=n(Ot,"TD",{}),i(Ho).forEach(t),Ot.forEach(t),mp=c(Ht),he=n(Ht,"TR",{});var Lt=i(he);Hs=n(Lt,"TD",{});var Lu=i(Hs);yp=a(Lu,"floating point"),Lu.forEach(t),Mp=c(Lt),Os=n(Lt,"TD",{});var Ku=i(Os);Jp=a(Ku,"diffusion_pytorch_model.fp16.bin"),Ku.forEach(t),wp=c(Lt),Rl=n(Lt,"TD",{});var Hn=i(Rl);Ls=n(Hn,"CODE",{});var eh=i(Ls);Up=a(eh,"variant"),eh.forEach(t),vp=a(Hn,", "),Ks=n(Hn,"CODE",{});var lh=i(Ks);Tp=a(lh,"torch_dtype"),lh.forEach(t),Hn.forEach(t),Lt.forEach(t),bp=c(Ht),me=n(Ht,"TR",{});var Kt=i(me);ea=n(Kt,"TD",{});var th=i(ea);jp=a(th,"non-EMA"),th.forEach(t),Zp=c(Kt),la=n(Kt,"TD",{});var sh=i(la);Ep=a(sh,"diffusion_pytorch_model.non_ema.bin"),sh.forEach(t),_p=c(Kt),ta=n(Kt,"TD",{});var ah=i(ta);sa=n(ah,"CODE",{});var oh=i(sa);kp=a(oh,"variant"),oh.forEach(t),ah.forEach(t),Kt.forEach(t),Ht.forEach(t),Fn.forEach(t),Oo=c(e),Et=n(e,"P",{});var nh=i(Et);Ip=a(nh,"There are two important arguments to know for loading variants:"),nh.forEach(t),Lo=c(e),$e=n(e,"UL",{});var On=i($e);aa=n(On,"LI",{});var ih=i(aa);U=n(ih,"P",{});var v=i(U);oa=n(v,"CODE",{});var rh=i(oa);Cp=a(rh,"torch_dtype"),rh.forEach(t),gp=a(v," defines the floating point precision of the loaded checkpoints. For example, if you want to save bandwidth by loading a "),na=n(v,"CODE",{});var ph=i(na);Wp=a(ph,"fp16"),ph.forEach(t),Vp=a(v," variant, you should specify "),ia=n(v,"CODE",{});var fh=i(ia);Np=a(fh,"torch_dtype=torch.float16"),fh.forEach(t),Rp=a(v," to "),ra=n(v,"EM",{});var ch=i(ra);Dp=a(ch,"convert the weights"),ch.forEach(t),$p=a(v," to "),pa=n(v,"CODE",{});var dh=i(pa);Bp=a(dh,"fp16"),dh.forEach(t),Gp=a(v,". Otherwise, the "),fa=n(v,"CODE",{});var uh=i(fa);Ap=a(uh,"fp16"),uh.forEach(t),Sp=a(v," weights are converted to the default "),ca=n(v,"CODE",{});var hh=i(ca);Qp=a(hh,"fp32"),hh.forEach(t),Xp=a(v," precision. You can also load the original checkpoint without defining the "),da=n(v,"CODE",{});var mh=i(da);qp=a(mh,"variant"),mh.forEach(t),xp=a(v," argument, and convert it to "),ua=n(v,"CODE",{});var yh=i(ua);Pp=a(yh,"fp16"),yh.forEach(t),Yp=a(v," with "),ha=n(v,"CODE",{});var Mh=i(ha);zp=a(Mh,"torch_dtype=torch.float16"),Mh.forEach(t),Fp=a(v,". In this case, the default "),ma=n(v,"CODE",{});var Jh=i(ma);Hp=a(Jh,"fp32"),Jh.forEach(t),Op=a(v," weights are downloaded first, and then they\u2019re converted to "),ya=n(v,"CODE",{});var wh=i(ya);Lp=a(wh,"fp16"),wh.forEach(t),Kp=a(v," after loading."),v.forEach(t),ih.forEach(t),ef=c(On),Ma=n(On,"LI",{});var Uh=i(Ma);g=n(Uh,"P",{});var Y=i(g);Ja=n(Y,"CODE",{});var vh=i(Ja);lf=a(vh,"variant"),vh.forEach(t),tf=a(Y," defines which files should be loaded from the repository. For example, if you want to load a "),wa=n(Y,"CODE",{});var Th=i(wa);sf=a(Th,"non_ema"),Th.forEach(t),af=a(Y," variant from the "),Dl=n(Y,"A",{href:!0,rel:!0});var bh=i(Dl);Ua=n(bh,"CODE",{});var jh=i(Ua);of=a(jh,"diffusers/stable-diffusion-variants"),jh.forEach(t),bh.forEach(t),nf=a(Y," repository, you should specify "),va=n(Y,"CODE",{});var Zh=i(va);rf=a(Zh,'variant="non_ema"'),Zh.forEach(t),pf=a(Y," to download the "),Ta=n(Y,"CODE",{});var Eh=i(Ta);ff=a(Eh,"non_ema"),Eh.forEach(t),cf=a(Y," files."),Y.forEach(t),Uh.forEach(t),On.forEach(t),Ko=c(e),h($l.$$.fragment,e),en=c(e),O=n(e,"P",{});var es=i(O);df=a(es,"To save a checkpoint stored in a different floating point type or as a non-EMA variant, use the "),_t=n(es,"A",{href:!0});var _h=i(_t);uf=a(_h,"DiffusionPipeline.save_pretrained()"),_h.forEach(t),hf=a(es," method and specify the "),ba=n(es,"CODE",{});var kh=i(ba);mf=a(kh,"variant"),kh.forEach(t),yf=a(es," argument. You should try and save a variant to the same folder as the original checkpoint, so you can load both from the same folder:"),es.forEach(t),ln=c(e),h(Bl.$$.fragment,e),tn=c(e),L=n(e,"P",{});var ls=i(L);Mf=a(ls,"If you don\u2019t save the variant to an existing folder, you must specify the "),ja=n(ls,"CODE",{});var Ih=i(ja);Jf=a(Ih,"variant"),Ih.forEach(t),wf=a(ls," argument otherwise it\u2019ll throw an "),Za=n(ls,"CODE",{});var Ch=i(Za);Uf=a(Ch,"Exception"),Ch.forEach(t),vf=a(ls," because it can\u2019t find the original checkpoint:"),ls.forEach(t),sn=c(e),h(Gl.$$.fragment,e),an=c(e),ye=n(e,"H2",{class:!0});var Ln=i(ye);Be=n(Ln,"A",{id:!0,class:!0,href:!0});var gh=i(Be);Ea=n(gh,"SPAN",{});var Wh=i(Ea);h(Al.$$.fragment,Wh),Wh.forEach(t),gh.forEach(t),Tf=c(Ln),_a=n(Ln,"SPAN",{});var Vh=i(_a);bf=a(Vh,"Models"),Vh.forEach(t),Ln.forEach(t),on=c(e),K=n(e,"P",{});var ts=i(K);jf=a(ts,"Models are loaded from the "),kt=n(ts,"A",{href:!0});var Nh=i(kt);Zf=a(Nh,"ModelMixin.from_pretrained()"),Nh.forEach(t),Ef=a(ts," method, which downloads and caches the latest version of the model weights and configurations. If the latest files are available in the local cache, "),It=n(ts,"A",{href:!0});var Rh=i(It);_f=a(Rh,"from_pretrained()"),Rh.forEach(t),kf=a(ts," reuses files in the cache instead of redownloading them."),ts.forEach(t),nn=c(e),S=n(e,"P",{});var ol=i(S);If=a(ol,"Models can be loaded from a subfolder with the "),ka=n(ol,"CODE",{});var Dh=i(ka);Cf=a(Dh,"subfolder"),Dh.forEach(t),gf=a(ol," argument. For example, the model weights for "),Ia=n(ol,"CODE",{});var $h=i(Ia);Wf=a($h,"runwayml/stable-diffusion-v1-5"),$h.forEach(t),Vf=a(ol," are stored in the "),Sl=n(ol,"A",{href:!0,rel:!0});var Bh=i(Sl);Ca=n(Bh,"CODE",{});var Gh=i(Ca);Nf=a(Gh,"unet"),Gh.forEach(t),Bh.forEach(t),Rf=a(ol," subfolder:"),ol.forEach(t),rn=c(e),h(Ql.$$.fragment,e),pn=c(e),Ge=n(e,"P",{});var Kn=i(Ge);Df=a(Kn,"Or directly from a repository\u2019s "),Xl=n(Kn,"A",{href:!0,rel:!0});var Ah=i(Xl);$f=a(Ah,"directory"),Ah.forEach(t),Bf=a(Kn,":"),Kn.forEach(t),fn=c(e),h(ql.$$.fragment,e),cn=c(e),Q=n(e,"P",{});var nl=i(Q);Gf=a(nl,"You can also load and save model variants by specifying the "),ga=n(nl,"CODE",{});var Sh=i(ga);Af=a(Sh,"variant"),Sh.forEach(t),Sf=a(nl," argument in "),Ct=n(nl,"A",{href:!0});var Qh=i(Ct);Qf=a(Qh,"ModelMixin.from_pretrained()"),Qh.forEach(t),Xf=a(nl," and "),gt=n(nl,"A",{href:!0});var Xh=i(gt);qf=a(Xh,"ModelMixin.save_pretrained()"),Xh.forEach(t),xf=a(nl,":"),nl.forEach(t),dn=c(e),h(xl.$$.fragment,e),un=c(e),Me=n(e,"H2",{class:!0});var ei=i(Me);Ae=n(ei,"A",{id:!0,class:!0,href:!0});var qh=i(Ae);Wa=n(qh,"SPAN",{});var xh=i(Wa);h(Pl.$$.fragment,xh),xh.forEach(t),qh.forEach(t),Pf=c(ei),Va=n(ei,"SPAN",{});var Ph=i(Va);Yf=a(Ph,"Schedulers"),Ph.forEach(t),ei.forEach(t),hn=c(e),X=n(e,"P",{});var il=i(X);zf=a(il,"Schedulers are loaded from the "),Wt=n(il,"A",{href:!0});var Yh=i(Wt);Ff=a(Yh,"SchedulerMixin.from_pretrained()"),Yh.forEach(t),Hf=a(il," method, and unlike models, schedulers are "),Na=n(il,"STRONG",{});var zh=i(Na);Of=a(zh,"not parameterized"),zh.forEach(t),Lf=a(il," or "),Ra=n(il,"STRONG",{});var Fh=i(Ra);Kf=a(Fh,"trained"),Fh.forEach(t),ec=a(il,"; they are defined by a configuration file."),il.forEach(t),mn=c(e),Se=n(e,"P",{});var li=i(Se);lc=a(li,`Loading schedulers does not consume any significant amount of memory and the same configuration file can be used for a variety of different schedulers.
For example, the following schedulers are compatible with `),Vt=n(li,"A",{href:!0});var Hh=i(Vt);tc=a(Hh,"StableDiffusionPipeline"),Hh.forEach(t),sc=a(li," which means you can load the same scheduler configuration file in any of these classes:"),li.forEach(t),yn=c(e),h(Yl.$$.fragment,e),Mn=c(e),Je=n(e,"H2",{class:!0});var ti=i(Je);Qe=n(ti,"A",{id:!0,class:!0,href:!0});var Oh=i(Qe);Da=n(Oh,"SPAN",{});var Lh=i(Da);h(zl.$$.fragment,Lh),Lh.forEach(t),Oh.forEach(t),ac=c(ti),$a=n(ti,"SPAN",{});var Kh=i($a);oc=a(Kh,"DiffusionPipeline explained"),Kh.forEach(t),ti.forEach(t),Jn=c(e),Xe=n(e,"P",{});var si=i(Xe);nc=a(si,"As a class method, "),Nt=n(si,"A",{href:!0});var em=i(Nt);ic=a(em,"DiffusionPipeline.from_pretrained()"),em.forEach(t),rc=a(si," is responsible for two things:"),si.forEach(t),wn=c(e),qe=n(e,"UL",{});var ai=i(qe);Fl=n(ai,"LI",{});var oi=i(Fl);pc=a(oi,"Download the latest version of the folder structure required for inference and cache it. If the latest folder structure is available in the local cache, "),Rt=n(oi,"A",{href:!0});var lm=i(Rt);fc=a(lm,"DiffusionPipeline.from_pretrained()"),lm.forEach(t),cc=a(oi," reuses the cache and won\u2019t redownload the files."),oi.forEach(t),dc=c(ai),we=n(ai,"LI",{});var ss=i(we);uc=a(ss,"Load the cached weights into the correct pipeline "),Dt=n(ss,"A",{href:!0});var tm=i(Dt);hc=a(tm,"class"),tm.forEach(t),mc=a(ss," - retrieved from the "),Ba=n(ss,"CODE",{});var sm=i(Ba);yc=a(sm,"model_index.json"),sm.forEach(t),Mc=a(ss," file - and return an instance of it."),ss.forEach(t),ai.forEach(t),Un=c(e),ee=n(e,"P",{});var as=i(ee);Jc=a(as,"The pipelines underlying folder structure corresponds directly with their class instances. For example, the "),$t=n(as,"A",{href:!0});var am=i($t);wc=a(am,"StableDiffusionPipeline"),am.forEach(t),Uc=a(as," corresponds to the folder structure in "),Hl=n(as,"A",{href:!0,rel:!0});var om=i(Hl);Ga=n(om,"CODE",{});var nm=i(Ga);vc=a(nm,"runwayml/stable-diffusion-v1-5"),nm.forEach(t),om.forEach(t),Tc=a(as,"."),as.forEach(t),vn=c(e),h(Ol.$$.fragment,e),Tn=c(e),xe=n(e,"P",{});var ni=i(xe);bc=a(ni,"You\u2019ll see pipeline is an instance of "),Bt=n(ni,"A",{href:!0});var im=i(Bt);jc=a(im,"StableDiffusionPipeline"),im.forEach(t),Zc=a(ni,", which consists of seven components:"),ni.forEach(t),bn=c(e),E=n(e,"UL",{});var W=i(E);Pe=n(W,"LI",{});var lo=i(Pe);Aa=n(lo,"CODE",{});var rm=i(Aa);Ec=a(rm,'"feature_extractor"'),rm.forEach(t),_c=a(lo,": a "),Ll=n(lo,"A",{href:!0,rel:!0});var pm=i(Ll);kc=a(pm,"CLIPFeatureExtractor"),pm.forEach(t),Ic=a(lo," from \u{1F917} Transformers."),lo.forEach(t),Cc=c(W),Ye=n(W,"LI",{});var to=i(Ye);Sa=n(to,"CODE",{});var fm=i(Sa);gc=a(fm,'"safety_checker"'),fm.forEach(t),Wc=a(to,": a "),Kl=n(to,"A",{href:!0,rel:!0});var cm=i(Kl);Vc=a(cm,"component"),cm.forEach(t),Nc=a(to," for screening against harmful content."),to.forEach(t),Rc=c(W),ze=n(W,"LI",{});var so=i(ze);Qa=n(so,"CODE",{});var dm=i(Qa);Dc=a(dm,'"scheduler"'),dm.forEach(t),$c=a(so,": an instance of "),Gt=n(so,"A",{href:!0});var um=i(Gt);Bc=a(um,"PNDMScheduler"),um.forEach(t),Gc=a(so,"."),so.forEach(t),Ac=c(W),Fe=n(W,"LI",{});var ao=i(Fe);Xa=n(ao,"CODE",{});var hm=i(Xa);Sc=a(hm,'"text_encoder"'),hm.forEach(t),Qc=a(ao,": a "),et=n(ao,"A",{href:!0,rel:!0});var mm=i(et);Xc=a(mm,"CLIPTextModel"),mm.forEach(t),qc=a(ao," from \u{1F917} Transformers."),ao.forEach(t),xc=c(W),He=n(W,"LI",{});var oo=i(He);qa=n(oo,"CODE",{});var ym=i(qa);Pc=a(ym,'"tokenizer"'),ym.forEach(t),Yc=a(oo,": a "),lt=n(oo,"A",{href:!0,rel:!0});var Mm=i(lt);zc=a(Mm,"CLIPTokenizer"),Mm.forEach(t),Fc=a(oo," from \u{1F917} Transformers."),oo.forEach(t),Hc=c(W),Oe=n(W,"LI",{});var no=i(Oe);xa=n(no,"CODE",{});var Jm=i(xa);Oc=a(Jm,'"unet"'),Jm.forEach(t),Lc=a(no,": an instance of "),At=n(no,"A",{href:!0});var wm=i(At);Kc=a(wm,"UNet2DConditionModel"),wm.forEach(t),ed=a(no,"."),no.forEach(t),ld=c(W),Le=n(W,"LI",{});var io=i(Le);Pa=n(io,"CODE",{});var Um=i(Pa);td=a(Um,'"vae"'),Um.forEach(t),sd=a(io," an instance of "),St=n(io,"A",{href:!0});var vm=i(St);ad=a(vm,"AutoencoderKL"),vm.forEach(t),od=a(io,"."),io.forEach(t),W.forEach(t),jn=c(e),h(tt.$$.fragment,e),Zn=c(e),Ke=n(e,"P",{});var ii=i(Ke);nd=a(ii,"Compare the components of the pipeline instance to the "),st=n(ii,"A",{href:!0,rel:!0});var Tm=i(st);Ya=n(Tm,"CODE",{});var bm=i(Ya);id=a(bm,"runwayml/stable-diffusion-v1-5"),bm.forEach(t),Tm.forEach(t),rd=a(ii," folder structure, and you\u2019ll see there is a separate folder for each of the components in the repository:"),ii.forEach(t),En=c(e),h(at.$$.fragment,e),_n=c(e),Qt=n(e,"P",{});var jm=i(Qt);pd=a(jm,"You can access each of the components of the pipeline as an attribute to view its configuration:"),jm.forEach(t),kn=c(e),h(ot.$$.fragment,e),In=c(e),le=n(e,"P",{});var os=i(le);fd=a(os,"Every pipeline expects a "),za=n(os,"CODE",{});var Zm=i(za);cd=a(Zm,"model_index.json"),Zm.forEach(t),dd=a(os," file that tells the "),Xt=n(os,"A",{href:!0});var Em=i(Xt);ud=a(Em,"DiffusionPipeline"),Em.forEach(t),hd=a(os,":"),os.forEach(t),Cn=c(e),te=n(e,"UL",{});var ns=i(te);qt=n(ns,"LI",{});var kd=i(qt);md=a(kd,"which pipeline class to load from "),Fa=n(kd,"CODE",{});var _m=i(Fa);yd=a(_m,"_class_name"),_m.forEach(t),kd.forEach(t),Md=c(ns),xt=n(ns,"LI",{});var Id=i(xt);Jd=a(Id,"which version of \u{1F9E8} Diffusers was used to create the model in "),Ha=n(Id,"CODE",{});var km=i(Ha);wd=a(km,"_diffusers_version"),km.forEach(t),Id.forEach(t),Ud=c(ns),P=n(ns,"LI",{});var rl=i(P);vd=a(rl,"what components from which library are stored in the subfolders ("),Oa=n(rl,"CODE",{});var Im=i(Oa);Td=a(Im,"name"),Im.forEach(t),bd=a(rl," corresponds to the component and subfolder name, "),La=n(rl,"CODE",{});var Cm=i(La);jd=a(Cm,"library"),Cm.forEach(t),Zd=a(rl," corresponds to the name of the library to load the class from, and "),Ka=n(rl,"CODE",{});var gm=i(Ka);Ed=a(gm,"class"),gm.forEach(t),_d=a(rl," corresponds to the class name)"),rl.forEach(t),ns.forEach(t),gn=c(e),h(nt.$$.fragment,e),this.h()},h(){d(w,"name","hf:doc:metadata"),d(w,"content",JSON.stringify(Sm)),d(_,"id","load-pipelines-models-and-schedulers"),d(_,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(_,"href","#load-pipelines-models-and-schedulers"),d(b,"class","relative group"),d(pt,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),d(ve,"id","diffusion-pipeline"),d(ve,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ve,"href","#diffusion-pipeline"),d(oe,"class","relative group"),d(ct,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),d(fl,"href","https://huggingface.co/models?library=diffusers"),d(fl,"rel","nofollow"),d(dt,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),d(ut,"href","/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),d(ul,"href","https://huggingface.co/CompVis/stable-diffusion-v1-4"),d(ul,"rel","nofollow"),d(hl,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5"),d(hl,"rel","nofollow"),d(je,"id","local-pipeline"),d(je,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(je,"href","#local-pipeline"),d(ne,"class","relative group"),d(Ml,"href","https://git-lfs.github.com/"),d(Ml,"rel","nofollow"),d(Jl,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5"),d(Jl,"rel","nofollow"),d(ht,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),d(mt,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),d(_e,"id","swap-components-in-a-pipeline"),d(_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"),d(_e,"href","#swap-components-in-a-pipeline"),d(ie,"class","relative group"),d(Mt,"href","/docs/diffusers/v0.17.0/en/api/schedulers/overview#diffusers.SchedulerMixin.from_pretrained"),d(Jt,"href","/docs/diffusers/v0.17.0/en/api/schedulers/pndm#diffusers.PNDMScheduler"),d(wt,"href","/docs/diffusers/v0.17.0/en/api/schedulers/euler#diffusers.EulerDiscreteScheduler"),d(bl,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5/tree/main/scheduler"),d(bl,"rel","nofollow"),d(Ut,"href","/docs/diffusers/v0.17.0/en/api/schedulers/euler#diffusers.EulerDiscreteScheduler"),d(vt,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),d(Ie,"id","safety-checker"),d(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"),d(Ie,"href","#safety-checker"),d(re,"class","relative group"),d(El,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/safety_checker.py"),d(El,"rel","nofollow"),d(Ce,"id","reuse-components-across-pipelines"),d(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"),d(Ce,"href","#reuse-components-across-pipelines"),d(pe,"class","relative group"),d(Tt,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.components"),d(Ve,"id","checkpoint-variants"),d(Ve,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Ve,"href","#checkpoint-variants"),d(fe,"class","relative group"),d(Nl,"href","https://pytorch.org/docs/stable/tensors.html#data-types"),d(Nl,"rel","nofollow"),d(Zt,"href","./using-diffusers/using_safetensors"),d(Dl,"href","https://huggingface.co/diffusers/stable-diffusion-variants/tree/main/unet"),d(Dl,"rel","nofollow"),d(_t,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.save_pretrained"),d(Be,"id","models"),d(Be,"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"),d(Be,"href","#models"),d(ye,"class","relative group"),d(kt,"href","/docs/diffusers/v0.17.0/en/api/models#diffusers.ModelMixin.from_pretrained"),d(It,"href","/docs/diffusers/v0.17.0/en/api/models#diffusers.ModelMixin.from_pretrained"),d(Sl,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5/tree/main/unet"),d(Sl,"rel","nofollow"),d(Xl,"href","https://huggingface.co/google/ddpm-cifar10-32/tree/main"),d(Xl,"rel","nofollow"),d(Ct,"href","/docs/diffusers/v0.17.0/en/api/models#diffusers.ModelMixin.from_pretrained"),d(gt,"href","/docs/diffusers/v0.17.0/en/api/models#diffusers.ModelMixin.save_pretrained"),d(Ae,"id","schedulers"),d(Ae,"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"),d(Ae,"href","#schedulers"),d(Me,"class","relative group"),d(Wt,"href","/docs/diffusers/v0.17.0/en/api/schedulers/overview#diffusers.SchedulerMixin.from_pretrained"),d(Vt,"href","/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),d(Qe,"id","diffusionpipeline-explained"),d(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"),d(Qe,"href","#diffusionpipeline-explained"),d(Je,"class","relative group"),d(Nt,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),d(Rt,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),d(Dt,"href","./api/pipelines/overview#diffusers-summary"),d($t,"href","/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),d(Hl,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5"),d(Hl,"rel","nofollow"),d(Bt,"href","/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),d(Ll,"href","https://huggingface.co/docs/transformers/v4.30.1/en/model_doc/clip#transformers.CLIPFeatureExtractor"),d(Ll,"rel","nofollow"),d(Kl,"href","https://github.com/huggingface/diffusers/blob/e55687e1e15407f60f32242027b7bb8170e58266/src/diffusers/pipelines/stable_diffusion/safety_checker.py#L32"),d(Kl,"rel","nofollow"),d(Gt,"href","/docs/diffusers/v0.17.0/en/api/schedulers/pndm#diffusers.PNDMScheduler"),d(et,"href","https://huggingface.co/docs/transformers/v4.30.1/en/model_doc/clip#transformers.CLIPTextModel"),d(et,"rel","nofollow"),d(lt,"href","https://huggingface.co/docs/transformers/v4.30.1/en/model_doc/clip#transformers.CLIPTokenizer"),d(lt,"rel","nofollow"),d(At,"href","/docs/diffusers/v0.17.0/en/api/models#diffusers.UNet2DConditionModel"),d(St,"href","/docs/diffusers/v0.17.0/en/api/models#diffusers.AutoencoderKL"),d(st,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5"),d(st,"rel","nofollow"),d(Xt,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline")},m(e,r){l(document.head,w),p(e,R,r),p(e,b,r),l(b,_),l(_,V),m(Z,V,null),l(b,x),l(b,N),l(N,I),p(e,j,r),p(e,C,r),l(C,ae),l(C,pt),l(pt,ri),l(C,pi),p(e,ro,r),p(e,Ue,r),l(Ue,fi),l(Ue,is),l(is,ci),l(Ue,di),p(e,po,r),p(e,ft,r),l(ft,ui),p(e,fo,r),p(e,D,r),l(D,rs),l(rs,hi),l(D,mi),l(D,ps),l(ps,yi),l(D,Mi),l(D,fs),l(fs,Ji),l(D,wi),l(D,cs),l(cs,Ui),p(e,co,r),p(e,oe,r),l(oe,ve),l(ve,ds),m(pl,ds,null),l(oe,vi),l(oe,us),l(us,Ti),p(e,uo,r),m(Te,e,r),p(e,ho,r),p(e,$,r),l($,bi),l($,ct),l(ct,ji),l($,Zi),l($,fl),l(fl,Ei),l($,_i),l($,dt),l(dt,ki),l($,Ii),p(e,mo,r),m(cl,e,r),p(e,yo,r),p(e,be,r),l(be,Ci),l(be,ut),l(ut,gi),l(be,Wi),p(e,Mo,r),m(dl,e,r),p(e,Jo,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ze,Gc),l(E,Ac),l(E,Fe),l(Fe,Xa),l(Xa,Sc),l(Fe,Qc),l(Fe,et),l(et,Xc),l(Fe,qc),l(E,xc),l(E,He),l(He,qa),l(qa,Pc),l(He,Yc),l(He,lt),l(lt,zc),l(He,Fc),l(E,Hc),l(E,Oe),l(Oe,xa),l(xa,Oc),l(Oe,Lc),l(Oe,At),l(At,Kc),l(Oe,ed),l(E,ld),l(E,Le),l(Le,Pa),l(Pa,td),l(Le,sd),l(Le,St),l(St,ad),l(Le,od),p(e,jn,r),m(tt,e,r),p(e,Zn,r),p(e,Ke,r),l(Ke,nd),l(Ke,st),l(st,Ya),l(Ya,id),l(Ke,rd),p(e,En,r),m(at,e,r),p(e,_n,r),p(e,Qt,r),l(Qt,pd),p(e,kn,r),m(ot,e,r),p(e,In,r),p(e,le,r),l(le,fd),l(le,za),l(za,cd),l(le,dd),l(le,Xt),l(Xt,ud),l(le,hd),p(e,Cn,r),p(e,te,r),l(te,qt),l(qt,md),l(qt,Fa),l(Fa,yd),l(te,Md),l(te,xt),l(xt,Jd),l(xt,Ha),l(Ha,wd),l(te,Ud),l(te,P),l(P,vd),l(P,Oa),l(Oa,Td),l(P,bd),l(P,La),l(La,jd),l(P,Zd),l(P,Ka),l(Ka,Ed),l(P,_d),p(e,gn,r),m(nt,e,r),Wn=!0},p(e,[r]){const it={};r&2&&(it.$$scope={dirty:r,ctx:e}),Te.$set(it);const eo={};r&2&&(eo.$$scope={dirty:r,ctx:e}),Re.$set(eo)},i(e){Wn||(y(Z.$$.fragment,e),y(pl.$$.fragment,e),y(Te.$$.fragment,e),y(cl.$$.fragment,e),y(dl.$$.fragment,e),y(ml.$$.fragment,e),y(yl.$$.fragment,e),y(wl.$$.fragment,e),y(Ul.$$.fragment,e),y(vl.$$.fragment,e),y(Tl.$$.fragment,e),y(jl.$$.fragment,e),y(Zl.$$.fragment,e),y(_l.$$.fragment,e),y(kl.$$.fragment,e),y(Il.$$.fragment,e),y(Cl.$$.fragment,e),y(gl.$$.fragment,e),y(Wl.$$.fragment,e),y(Re.$$.fragment,e),y($l.$$.fragment,e),y(Bl.$$.fragment,e),y(Gl.$$.fragment,e),y(Al.$$.fragment,e),y(Ql.$$.fragment,e),y(ql.$$.fragment,e),y(xl.$$.fragment,e),y(Pl.$$.fragment,e),y(Yl.$$.fragment,e),y(zl.$$.fragment,e),y(Ol.$$.fragment,e),y(tt.$$.fragment,e),y(at.$$.fragment,e),y(ot.$$.fragment,e),y(nt.$$.fragment,e),Wn=!0)},o(e){M(Z.$$.fragment,e),M(pl.$$.fragment,e),M(Te.$$.fragment,e),M(cl.$$.fragment,e),M(dl.$$.fragment,e),M(ml.$$.fragment,e),M(yl.$$.fragment,e),M(wl.$$.fragment,e),M(Ul.$$.fragment,e),M(vl.$$.fragment,e),M(Tl.$$.fragment,e),M(jl.$$.fragment,e),M(Zl.$$.fragment,e),M(_l.$$.fragment,e),M(kl.$$.fragment,e),M(Il.$$.fragment,e),M(Cl.$$.fragment,e),M(gl.$$.fragment,e),M(Wl.$$.fragment,e),M(Re.$$.fragment,e),M($l.$$.fragment,e),M(Bl.$$.fragment,e),M(Gl.$$.fragment,e),M(Al.$$.fragment,e),M(Ql.$$.fragment,e),M(ql.$$.fragment,e),M(xl.$$.fragment,e),M(Pl.$$.fragment,e),M(Yl.$$.fragment,e),M(zl.$$.fragment,e),M(Ol.$$.fragment,e),M(tt.$$.fragment,e),M(at.$$.fragment,e),M(ot.$$.fragment,e),M(nt.$$.fragment,e),Wn=!1},d(e){t(w),e&&t(R),e&&t(b),J(Z),e&&t(j),e&&t(C),e&&t(ro),e&&t(Ue),e&&t(po),e&&t(ft),e&&t(fo),e&&t(D),e&&t(co),e&&t(oe),J(pl),e&&t(uo),J(Te,e),e&&t(ho),e&&t($),e&&t(mo),J(cl,e),e&&t(yo),e&&t(be),e&&t(Mo),J(dl,e),e&&t(Jo),e&&t(z),e&&t(wo),J(ml,e),e&&t(Uo),e&&t(ne),J(yl),e&&t(vo),e&&t(B),e&&t(To),J(wl,e),e&&t(bo),e&&t(Ze),e&&t(jo),J(Ul,e),e&&t(Zo),e&&t(Ee),e&&t(Eo),e&&t(ie),J(vl),e&&t(_o),e&&t(yt),e&&t(ko),e&&t(F),e&&t(Io),e&&t(ke),e&&t(Co),J(Tl,e),e&&t(go),e&&t(k),e&&t(Wo),e&&t(G),e&&t(Vo),J(jl,e),e&&t(No),e&&t(re),J(Zl),e&&t(Ro),e&&t(A),e&&t(Do),J(_l,e),e&&t($o),e&&t(pe),J(kl),e&&t(Bo),e&&t(ge),e&&t(Go),J(Il,e),e&&t(Ao),e&&t(We),e&&t(So),J(Cl,e),e&&t(Qo),e&&t(bt),e&&t(Xo),J(gl,e),e&&t(qo),e&&t(fe),J(Wl),e&&t(xo),e&&t(jt),e&&t(Po),e&&t(Ne),e&&t(Yo),J(Re,e),e&&t(zo),e&&t(H),e&&t(Fo),e&&t(De),e&&t(Oo),e&&t(Et),e&&t(Lo),e&&t($e),e&&t(Ko),J($l,e),e&&t(en),e&&t(O),e&&t(ln),J(Bl,e),e&&t(tn),e&&t(L),e&&t(sn),J(Gl,e),e&&t(an),e&&t(ye),J(Al),e&&t(on),e&&t(K),e&&t(nn),e&&t(S),e&&t(rn),J(Ql,e),e&&t(pn),e&&t(Ge),e&&t(fn),J(ql,e),e&&t(cn),e&&t(Q),e&&t(dn),J(xl,e),e&&t(un),e&&t(Me),J(Pl),e&&t(hn),e&&t(X),e&&t(mn),e&&t(Se),e&&t(yn),J(Yl,e),e&&t(Mn),e&&t(Je),J(zl),e&&t(Jn),e&&t(Xe),e&&t(wn),e&&t(qe),e&&t(Un),e&&t(ee),e&&t(vn),J(Ol,e),e&&t(Tn),e&&t(xe),e&&t(bn),e&&t(E),e&&t(jn),J(tt,e),e&&t(Zn),e&&t(Ke),e&&t(En),J(at,e),e&&t(_n),e&&t(Qt),e&&t(kn),J(ot,e),e&&t(In),e&&t(le),e&&t(Cn),e&&t(te),e&&t(gn),J(nt,e)}}}const Sm={local:"load-pipelines-models-and-schedulers",sections:[{local:"diffusion-pipeline",sections:[{local:"local-pipeline",title:"Local pipeline"},{local:"swap-components-in-a-pipeline",title:"Swap components in a pipeline"},{local:"safety-checker",title:"Safety checker"},{local:"reuse-components-across-pipelines",title:"Reuse components across pipelines"}],title:"Diffusion Pipeline"},{local:"checkpoint-variants",sections:[{local:"using-revision-to-load-pipeline-variants-is-deprecated",title:"Using `revision` to load pipeline variants is deprecated"}],title:"Checkpoint variants"},{local:"models",title:"Models"},{local:"schedulers",title:"Schedulers"},{local:"diffusionpipeline-explained",title:"DiffusionPipeline explained"}],title:"Load pipelines, models, and schedulers"};function Qm(rt){return $m(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ym extends Vm{constructor(w){super();Nm(this,w,Qm,Am,Rm,{})}}export{Ym as default,Sm as metadata};
