import{S as F2,i as G2,s as B2,e as a,k as p,w as h,t as o,M as K2,c as l,d as s,m as c,a as n,x as u,h as i,b as d,G as e,g as f,y as m,q as v,o as _,B as w,v as W2,L as V2}from"../../chunks/vendor-hf-doc-builder.js";import{T as R2}from"../../chunks/Tip-hf-doc-builder.js";import{I as be}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as y}from"../../chunks/CodeBlock-hf-doc-builder.js";function J2(So){let b,te,k,O,Y,S,U,se,Je,ct,oe,Qe,Xe,is,Ye,ht,ye,ut,ie,T;return ie=new y({props:{code:`from diffusers import StableDiffusionImg2ImgPipeline

repo_id = "runwayml/stable-diffusion-v1-5"
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(repo_id)`,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)`}}),{c(){b=a("p"),te=o("Many checkpoints, such as "),k=a("a"),O=o("CompVis/stable-diffusion-v1-4"),Y=o(" and "),S=a("a"),U=o("runwayml/stable-diffusion-v1-5"),se=o(" can be used for multiple tasks, "),Je=a("em"),ct=o("e.g."),oe=p(),Qe=a("em"),Xe=o("text-to-image"),is=o(" or "),Ye=a("em"),ht=o("image-to-image"),ye=o(`.
If you want to use those checkpoints for a task that is different from the default one, you have to load it directly from the corresponding task-specific pipeline class:`),ut=p(),h(ie.$$.fragment),this.h()},l($){b=l($,"P",{});var P=n(b);te=i(P,"Many checkpoints, such as "),k=l(P,"A",{href:!0,rel:!0});var xo=n(k);O=i(xo,"CompVis/stable-diffusion-v1-4"),xo.forEach(s),Y=i(P," and "),S=l(P,"A",{href:!0,rel:!0});var qo=n(S);U=i(qo,"runwayml/stable-diffusion-v1-5"),qo.forEach(s),se=i(P," can be used for multiple tasks, "),Je=l(P,"EM",{});var Ze=n(Je);ct=i(Ze,"e.g."),Ze.forEach(s),oe=c(P),Qe=l(P,"EM",{});var Mo=n(Qe);Xe=i(Mo,"text-to-image"),Mo.forEach(s),is=i(P," or "),Ye=l(P,"EM",{});var Ao=n(Ye);ht=i(Ao,"image-to-image"),Ao.forEach(s),ye=i(P,`.
If you want to use those checkpoints for a task that is different from the default one, you have to load it directly from the corresponding task-specific pipeline class:`),P.forEach(s),ut=c($),u(ie.$$.fragment,$),this.h()},h(){d(k,"href","https://huggingface.co/CompVis/stable-diffusion-v1-4"),d(k,"rel","nofollow"),d(S,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5"),d(S,"rel","nofollow")},m($,P){f($,b,P),e(b,te),e(b,k),e(k,O),e(b,Y),e(b,S),e(S,U),e(b,se),e(b,Je),e(Je,ct),e(b,oe),e(b,Qe),e(Qe,Xe),e(b,is),e(b,Ye),e(Ye,ht),e(b,ye),f($,ut,P),m(ie,$,P),T=!0},p:V2,i($){T||(v(ie.$$.fragment,$),T=!0)},o($){_(ie.$$.fragment,$),T=!1},d($){$&&s(b),$&&s(ut),w(ie,$)}}}function Q2(So){let b,te,k,O,Y;return{c(){b=a("p"),te=o(`Note that Diffusers never downloads more checkpoints than needed. E.g. when downloading
the \u201Cmain\u201D variant, none of the \u201Cfp16.bin\u201D files are downloaded and cached.
Only when the user specifies `),k=a("code"),O=o('variant="fp16"'),Y=o(" are those files downloaded and cached.")},l(S){b=l(S,"P",{});var U=n(b);te=i(U,`Note that Diffusers never downloads more checkpoints than needed. E.g. when downloading
the \u201Cmain\u201D variant, none of the \u201Cfp16.bin\u201D files are downloaded and cached.
Only when the user specifies `),k=l(U,"CODE",{});var se=n(k);O=i(se,'variant="fp16"'),se.forEach(s),Y=i(U," are those files downloaded and cached."),U.forEach(s)},m(S,U){f(S,b,U),e(b,te),e(b,k),e(k,O),e(b,Y)},d(S){S&&s(b)}}}function X2(So){let b,te,k,O,Y,S,U,se,Je,ct,oe,Qe,Xe,is,Ye,ht,ye,ut,ie,T,$,P,xo,qo,Ze,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b1,td,ue,y1,Ai,g1,E1,Wn,D1,k1,Vn,$1,P1,sd,Ci,j1,od,I,Jn,Ii,S1,x1,Qn,Li,q1,M1,Xn,Oi,A1,C1,Yn,Ni,I1,L1,Zn,Ti,O1,N1,er,zi,T1,z1,tr,Hi,H1,id,Wt,U1,Ui,R1,F1,ad,go,ld;return S=new be({}),ns=new be({}),ds=new y({props:{code:`from diffusers import DiffusionPipeline

repo_id = "runwayml/stable-diffusion-v1-5"
pipe = DiffusionPipeline.from_pretrained(repo_id)`,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)`}}),ps=new y({props:{code:`from diffusers import StableDiffusionPipeline

repo_id = "runwayml/stable-diffusion-v1-5"
pipe = StableDiffusionPipeline.from_pretrained(repo_id)`,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)`}}),wt=new R2({props:{$$slots:{default:[J2]},$$scope:{ctx:So}}}),hs=new be({}),_s=new y({props:{code:`git lfs install
git clone https://huggingface.co/runwayml/stable-diffusion-v1-5`,highlighted:`git lfs install
git clone https:<span class="hljs-regexp">//</span>huggingface.co<span class="hljs-regexp">/runwayml/</span>stable-diffusion-v1-<span class="hljs-number">5</span>`}}),ws=new y({props:{code:`from diffusers import DiffusionPipeline

repo_id = "./stable-diffusion-v1-5"
stable_diffusion = DiffusionPipeline.from_pretrained(repo_id)`,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)`}}),bs=new be({}),gs=new y({props:{code:`from diffusers import DiffusionPipeline, EulerDiscreteScheduler, DPMSolverMultistepScheduler

repo_id = "runwayml/stable-diffusion-v1-5"

scheduler = EulerDiscreteScheduler.from_pretrained(repo_id, subfolder="scheduler")
# or
# scheduler = DPMSolverMultistepScheduler.from_pretrained(repo_id, subfolder="scheduler")

stable_diffusion = DiffusionPipeline.from_pretrained(repo_id, scheduler=scheduler)`,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>)
<span class="hljs-comment"># or</span>
<span class="hljs-comment"># scheduler = DPMSolverMultistepScheduler.from_pretrained(repo_id, subfolder=&quot;scheduler&quot;)</span>

stable_diffusion = DiffusionPipeline.from_pretrained(repo_id, scheduler=scheduler)`}}),ks=new y({props:{code:`from diffusers import DiffusionPipeline, EulerDiscreteScheduler, DPMSolverMultistepScheduler

stable_diffusion = DiffusionPipeline.from_pretrained(repo_id, safety_checker=None)`,highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline, EulerDiscreteScheduler, DPMSolverMultistepScheduler

stable_diffusion = DiffusionPipeline.from_pretrained(repo_id, safety_checker=<span class="hljs-literal">None</span>)`}}),Ps=new y({props:{code:`from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline

model_id = "runwayml/stable-diffusion-v1-5"
stable_diffusion_txt2img = StableDiffusionPipeline.from_pretrained(model_id)

components = stable_diffusion_txt2img.components

# weights are not reloaded into RAM
stable_diffusion_img2img = StableDiffusionImg2ImgPipeline(**components)`,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

<span class="hljs-comment"># weights are not reloaded into RAM</span>
stable_diffusion_img2img = StableDiffusionImg2ImgPipeline(**components)`}}),js=new be({}),Ss=new be({}),Is=new be({}),Os=new be({}),Ns=new y({props:{code:`from diffusers import DiffusionPipeline
import torch

pipe = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)`,highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch

pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>, torch_dtype=torch.float16)`}}),Ts=new y({props:{code:'pipe.save_pretrained("./stable-diffusion-v1-5", variant="fp16")',highlighted:'pipe.save_pretrained(<span class="hljs-string">&quot;./stable-diffusion-v1-5&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>)'}}),zs=new y({props:{code:`stable-diffusion-v1-5
\u251C\u2500\u2500 feature_extractor
\u2502\xA0\xA0 \u2514\u2500\u2500 preprocessor_config.json
\u251C\u2500\u2500 model_index.json
\u251C\u2500\u2500 safety_checker
\u2502\xA0\xA0 \u251C\u2500\u2500 config.json
\u2502\xA0\xA0 \u2514\u2500\u2500 pytorch_model.fp16.bin
\u251C\u2500\u2500 scheduler
\u2502\xA0\xA0 \u2514\u2500\u2500 scheduler_config.json
\u251C\u2500\u2500 text_encoder
\u2502\xA0\xA0 \u251C\u2500\u2500 config.json
\u2502\xA0\xA0 \u2514\u2500\u2500 pytorch_model.fp16.bin
\u251C\u2500\u2500 tokenizer
\u2502\xA0\xA0 \u251C\u2500\u2500 merges.txt
\u2502\xA0\xA0 \u251C\u2500\u2500 special_tokens_map.json
\u2502\xA0\xA0 \u251C\u2500\u2500 tokenizer_config.json
\u2502\xA0\xA0 \u2514\u2500\u2500 vocab.json
\u251C\u2500\u2500 unet
\u2502\xA0\xA0 \u251C\u2500\u2500 config.json
\u2502\xA0\xA0 \u2514\u2500\u2500 diffusion_pytorch_model.fp16.bin
\u2514\u2500\u2500 vae
    \u251C\u2500\u2500 config.json
    \u2514\u2500\u2500 diffusion_pytorch_model.fp16.bin`,highlighted:`stable-<span class="hljs-keyword">diffusion-v1-5
</span>\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.fp16.<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.fp16.<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 \u2514\u2500\u2500 <span class="hljs-keyword">diffusion_pytorch_model.fp16.bin
</span>\u2514\u2500\u2500 vae
    \u251C\u2500\u2500 <span class="hljs-built_in">config</span>.<span class="hljs-keyword">json
</span>    \u2514\u2500\u2500 <span class="hljs-keyword">diffusion_pytorch_model.fp16.bin</span>`}}),Hs=new y({props:{code:'DiffusionPipeline.from_pretrained("./stable-diffusion-v1-5", variant="fp16", torch_dtype=torch.float16)',highlighted:'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)'}}),Us=new y({props:{code:'DiffusionPipeline.from_pretrained("./stable-diffusion-v1-5", torch_dtype=torch.float16)',highlighted:'DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;./stable-diffusion-v1-5&quot;</span>, torch_dtype=torch.float16)'}}),Rs=new y({props:{code:"OSError: Error no file named diffusion_pytorch_model.bin found in directory ./stable-diffusion-v1-45/vae since we **only** stored the model ",highlighted:'OSError: Error <span class="hljs-keyword">no</span> file named diffusion_pytorch_model.bin <span class="hljs-built_in">found</span> <span class="hljs-keyword">in</span> directory ./<span class="hljs-keyword">stable</span>-diffusion-v1<span class="hljs-number">-45</span>/vae since we **<span class="hljs-keyword">only</span>** stored the model '}}),Fs=new y({props:{code:`pipe = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
pipe.save_pretrained("./stable-diffusion-v1-5")`,highlighted:`pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>)
pipe.save_pretrained(<span class="hljs-string">&quot;./stable-diffusion-v1-5&quot;</span>)`}}),Ks=new y({props:{code:`\u251C\u2500\u2500 feature_extractor
\u2502\xA0\xA0 \u2514\u2500\u2500 preprocessor_config.json
\u251C\u2500\u2500 model_index.json
\u251C\u2500\u2500 safety_checker
\u2502\xA0\xA0 \u251C\u2500\u2500 config.json
\u2502\xA0\xA0 \u251C\u2500\u2500 pytorch_model.bin
\u2502\xA0\xA0 \u2514\u2500\u2500 pytorch_model.fp16.bin
\u251C\u2500\u2500 scheduler
\u2502\xA0\xA0 \u2514\u2500\u2500 scheduler_config.json
\u251C\u2500\u2500 text_encoder
\u2502\xA0\xA0 \u251C\u2500\u2500 config.json
\u2502\xA0\xA0 \u251C\u2500\u2500 pytorch_model.bin
\u2502\xA0\xA0 \u2514\u2500\u2500 pytorch_model.fp16.bin
\u251C\u2500\u2500 tokenizer
\u2502\xA0\xA0 \u251C\u2500\u2500 merges.txt
\u2502\xA0\xA0 \u251C\u2500\u2500 special_tokens_map.json
\u2502\xA0\xA0 \u251C\u2500\u2500 tokenizer_config.json
\u2502\xA0\xA0 \u2514\u2500\u2500 vocab.json
\u251C\u2500\u2500 unet
\u2502\xA0\xA0 \u251C\u2500\u2500 config.json
\u2502\xA0\xA0 \u251C\u2500\u2500 diffusion_pytorch_model.bin
\u2502\xA0\xA0 \u251C\u2500\u2500 diffusion_pytorch_model.fp16.bin
\u2514\u2500\u2500 vae
    \u251C\u2500\u2500 config.json
    \u251C\u2500\u2500 diffusion_pytorch_model.bin
    \u2514\u2500\u2500 diffusion_pytorch_model.fp16.bin`,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 \u251C\u2500\u2500 pytorch_model.<span class="hljs-keyword">bin
</span>\u2502\xA0\xA0 \u2514\u2500\u2500 pytorch_model.fp16.<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 \u251C\u2500\u2500 pytorch_model.<span class="hljs-keyword">bin
</span>\u2502\xA0\xA0 \u2514\u2500\u2500 pytorch_model.fp16.<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>\u2502\xA0\xA0 \u251C\u2500\u2500 <span class="hljs-keyword">diffusion_pytorch_model.fp16.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>    \u2514\u2500\u2500 <span class="hljs-keyword">diffusion_pytorch_model.fp16.bin</span>`}}),Ws=new y({props:{code:'pipe = DiffusionPipeline.from_pretrained("diffusers/stable-diffusion-variants")',highlighted:'pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;diffusers/stable-diffusion-variants&quot;</span>)'}}),Vs=new y({props:{code:'pipe = DiffusionPipeline.from_pretrained("diffusers/stable-diffusion-variants", variant="fp16")',highlighted:'pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;diffusers/stable-diffusion-variants&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>)'}}),xt=new R2({props:{$$slots:{default:[Q2]},$$scope:{ctx:So}}}),Qs=new y({props:{code:'pipe = DiffusionPipeline.from_pretrained("diffusers/stable-diffusion-variants", variant="non_ema")',highlighted:'pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;diffusers/stable-diffusion-variants&quot;</span>, variant=<span class="hljs-string">&quot;non_ema&quot;</span>)'}}),Xs=new y({props:{code:`\u251C\u2500\u2500 feature_extractor
\u2502\xA0\xA0 \u2514\u2500\u2500 preprocessor_config.json
\u251C\u2500\u2500 model_index.json
\u251C\u2500\u2500 safety_checker
\u2502\xA0\xA0 \u251C\u2500\u2500 config.json
\u2502\xA0\xA0 \u251C\u2500\u2500 pytorch_model.bin
\u251C\u2500\u2500 scheduler
\u2502\xA0\xA0 \u2514\u2500\u2500 scheduler_config.json
\u251C\u2500\u2500 text_encoder
\u2502\xA0\xA0 \u251C\u2500\u2500 config.json
\u2502\xA0\xA0 \u251C\u2500\u2500 pytorch_model.bin
\u251C\u2500\u2500 tokenizer
\u2502\xA0\xA0 \u251C\u2500\u2500 merges.txt
\u2502\xA0\xA0 \u251C\u2500\u2500 special_tokens_map.json
\u2502\xA0\xA0 \u251C\u2500\u2500 tokenizer_config.json
\u2502\xA0\xA0 \u2514\u2500\u2500 vocab.json
\u251C\u2500\u2500 unet
\u2502\xA0\xA0 \u251C\u2500\u2500 config.json
\u2502\xA0\xA0 \u2514\u2500\u2500 diffusion_pytorch_model.non_ema.bin
\u2514\u2500\u2500 vae
    \u251C\u2500\u2500 config.json
    \u251C\u2500\u2500 diffusion_pytorch_model.bin`,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 \u251C\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 \u251C\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 \u2514\u2500\u2500 <span class="hljs-keyword">diffusion_pytorch_model.non_ema.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>`}}),Ys=new be({}),eo=new y({props:{code:`from diffusers import DiffusionPipeline

repo_id = "runwayml/stable-diffusion-v1-5"
pipe = DiffusionPipeline.from_pretrained(repo_id)
print(pipe)`,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)
<span class="hljs-built_in">print</span>(pipe)`}}),so=new y({props:{code:`StableDiffusionPipeline {
  "feature_extractor": [
    "transformers",
    "CLIPFeatureExtractor"
  ],
  "safety_checker": [
    "stable_diffusion",
    "StableDiffusionSafetyChecker"
  ],
  "scheduler": [
    "diffusers",
    "PNDMScheduler"
  ],
  "text_encoder": [
    "transformers",
    "CLIPTextModel"
  ],
  "tokenizer": [
    "transformers",
    "CLIPTokenizer"
  ],
  "unet": [
    "diffusers",
    "UNet2DConditionModel"
  ],
  "vae": [
    "diffusers",
    "AutoencoderKL"
  ]
}`,highlighted:`<span class="hljs-symbol">StableDiffusionPipeline</span> {
  <span class="hljs-string">&quot;feature_extractor&quot;</span>: [
    <span class="hljs-string">&quot;transformers&quot;</span>,
    <span class="hljs-string">&quot;CLIPFeatureExtractor&quot;</span>
  ],
  <span class="hljs-string">&quot;safety_checker&quot;</span>: [
    <span class="hljs-string">&quot;stable_diffusion&quot;</span>,
    <span class="hljs-string">&quot;StableDiffusionSafetyChecker&quot;</span>
  ],
  <span class="hljs-string">&quot;scheduler&quot;</span>: [
    <span class="hljs-string">&quot;diffusers&quot;</span>,
    <span class="hljs-string">&quot;PNDMScheduler&quot;</span>
  ],
  <span class="hljs-string">&quot;text_encoder&quot;</span>: [
    <span class="hljs-string">&quot;transformers&quot;</span>,
    <span class="hljs-string">&quot;CLIPTextModel&quot;</span>
  ],
  <span class="hljs-string">&quot;tokenizer&quot;</span>: [
    <span class="hljs-string">&quot;transformers&quot;</span>,
    <span class="hljs-string">&quot;CLIPTokenizer&quot;</span>
  ],
  <span class="hljs-string">&quot;unet&quot;</span>: [
    <span class="hljs-string">&quot;diffusers&quot;</span>,
    <span class="hljs-string">&quot;UNet2DConditionModel&quot;</span>
  ],
  <span class="hljs-string">&quot;vae&quot;</span>: [
    <span class="hljs-string">&quot;diffusers&quot;</span>,
    <span class="hljs-string">&quot;AutoencoderKL&quot;</span>
  ]
}`}}),ao=new y({props:{code:`.
\u251C\u2500\u2500 feature_extractor
\u2502\xA0\xA0 \u2514\u2500\u2500 preprocessor_config.json
\u251C\u2500\u2500 model_index.json
\u251C\u2500\u2500 safety_checker
\u2502\xA0\xA0 \u251C\u2500\u2500 config.json
\u2502\xA0\xA0 \u2514\u2500\u2500 pytorch_model.bin
\u251C\u2500\u2500 scheduler
\u2502\xA0\xA0 \u2514\u2500\u2500 scheduler_config.json
\u251C\u2500\u2500 text_encoder
\u2502\xA0\xA0 \u251C\u2500\u2500 config.json
\u2502\xA0\xA0 \u2514\u2500\u2500 pytorch_model.bin
\u251C\u2500\u2500 tokenizer
\u2502\xA0\xA0 \u251C\u2500\u2500 merges.txt
\u2502\xA0\xA0 \u251C\u2500\u2500 special_tokens_map.json
\u2502\xA0\xA0 \u251C\u2500\u2500 tokenizer_config.json
\u2502\xA0\xA0 \u2514\u2500\u2500 vocab.json
\u251C\u2500\u2500 unet
\u2502\xA0\xA0 \u251C\u2500\u2500 config.json
\u2502\xA0\xA0 \u251C\u2500\u2500 diffusion_pytorch_model.bin
\u2514\u2500\u2500 vae
    \u251C\u2500\u2500 config.json
    \u251C\u2500\u2500 diffusion_pytorch_model.bin`,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>`}}),lo=new y({props:{code:`{
  "_class_name": "StableDiffusionPipeline",
  "_diffusers_version": "0.6.0",
  "feature_extractor": [
    "transformers",
    "CLIPFeatureExtractor"
  ],
  "safety_checker": [
    "stable_diffusion",
    "StableDiffusionSafetyChecker"
  ],
  "scheduler": [
    "diffusers",
    "PNDMScheduler"
  ],
  "text_encoder": [
    "transformers",
    "CLIPTextModel"
  ],
  "tokenizer": [
    "transformers",
    "CLIPTokenizer"
  ],
  "unet": [
    "diffusers",
    "UNet2DConditionModel"
  ],
  "vae": [
    "diffusers",
    "AutoencoderKL"
  ]
}`,highlighted:`{
  <span class="hljs-string">&quot;_class_name&quot;</span>: <span class="hljs-string">&quot;StableDiffusionPipeline&quot;</span>,
  <span class="hljs-string">&quot;_diffusers_version&quot;</span>: <span class="hljs-string">&quot;0.6.0&quot;</span>,
  <span class="hljs-string">&quot;feature_extractor&quot;</span>: [
    <span class="hljs-string">&quot;transformers&quot;</span>,
    <span class="hljs-string">&quot;CLIPFeatureExtractor&quot;</span>
  ],
  <span class="hljs-string">&quot;safety_checker&quot;</span>: [
    <span class="hljs-string">&quot;stable_diffusion&quot;</span>,
    <span class="hljs-string">&quot;StableDiffusionSafetyChecker&quot;</span>
  ],
  <span class="hljs-string">&quot;scheduler&quot;</span>: [
    <span class="hljs-string">&quot;diffusers&quot;</span>,
    <span class="hljs-string">&quot;PNDMScheduler&quot;</span>
  ],
  <span class="hljs-string">&quot;text_encoder&quot;</span>: [
    <span class="hljs-string">&quot;transformers&quot;</span>,
    <span class="hljs-string">&quot;CLIPTextModel&quot;</span>
  ],
  <span class="hljs-string">&quot;tokenizer&quot;</span>: [
    <span class="hljs-string">&quot;transformers&quot;</span>,
    <span class="hljs-string">&quot;CLIPTokenizer&quot;</span>
  ],
  <span class="hljs-string">&quot;unet&quot;</span>: [
    <span class="hljs-string">&quot;diffusers&quot;</span>,
    <span class="hljs-string">&quot;UNet2DConditionModel&quot;</span>
  ],
  <span class="hljs-string">&quot;vae&quot;</span>: [
    <span class="hljs-string">&quot;diffusers&quot;</span>,
    <span class="hljs-string">&quot;AutoencoderKL&quot;</span>
  ]
}`}}),no=new y({props:{code:`"name" : [
  "library",
  "class"
]`,highlighted:`<span class="hljs-string">&quot;name&quot;</span> : [
  <span class="hljs-string">&quot;library&quot;</span>,
  <span class="hljs-string">&quot;class&quot;</span>
]`}}),co=new be({}),uo=new y({props:{code:`from diffusers import UNet2DConditionModel

repo_id = "runwayml/stable-diffusion-v1-5"
model = UNet2DConditionModel.from_pretrained(repo_id, subfolder="unet")`,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>)`}}),vo=new y({props:{code:`from diffusers import DiffusionPipeline

repo_id = "runwayml/stable-diffusion-v1-5"
pipe = DiffusionPipeline.from_pretrained(repo_id, unet=model)`,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, unet=model)`}}),wo=new y({props:{code:`from diffusers import UNet2DModel

repo_id = "google/ddpm-cifar10-32"
model = UNet2DModel.from_pretrained(repo_id)`,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)`}}),bo=new y({props:{code:`from diffusers import UNet2DConditionModel

model = UNet2DConditionModel.from_pretrained(
    "diffusers/stable-diffusion-variants", subfolder="unet", variant="non_ema"
)
model.save_pretrained("./local-unet", variant="non_ema")`,highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> UNet2DConditionModel

model = UNet2DConditionModel.from_pretrained(
    <span class="hljs-string">&quot;diffusers/stable-diffusion-variants&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>)`}}),yo=new be({}),go=new y({props:{code:`from diffusers import StableDiffusionPipeline
from diffusers import (
    DDPMScheduler,
    DDIMScheduler,
    PNDMScheduler,
    LMSDiscreteScheduler,
    EulerDiscreteScheduler,
    EulerAncestralDiscreteScheduler,
    DPMSolverMultistepScheduler,
)

repo_id = "runwayml/stable-diffusion-v1-5"

ddpm = DDPMScheduler.from_pretrained(repo_id, subfolder="scheduler")
ddim = DDIMScheduler.from_pretrained(repo_id, subfolder="scheduler")
pndm = PNDMScheduler.from_pretrained(repo_id, subfolder="scheduler")
lms = LMSDiscreteScheduler.from_pretrained(repo_id, subfolder="scheduler")
euler_anc = EulerAncestralDiscreteScheduler.from_pretrained(repo_id, subfolder="scheduler")
euler = EulerDiscreteScheduler.from_pretrained(repo_id, subfolder="scheduler")
dpm = DPMSolverMultistepScheduler.from_pretrained(repo_id, subfolder="scheduler")

# replace \`dpm\` with any of \`ddpm\`, \`ddim\`, \`pndm\`, \`lms\`, \`euler\`, \`euler_anc\`
pipeline = StableDiffusionPipeline.from_pretrained(repo_id, scheduler=dpm)`,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\`, \`euler_anc\`</span>
pipeline = StableDiffusionPipeline.from_pretrained(repo_id, scheduler=dpm)`}}),{c(){b=a("meta"),te=p(),k=a("h1"),O=a("a"),Y=a("span"),h(S.$$.fragment),U=p(),se=a("span"),Je=o("Loading"),ct=p(),oe=a("p"),Qe=o("A core premise of the diffusers library is to make diffusion models "),Xe=a("strong"),is=o("as accessible as possible"),Ye=o(`.
Accessibility is therefore achieved by providing an API to load complete diffusion pipelines as well as individual components with a single line of code.`),ht=p(),ye=a("p"),ut=o("In the following we explain in-detail how to easily load:"),ie=p(),T=a("ul"),$=a("li"),P=a("em"),xo=o("Complete Diffusion Pipelines"),qo=o(" via the "),Ze=a("a"),Mo=o("DiffusionPipeline.from_pretrained()"),Ao=p(),as=a("li"),la=a("em"),Ad=o("Diffusion Models"),Cd=o(" via "),Co=a("a"),Id=o("ModelMixin.from_pretrained()"),Ld=p(),ls=a("li"),na=a("em"),Od=o("Schedulers"),Nd=o(" via "),Io=a("a"),Td=o("SchedulerMixin.from_pretrained()"),dr=p(),et=a("h2"),mt=a("a"),ra=a("span"),h(ns.$$.fragment),zd=p(),fa=a("span"),Hd=o("Loading pipelines"),pr=p(),ae=a("p"),Ud=o("The "),Lo=a("a"),Rd=o("DiffusionPipeline"),Fd=o(" class is the easiest way to access any diffusion model that is "),rs=a("a"),Gd=o("available on the Hub"),Bd=o(". Let\u2019s look at an example on how to download "),fs=a("a"),Kd=o("Runway\u2019s Stable Diffusion model"),Wd=o("."),cr=p(),h(ds.$$.fragment),hr=p(),q=a("p"),Vd=o("Here "),Oo=a("a"),Jd=o("DiffusionPipeline"),Qd=o(" automatically detects the correct pipeline ("),da=a("em"),Xd=o("i.e."),Yd=p(),No=a("a"),Zd=o("StableDiffusionPipeline"),ep=o("), downloads and caches all required configuration and weight files (if not already done so), and finally returns a pipeline instance, called "),pa=a("code"),tp=o("pipe"),sp=o(`.
The pipeline instance can then be called using `),vt=a("a"),op=o("StableDiffusionPipeline."),ca=a("strong"),ip=o("call"),ap=o("()"),lp=o(" (i.e., "),ha=a("code"),np=o('pipe("image of a astronaut riding a horse")'),rp=o(") for text-to-image generation."),ur=p(),_t=a("p"),fp=o("Instead of using the generic "),To=a("a"),dp=o("DiffusionPipeline"),pp=o(" class for loading, you can also load the appropriate pipeline class directly. The code snippet above yields the same instance as when doing:"),mr=p(),h(ps.$$.fragment),vr=p(),h(wt.$$.fragment),_r=p(),E=a("p"),cp=o("Diffusion pipelines like "),ua=a("code"),hp=o("StableDiffusionPipeline"),up=o(" or "),ma=a("code"),mp=o("StableDiffusionImg2ImgPipeline"),vp=o(" consist of multiple components. These components can be both parameterized models, such as "),va=a("code"),_p=o('"unet"'),wp=o(", "),_a=a("code"),bp=o('"vae"'),yp=o(" and "),wa=a("code"),gp=o('"text_encoder"'),Ep=o(`, tokenizers or schedulers.
These components often interact in complex ways with each other when using the pipeline in inference, `),ba=a("em"),Dp=o("e.g."),kp=o(" for "),zo=a("a"),$p=o("StableDiffusionPipeline"),Pp=o(" the inference call is explained "),cs=a("a"),jp=o("here"),Sp=o(`.
The purpose of the `),Ho=a("a"),xp=o("pipeline classes"),qp=o(" is to wrap the complexity of these diffusion systems and give the user an easy-to-use API while staying flexible for customization, as will be shown later."),wr=p(),tt=a("h3"),bt=a("a"),ya=a("span"),h(hs.$$.fragment),Mp=p(),ga=a("span"),Ap=o("Loading pipelines locally"),br=p(),Uo=a("p"),Cp=o(`If you prefer to have complete control over the pipeline and its corresponding files or, as said before, if you want to use pipelines that require an access request without having to be connected to the Hugging Face Hub,
we recommend loading pipelines locally.`),yr=p(),ge=a("p"),Ip=o("To load a diffusion pipeline locally, you first need to manually download the whole folder structure on your local disk and then pass a local path to the "),Ro=a("a"),Lp=o("DiffusionPipeline.from_pretrained()"),Op=o(`. Let\u2019s again look at an example for
`),us=a("a"),Np=o("Runway\u2019s Stable Diffusion Diffusion model"),Tp=o("."),gr=p(),Ee=a("p"),zp=o("First, you should make use of "),ms=a("a"),Ea=a("code"),Hp=o("git-lfs"),Up=o(" to download the whole folder structure that has been uploaded to the "),vs=a("a"),Rp=o("model repository"),Fp=o(":"),Er=p(),h(_s.$$.fragment),Dr=p(),De=a("p"),Gp=o("The command above will create a local folder called "),Da=a("code"),Bp=o("./stable-diffusion-v1-5"),Kp=o(` on your disk.
Now, all you have to do is to simply pass the local folder path to `),ka=a("code"),Wp=o("from_pretrained"),Vp=o(":"),kr=p(),h(ws.$$.fragment),$r=p(),ke=a("p"),Jp=o("If "),$a=a("code"),Qp=o("repo_id"),Xp=o(" is a local path, as it is the case here, "),Fo=a("a"),Yp=o("DiffusionPipeline.from_pretrained()"),Zp=o(` will automatically detect it and therefore not try to download any files from the Hub.
While we usually recommend to load weights directly from the Hub to be certain to stay up to date with the newest changes, loading pipelines locally should be preferred if one
wants to stay anonymous, self-contained applications, etc\u2026`),Pr=p(),st=a("h3"),yt=a("a"),Pa=a("span"),h(bs.$$.fragment),ec=p(),ja=a("span"),tc=o("Loading customized pipelines"),jr=p(),R=a("p"),sc=o("Advanced users that want to load customized versions of diffusion pipelines can do so by swapping any of the default components, "),Sa=a("em"),oc=o("e.g."),ic=o(` the scheduler, with other scheduler classes.
A classical use case of this functionality is to swap the scheduler. `),ys=a("a"),ac=o("Stable Diffusion v1-5"),lc=o(" uses the "),Go=a("a"),nc=o("PNDMScheduler"),rc=o(` by default which is generally not the most performant scheduler. Since the release
of stable diffusion, multiple improved schedulers have been published. To use those, the user has to manually load their preferred scheduler and pass it into `),Bo=a("a"),fc=o("DiffusionPipeline.from_pretrained()"),dc=o("."),Sr=p(),_e=a("p"),xa=a("em"),pc=o("E.g."),cc=o(" to use "),Ko=a("a"),hc=o("EulerDiscreteScheduler"),uc=o(" or "),Wo=a("a"),mc=o("DPMSolverMultistepScheduler"),vc=o(" to have a better quality vs. generation speed trade-off for inference, one could load them as follows:"),xr=p(),h(gs.$$.fragment),qr=p(),Vo=a("p"),_c=o("Three things are worth paying attention to here."),Mr=p(),$e=a("ul"),Jo=a("li"),wc=o("First, the scheduler is loaded with "),Qo=a("a"),bc=o("SchedulerMixin.from_pretrained()"),yc=p(),gt=a("li"),gc=o("Second, the scheduler is loaded with a function argument, called "),qa=a("code"),Ec=o('subfolder="scheduler"'),Dc=o(" as the configuration of stable diffusion\u2019s scheduling is defined in a "),Es=a("a"),kc=o("subfolder of the official pipeline repository"),$c=p(),M=a("li"),Pc=o("Third, the scheduler instance can simply be passed with the "),Ma=a("code"),jc=o("scheduler"),Sc=o(" keyword argument to "),Xo=a("a"),xc=o("DiffusionPipeline.from_pretrained()"),qc=o(". This works because the "),Yo=a("a"),Mc=o("StableDiffusionPipeline"),Ac=o(" defines its scheduler with the "),Aa=a("code"),Cc=o("scheduler"),Ic=o(" attribute. It\u2019s not possible to use a different name, such as "),Ca=a("code"),Lc=o("sampler=scheduler"),Oc=o(" since "),Ia=a("code"),Nc=o("sampler"),Tc=o(" is not a defined keyword for "),La=a("code"),zc=o("StableDiffusionPipeline.__init__()"),Ar=p(),le=a("p"),Hc=o("Not only the scheduler components can be customized for diffusion pipelines; in theory, all components of a pipeline can be customized. In practice, however, it often only makes sense to switch out a component that has "),Oa=a("strong"),Uc=o("compatible"),Rc=o(` alternatives to what the pipeline expects.
Many scheduler classes are compatible with each other as can be seen `),Ds=a("a"),Fc=o("here"),Gc=o(". This is not always the case for other components, such as the "),Na=a("code"),Bc=o('"unet"'),Kc=o("."),Cr=p(),Pe=a("p"),Wc=o("One special case that can also be customized is the "),Ta=a("code"),Vc=o('"safety_checker"'),Jc=o(" of stable diffusion. If you believe the safety checker doesn\u2019t serve you any good, you can simply disable it by passing "),za=a("code"),Qc=o("None"),Xc=o(":"),Ir=p(),h(ks.$$.fragment),Lr=p(),F=a("p"),Yc=o("Another common use case is to reuse the same components in multiple pipelines, "),Ha=a("em"),Zc=o("e.g."),eh=o(" the weights and configurations of "),$s=a("a"),Ua=a("code"),th=o('"runwayml/stable-diffusion-v1-5"'),sh=o(" can be used for both "),Zo=a("a"),oh=o("StableDiffusionPipeline"),ih=o(" and "),ei=a("a"),ah=o("StableDiffusionImg2ImgPipeline"),lh=o(` and we might not want to
use the exact same weights into RAM twice. In this case, customizing all the input instances would help us
to only load the weights into RAM once:`),Or=p(),h(Ps.$$.fragment),Nr=p(),Et=a("p"),nh=o("Note how the above code snippet makes use of "),ti=a("a"),rh=o("DiffusionPipeline.components"),fh=o("."),Tr=p(),ot=a("h3"),Dt=a("a"),Ra=a("span"),h(js.$$.fragment),dh=p(),Fa=a("span"),ph=o("Loading variants"),zr=p(),ne=a("p"),ch=o(`Diffusion Pipeline checkpoints can offer variants of the \u201Cmain\u201D diffusion pipeline checkpoint.
Such checkpoint variants are usually variations of the checkpoint that have advantages for specific use-cases and that are so similar to the \u201Cmain\u201D checkpoint that they `),Ga=a("strong"),hh=o("should not"),uh=o(` be put in a new checkpoint.
A variation of a checkpoint has to have `),Ba=a("strong"),mh=o("exactly"),vh=o(" the same serialization format and "),Ka=a("strong"),_h=o("exactly"),wh=o(" the same model structure, including all weights having the same tensor shapes."),Hr=p(),si=a("p"),bh=o("Examples of variations are different floating point types and non-ema weights. I.e. \u201Cfp16\u201D, \u201Cbf16\u201D, and \u201Cno_ema\u201D are common variations."),Ur=p(),it=a("h4"),kt=a("a"),Wa=a("span"),h(Ss.$$.fragment),yh=p(),Va=a("span"),gh=o("Let's first talk about whats **not** checkpoint variant,"),Rr=p(),je=a("p"),Eh=o("Checkpoint variants do "),Ja=a("strong"),Dh=o("not"),kh=o(" include different serialization formats (such as "),xs=a("a"),$h=o("safetensors"),Ph=o(`) as weights in different serialization formats are
identical to the weights of the \u201Cmain\u201D checkpoint, just loaded in a different framework.`),Fr=p(),G=a("p"),jh=o("Also variants do not correspond to different model structures, "),Qa=a("em"),Sh=o("e.g."),xh=p(),qs=a("a"),qh=o("stable-diffusion-v1-5"),Mh=o(" is not a variant of "),Ms=a("a"),Ah=o("stable-diffusion-2-0"),Ch=o(" since the model structure is different (Stable Diffusion 1-5 uses a different "),Xa=a("code"),Ih=o("CLIPTextModel"),Lh=o(" compared to Stable Diffusion 2.0)."),Gr=p(),Se=a("p"),Oh=o("Pipeline checkpoints that are identical in model structure, but have been trained on different datasets, trained with vastly different training setups and thus correspond to different official releases (such as "),As=a("a"),Nh=o("Stable Diffusion v1-4"),Th=o(" and "),Cs=a("a"),zh=o("Stable Diffusion v1-5"),Hh=o(") should probably be stored in individual repositories instead of as variations of eachother."),Br=p(),at=a("h4"),$t=a("a"),Ya=a("span"),h(Is.$$.fragment),Uh=p(),Za=a("span"),Rh=o("So what are checkpoint variants then?"),Kr=p(),A=a("p"),Fh=o("Checkpoint variants usually consist of the checkpoint stored in \u201D"),el=a("em"),Gh=o("low-precision, low-storage"),Bh=o("\u201D dtype so that less bandwith is required to download them, or of "),tl=a("em"),Kh=o("non-exponential-averaged"),Wh=o(` weights that shall be used when continuing fine-tuning from the checkpoint.
Both use cases have clear advantages when their weights are considered variants: they share the same serialization format as the reference weights, and they correspond to a specialization of the \u201Cmain\u201D checkpoint which does not warrant a new model repository.
A checkpoint stored in `),Ls=a("a"),Vh=o("torch\u2019s half-precision / float16 format"),Jh=o(` requires only half the bandwith and storage when downloading the checkpoint,
`),sl=a("strong"),Qh=o("but"),Xh=o(` cannot be used when continuing training or when running the checkpoint on CPU.
Similarly the `),ol=a("em"),Yh=o("non-exponential-averaged"),Zh=o(" (or non-EMA) version of the checkpoint should be used when continuing fine-tuning of the model checkpoint, "),il=a("strong"),eu=o("but"),tu=o(" should not be used when using the checkpoint for inference."),Wr=p(),lt=a("h4"),Pt=a("a"),al=a("span"),h(Os.$$.fragment),su=p(),ll=a("span"),ou=o("How to save and load variants"),Vr=p(),j=a("p"),iu=o("Saving a diffusion pipeline as a variant can be done by providing "),oi=a("a"),au=o("DiffusionPipeline.save_pretrained()"),lu=o(" with the "),nl=a("code"),nu=o("variant"),ru=o(` argument.
The `),rl=a("code"),fu=o("variant"),du=o(" extends the weight name by the provided variation, by changing the default weight name from "),fl=a("code"),pu=o("diffusion_pytorch_model.bin"),cu=o(" to "),dl=a("code"),hu=o("diffusion_pytorch_model.{variant}.bin"),uu=o(" or from "),pl=a("code"),mu=o("diffusion_pytorch_model.safetensors"),vu=o(" to "),cl=a("code"),_u=o("diffusion_pytorch_model.{variant}.safetensors"),wu=o(". By doing so, one creates a variant of the pipeline checkpoint that can be loaded "),hl=a("strong"),bu=o("instead"),yu=o(" of the \u201Cmain\u201D pipeline checkpoint."),Jr=p(),xe=a("p"),gu=o(`Let\u2019s have a look at how we could create a float16 variant of a pipeline. First, we load
the \u201Cmain\u201D variant of a checkpoint (stored in `),ul=a("code"),Eu=o("float32"),Du=o(" precision) into mixed precision format, using "),ml=a("code"),ku=o("torch_dtype=torch.float16"),$u=o("."),Qr=p(),h(Ns.$$.fragment),Xr=p(),jt=a("p"),Pu=o(`Now all model components of the pipeline are stored in half-precision dtype. We can now save the
pipeline under a `),vl=a("code"),ju=o('"fp16"'),Su=o(" variant as follows:"),Yr=p(),h(Ts.$$.fragment),Zr=p(),St=a("p"),xu=o("If we don\u2019t save into an existing "),_l=a("code"),qu=o("stable-diffusion-v1-5"),Mu=o(" folder the new folder would look as follows:"),ef=p(),h(zs.$$.fragment),tf=p(),B=a("p"),Au=o("As one can see, all model files now have a "),wl=a("code"),Cu=o(".fp16.bin"),Iu=o(" extension instead of just "),bl=a("code"),Lu=o(".bin"),Ou=o(`.
The variant now has to be loaded by also passing a `),yl=a("code"),Nu=o('variant="fp16"'),Tu=o(" to "),ii=a("a"),zu=o("DiffusionPipeline.from_pretrained()"),Hu=o(", e.g.:"),sf=p(),h(Hs.$$.fragment),of=p(),ai=a("p"),Uu=o("works just fine, while:"),af=p(),h(Us.$$.fragment),lf=p(),li=a("p"),Ru=o("throws an Exception:"),nf=p(),h(Rs.$$.fragment),rf=p(),ni=a("p"),Fu=o(`This is expected as we don\u2019t have any \u201Cnon-variant\u201D checkpoint files saved locally.
However, the whole idea of pipeline variants is that they can co-exist with the \u201Cmain\u201D variant,
so one would typically also save the \u201Cmain\u201D variant in the same folder. Let\u2019s do this:`),ff=p(),h(Fs.$$.fragment),df=p(),qe=a("p"),Gu=o("and upload the pipeline to the Hub under "),Gs=a("a"),Bu=o("diffusers/stable-diffusion-variants"),Ku=o(`.
The file structure `),Bs=a("a"),Wu=o("on the Hub"),Vu=o(" now looks as follows:"),pf=p(),h(Ks.$$.fragment),cf=p(),ri=a("p"),Ju=o("We can now both download the \u201Cmain\u201D and the \u201Cfp16\u201D variant from the Hub. Both:"),hf=p(),h(Ws.$$.fragment),uf=p(),fi=a("p"),Qu=o("and"),mf=p(),h(Vs.$$.fragment),vf=p(),di=a("p"),Xu=o("works."),_f=p(),h(xt.$$.fragment),wf=p(),K=a("p"),Yu=o(`Finally, there are cases where only some of the checkpoint files of the pipeline are of a certain
variation. E.g. it\u2019s usually only the UNet checkpoint that has both a `),gl=a("em"),Zu=o("exponential-mean-averaged"),em=o(" (EMA) and a "),El=a("em"),tm=o("non-exponential-mean-averaged"),sm=o(` (non-EMA) version. All other model components, e.g. the text encoder, safety checker or variational auto-encoder usually don\u2019t have such a variation.
In such a case, one would upload just the UNet\u2019s checkpoint file with a `),Dl=a("code"),om=o("non_ema"),im=o(" version format (as done "),Js=a("a"),am=o("here"),lm=o(") and upon calling:"),bf=p(),h(Qs.$$.fragment),yf=p(),qt=a("p"),nm=o(`the model will use only the \u201Cnon_ema\u201D checkpoint variant if it is available - otherwise it\u2019ll load the
\u201Cmain\u201D variation. In the above example, `),kl=a("code"),rm=o('variant="non_ema"'),fm=o(" would therefore download the following file structure:"),gf=p(),h(Xs.$$.fragment),Ef=p(),re=a("p"),dm=o("In a nutshell, using "),$l=a("code"),pm=o('variant="{variant}"'),cm=o(" will download all files that match the "),Pl=a("code"),hm=o("{variant}"),um=o(" and if for a model component such a file variant is not present it will download the \u201Cmain\u201D variant. If neither a \u201Cmain\u201D or "),jl=a("code"),mm=o("{variant}"),vm=o(" variant is available, an error will the thrown."),Df=p(),nt=a("h3"),Mt=a("a"),Sl=a("span"),h(Ys.$$.fragment),_m=p(),xl=a("span"),wm=o("How does loading work?"),kf=p(),At=a("p"),bm=o("As a class method, "),pi=a("a"),ym=o("DiffusionPipeline.from_pretrained()"),gm=o(" is responsible for two things:"),$f=p(),Ct=a("ul"),Z=a("li"),Em=o("Download the latest version of the folder structure required to run the "),ql=a("code"),Dm=o("repo_id"),km=o(" with "),Ml=a("code"),$m=o("diffusers"),Pm=o(" and cache them. If the latest folder structure is available in the local cache, "),ci=a("a"),jm=o("DiffusionPipeline.from_pretrained()"),Sm=o(" will simply reuse the cache and "),Al=a("strong"),xm=o("not"),qm=o(" re-download the files."),Mm=p(),ee=a("li"),Am=o("Load the cached weights into the "),Cl=a("em"),Cm=o("correct"),Im=o(" pipeline class \u2013 one of the "),hi=a("a"),Lm=o("officially supported pipeline classes"),Om=o(" - and return an instance of the class. The "),Il=a("em"),Nm=o("correct"),Tm=o(" pipeline class is thereby retrieved from the "),Ll=a("code"),zm=o("model_index.json"),Hm=o(" file."),Pf=p(),W=a("p"),Um=o("The underlying folder structure of diffusion pipelines correspond 1-to-1 to their corresponding class instances, "),Ol=a("em"),Rm=o("e.g."),Fm=p(),ui=a("a"),Gm=o("StableDiffusionPipeline"),Bm=o(" for "),Zs=a("a"),Nl=a("code"),Km=o("runwayml/stable-diffusion-v1-5"),Wm=o(`
This can be better understood by looking at an example. Let\u2019s load a pipeline class instance `),Tl=a("code"),Vm=o("pipe"),Jm=o(" and print it:"),jf=p(),h(eo.$$.fragment),Sf=p(),to=a("p"),zl=a("em"),Qm=o("Output"),Xm=o(":"),xf=p(),h(so.$$.fragment),qf=p(),Me=a("p"),Ym=o("First, we see that the official pipeline is the "),mi=a("a"),Zm=o("StableDiffusionPipeline"),ev=o(", and second we see that the "),Hl=a("code"),tv=o("StableDiffusionPipeline"),sv=o(" consists of 7 components:"),Mf=p(),C=a("ul"),Ae=a("li"),Ul=a("code"),ov=o('"feature_extractor"'),iv=o(" of class "),Rl=a("code"),av=o("CLIPFeatureExtractor"),lv=o(" as defined "),It=a("a"),nv=o("in "),Fl=a("code"),rv=o("transformers"),fv=o("."),dv=p(),Lt=a("li"),Gl=a("code"),pv=o('"safety_checker"'),cv=o(" as defined "),oo=a("a"),hv=o("here"),uv=o("."),mv=p(),Ot=a("li"),Bl=a("code"),vv=o('"scheduler"'),_v=o(" of class "),vi=a("a"),wv=o("PNDMScheduler"),bv=o("."),yv=p(),Ce=a("li"),Kl=a("code"),gv=o('"text_encoder"'),Ev=o(" of class "),Wl=a("code"),Dv=o("CLIPTextModel"),kv=o(" as defined "),Nt=a("a"),$v=o("in "),Vl=a("code"),Pv=o("transformers"),jv=o("."),Sv=p(),Ie=a("li"),Jl=a("code"),xv=o('"tokenizer"'),qv=o(" of class "),Ql=a("code"),Mv=o("CLIPTokenizer"),Av=o(" as defined "),Tt=a("a"),Cv=o("in "),Xl=a("code"),Iv=o("transformers"),Lv=o("."),Ov=p(),zt=a("li"),Yl=a("code"),Nv=o('"unet"'),Tv=o(" of class "),_i=a("a"),zv=o("UNet2DConditionModel"),Hv=o("."),Uv=p(),Ht=a("li"),Zl=a("code"),Rv=o('"vae"'),Fv=o(" of class "),wi=a("a"),Gv=o("AutoencoderKL"),Bv=o("."),Af=p(),fe=a("p"),Kv=o("Let\u2019s now compare the pipeline instance to the folder structure of the model repository "),en=a("code"),Wv=o("runwayml/stable-diffusion-v1-5"),Vv=o(". Looking at the folder structure of "),io=a("a"),tn=a("code"),Jv=o("runwayml/stable-diffusion-v1-5"),Qv=o(" on the Hub and  excluding model and saving format variants, we can see it matches 1-to-1 the printed out instance of "),sn=a("code"),Xv=o("StableDiffusionPipeline"),Yv=o(" above:"),Cf=p(),h(ao.$$.fragment),If=p(),g=a("p"),Zv=o("Each attribute of the instance of "),on=a("code"),e_=o("StableDiffusionPipeline"),t_=o(" has its configuration and possibly weights defined in a subfolder that is called "),an=a("strong"),s_=o("exactly"),o_=o(" like the class attribute ("),ln=a("code"),i_=o('"feature_extractor"'),a_=o(", "),nn=a("code"),l_=o('"safety_checker"'),n_=o(", "),rn=a("code"),r_=o('"scheduler"'),f_=o(", "),fn=a("code"),d_=o('"text_encoder"'),p_=o(", "),dn=a("code"),c_=o('"tokenizer"'),h_=o(", "),pn=a("code"),u_=o('"unet"'),m_=o(", "),cn=a("code"),v_=o('"vae"'),__=o("). Importantly, every pipeline expects a "),hn=a("code"),w_=o("model_index.json"),b_=o(" file that tells the "),un=a("code"),y_=o("DiffusionPipeline"),g_=o(" both:"),Lf=p(),Ut=a("ul"),mn=a("li"),E_=o("which pipeline class should be loaded, and"),D_=p(),vn=a("li"),k_=o("what sub-classes from which library are stored in which subfolders"),Of=p(),Le=a("p"),$_=o("In the case of "),_n=a("code"),P_=o("runwayml/stable-diffusion-v1-5"),j_=o(" the "),wn=a("code"),S_=o("model_index.json"),x_=o(" is therefore defined as follows:"),Nf=p(),h(lo.$$.fragment),Tf=p(),Oe=a("ul"),Rt=a("li"),bn=a("code"),q_=o("_class_name"),M_=o(" tells "),yn=a("code"),A_=o("DiffusionPipeline"),C_=o(" which pipeline class should be loaded."),I_=p(),Ft=a("li"),gn=a("code"),L_=o("_diffusers_version"),O_=o(" can be useful to know under which "),En=a("code"),N_=o("diffusers"),T_=o(" version this model was created."),z_=p(),Dn=a("li"),H_=o("Every component of the pipeline is then defined under the form:"),zf=p(),h(no.$$.fragment),Hf=p(),Ne=a("ul"),Te=a("li"),U_=o("The "),kn=a("code"),R_=o('"name"'),F_=o(" field corresponds both to the name of the subfolder in which the configuration and weights are stored as well as the attribute name of the pipeline class (as can be seen "),ro=a("a"),G_=o("here"),B_=o(" and "),fo=a("a"),K_=o("here"),W_=p(),z=a("li"),V_=o("The "),$n=a("code"),J_=o('"library"'),Q_=o(" field corresponds to the name of the library, "),Pn=a("em"),X_=o("e.g."),Y_=p(),jn=a("code"),Z_=o("diffusers"),ew=o(" or "),Sn=a("code"),tw=o("transformers"),sw=o(" from which the "),xn=a("code"),ow=o('"class"'),iw=o(" should be loaded"),aw=p(),de=a("li"),lw=o("The "),qn=a("code"),nw=o('"class"'),rw=o(" field corresponds to the name of the class, "),Mn=a("em"),fw=o("e.g."),dw=p(),po=a("a"),An=a("code"),pw=o("CLIPTokenizer"),cw=o(" or "),bi=a("a"),hw=o("UNet2DConditionModel"),Uf=p(),rt=a("h2"),Gt=a("a"),Cn=a("span"),h(co.$$.fragment),uw=p(),In=a("span"),mw=o("Loading models"),Rf=p(),pe=a("p"),vw=o("Models as defined under "),ho=a("a"),_w=o("src/diffusers/models"),ww=o(" can be loaded via the "),yi=a("a"),bw=o("ModelMixin.from_pretrained()"),yw=o(" function. The API is very similar the "),gi=a("a"),gw=o("DiffusionPipeline.from_pretrained()"),Ew=o(" and works in the same way:"),Ff=p(),Bt=a("ul"),we=a("li"),Dw=o("Download the latest version of the model weights and configuration with "),Ln=a("code"),kw=o("diffusers"),$w=o(" and cache them. If the latest files are available in the local cache, "),Ei=a("a"),Pw=o("ModelMixin.from_pretrained()"),jw=o(" will simply reuse the cache and "),On=a("strong"),Sw=o("not"),xw=o(" re-download the files."),qw=p(),ft=a("li"),Mw=o("Load the cached weights into the "),Nn=a("em"),Aw=o("defined"),Cw=o(" model class - one of "),Di=a("a"),Iw=o("the existing model classes"),Lw=o(" - and return an instance of the class."),Gf=p(),ce=a("p"),Ow=o("In constrast to "),ki=a("a"),Nw=o("DiffusionPipeline.from_pretrained()"),Tw=o(", models rely on fewer files that usually don\u2019t require a folder structure, but just a "),Tn=a("code"),zw=o("diffusion_pytorch_model.bin"),Hw=o(" and "),zn=a("code"),Uw=o("config.json"),Rw=o(" file."),Bf=p(),$i=a("p"),Fw=o("Let\u2019s look at an example:"),Kf=p(),h(uo.$$.fragment),Wf=p(),he=a("p"),Gw=o("Note how we have to define the "),Hn=a("code"),Bw=o('subfolder="unet"'),Kw=o(" argument to tell "),Pi=a("a"),Ww=o("ModelMixin.from_pretrained()"),Vw=o(" that the model weights are located in a "),mo=a("a"),Jw=o("subfolder of the repository"),Qw=o("."),Vf=p(),ze=a("p"),Xw=o("As explained in "),ji=a("a"),Yw=o("Loading customized pipelines"),Zw=o(", one can pass a loaded model to a diffusion pipeline, via "),Si=a("a"),e1=o("DiffusionPipeline.from_pretrained()"),t1=o(":"),Jf=p(),h(vo.$$.fragment),Qf=p(),He=a("p"),s1=o("If the model files can be found directly at the root level, which is usually only the case for some very simple diffusion models, such as "),_o=a("a"),Un=a("code"),o1=o("google/ddpm-cifar10-32"),i1=o(`, we don\u2019t
need to pass a `),Rn=a("code"),a1=o("subfolder"),l1=o(" argument:"),Xf=p(),h(wo.$$.fragment),Yf=p(),N=a("p"),n1=o("As motivated in "),xi=a("a"),r1=o("How to save and load variants?"),f1=o(`, models can load and
save variants. To load a model variant, one should pass the `),Fn=a("code"),d1=o("variant"),p1=o(" function argument to "),qi=a("a"),c1=o("ModelMixin.from_pretrained()"),h1=o(". Analogous, to save a model variant, one should pass the "),Gn=a("code"),u1=o("variant"),m1=o(" function argument to "),Mi=a("a"),v1=o("ModelMixin.save_pretrained()"),_1=o(":"),Zf=p(),h(bo.$$.fragment),ed=p(),dt=a("h2"),Kt=a("a"),Bn=a("span"),h(yo.$$.fragment),w1=p(),Kn=a("span"),b1=o("Loading schedulers"),td=p(),ue=a("p"),y1=o("Schedulers rely on "),Ai=a("a"),g1=o("SchedulerMixin.from_pretrained()"),E1=o(". Schedulers are "),Wn=a("strong"),D1=o("not parameterized"),k1=o(" or "),Vn=a("strong"),$1=o("trained"),P1=o(`, but instead purely defined by a configuration file.
For consistency, we use the same method name as we do for models or pipelines, but no weights are loaded in this case.`),sd=p(),Ci=a("p"),j1=o(`In constrast to pipelines or models, loading schedulers does not consume any significant amount of memory and the same configuration file can often be used for a variety of different schedulers.
For example, all of:`),od=p(),I=a("ul"),Jn=a("li"),Ii=a("a"),S1=o("DDPMScheduler"),x1=p(),Qn=a("li"),Li=a("a"),q1=o("DDIMScheduler"),M1=p(),Xn=a("li"),Oi=a("a"),A1=o("PNDMScheduler"),C1=p(),Yn=a("li"),Ni=a("a"),I1=o("LMSDiscreteScheduler"),L1=p(),Zn=a("li"),Ti=a("a"),O1=o("EulerDiscreteScheduler"),N1=p(),er=a("li"),zi=a("a"),T1=o("EulerAncestralDiscreteScheduler"),z1=p(),tr=a("li"),Hi=a("a"),H1=o("DPMSolverMultistepScheduler"),id=p(),Wt=a("p"),U1=o("are compatible with "),Ui=a("a"),R1=o("StableDiffusionPipeline"),F1=o(" and therefore the same scheduler configuration file can be loaded in any of those classes:"),ad=p(),h(go.$$.fragment),this.h()},l(t){const r=K2('[data-svelte="svelte-1phssyn"]',document.head);b=l(r,"META",{name:!0,content:!0}),r.forEach(s),te=c(t),k=l(t,"H1",{class:!0});var Eo=n(k);O=l(Eo,"A",{id:!0,class:!0,href:!0});var sr=n(O);Y=l(sr,"SPAN",{});var J1=n(Y);u(S.$$.fragment,J1),J1.forEach(s),sr.forEach(s),U=c(Eo),se=l(Eo,"SPAN",{});var Q1=n(se);Je=i(Q1,"Loading"),Q1.forEach(s),Eo.forEach(s),ct=c(t),oe=l(t,"P",{});var nd=n(oe);Qe=i(nd,"A core premise of the diffusers library is to make diffusion models "),Xe=l(nd,"STRONG",{});var X1=n(Xe);is=i(X1,"as accessible as possible"),X1.forEach(s),Ye=i(nd,`.
Accessibility is therefore achieved by providing an API to load complete diffusion pipelines as well as individual components with a single line of code.`),nd.forEach(s),ht=c(t),ye=l(t,"P",{});var Y1=n(ye);ut=i(Y1,"In the following we explain in-detail how to easily load:"),Y1.forEach(s),ie=c(t),T=l(t,"UL",{});var Ri=n(T);$=l(Ri,"LI",{});var rd=n($);P=l(rd,"EM",{});var Z1=n(P);xo=i(Z1,"Complete Diffusion Pipelines"),Z1.forEach(s),qo=i(rd," via the "),Ze=l(rd,"A",{href:!0});var eb=n(Ze);Mo=i(eb,"DiffusionPipeline.from_pretrained()"),eb.forEach(s),rd.forEach(s),Ao=c(Ri),as=l(Ri,"LI",{});var fd=n(as);la=l(fd,"EM",{});var tb=n(la);Ad=i(tb,"Diffusion Models"),tb.forEach(s),Cd=i(fd," via "),Co=l(fd,"A",{href:!0});var sb=n(Co);Id=i(sb,"ModelMixin.from_pretrained()"),sb.forEach(s),fd.forEach(s),Ld=c(Ri),ls=l(Ri,"LI",{});var dd=n(ls);na=l(dd,"EM",{});var ob=n(na);Od=i(ob,"Schedulers"),ob.forEach(s),Nd=i(dd," via "),Io=l(dd,"A",{href:!0});var ib=n(Io);Td=i(ib,"SchedulerMixin.from_pretrained()"),ib.forEach(s),dd.forEach(s),Ri.forEach(s),dr=c(t),et=l(t,"H2",{class:!0});var pd=n(et);mt=l(pd,"A",{id:!0,class:!0,href:!0});var ab=n(mt);ra=l(ab,"SPAN",{});var lb=n(ra);u(ns.$$.fragment,lb),lb.forEach(s),ab.forEach(s),zd=c(pd),fa=l(pd,"SPAN",{});var nb=n(fa);Hd=i(nb,"Loading pipelines"),nb.forEach(s),pd.forEach(s),pr=c(t),ae=l(t,"P",{});var Vt=n(ae);Ud=i(Vt,"The "),Lo=l(Vt,"A",{href:!0});var rb=n(Lo);Rd=i(rb,"DiffusionPipeline"),rb.forEach(s),Fd=i(Vt," class is the easiest way to access any diffusion model that is "),rs=l(Vt,"A",{href:!0,rel:!0});var fb=n(rs);Gd=i(fb,"available on the Hub"),fb.forEach(s),Bd=i(Vt,". Let\u2019s look at an example on how to download "),fs=l(Vt,"A",{href:!0,rel:!0});var db=n(fs);Kd=i(db,"Runway\u2019s Stable Diffusion model"),db.forEach(s),Wd=i(Vt,"."),Vt.forEach(s),cr=c(t),u(ds.$$.fragment,t),hr=c(t),q=l(t,"P",{});var V=n(q);Vd=i(V,"Here "),Oo=l(V,"A",{href:!0});var pb=n(Oo);Jd=i(pb,"DiffusionPipeline"),pb.forEach(s),Qd=i(V," automatically detects the correct pipeline ("),da=l(V,"EM",{});var cb=n(da);Xd=i(cb,"i.e."),cb.forEach(s),Yd=c(V),No=l(V,"A",{href:!0});var hb=n(No);Zd=i(hb,"StableDiffusionPipeline"),hb.forEach(s),ep=i(V,"), downloads and caches all required configuration and weight files (if not already done so), and finally returns a pipeline instance, called "),pa=l(V,"CODE",{});var ub=n(pa);tp=i(ub,"pipe"),ub.forEach(s),sp=i(V,`.
The pipeline instance can then be called using `),vt=l(V,"A",{href:!0});var cd=n(vt);op=i(cd,"StableDiffusionPipeline."),ca=l(cd,"STRONG",{});var mb=n(ca);ip=i(mb,"call"),mb.forEach(s),ap=i(cd,"()"),cd.forEach(s),lp=i(V," (i.e., "),ha=l(V,"CODE",{});var vb=n(ha);np=i(vb,'pipe("image of a astronaut riding a horse")'),vb.forEach(s),rp=i(V,") for text-to-image generation."),V.forEach(s),ur=c(t),_t=l(t,"P",{});var hd=n(_t);fp=i(hd,"Instead of using the generic "),To=l(hd,"A",{href:!0});var _b=n(To);dp=i(_b,"DiffusionPipeline"),_b.forEach(s),pp=i(hd," class for loading, you can also load the appropriate pipeline class directly. The code snippet above yields the same instance as when doing:"),hd.forEach(s),mr=c(t),u(ps.$$.fragment,t),vr=c(t),u(wt.$$.fragment,t),_r=c(t),E=l(t,"P",{});var x=n(E);cp=i(x,"Diffusion pipelines like "),ua=l(x,"CODE",{});var wb=n(ua);hp=i(wb,"StableDiffusionPipeline"),wb.forEach(s),up=i(x," or "),ma=l(x,"CODE",{});var bb=n(ma);mp=i(bb,"StableDiffusionImg2ImgPipeline"),bb.forEach(s),vp=i(x," consist of multiple components. These components can be both parameterized models, such as "),va=l(x,"CODE",{});var yb=n(va);_p=i(yb,'"unet"'),yb.forEach(s),wp=i(x,", "),_a=l(x,"CODE",{});var gb=n(_a);bp=i(gb,'"vae"'),gb.forEach(s),yp=i(x," and "),wa=l(x,"CODE",{});var Eb=n(wa);gp=i(Eb,'"text_encoder"'),Eb.forEach(s),Ep=i(x,`, tokenizers or schedulers.
These components often interact in complex ways with each other when using the pipeline in inference, `),ba=l(x,"EM",{});var Db=n(ba);Dp=i(Db,"e.g."),Db.forEach(s),kp=i(x," for "),zo=l(x,"A",{href:!0});var kb=n(zo);$p=i(kb,"StableDiffusionPipeline"),kb.forEach(s),Pp=i(x," the inference call is explained "),cs=l(x,"A",{href:!0,rel:!0});var $b=n(cs);jp=i($b,"here"),$b.forEach(s),Sp=i(x,`.
The purpose of the `),Ho=l(x,"A",{href:!0});var Pb=n(Ho);xp=i(Pb,"pipeline classes"),Pb.forEach(s),qp=i(x," is to wrap the complexity of these diffusion systems and give the user an easy-to-use API while staying flexible for customization, as will be shown later."),x.forEach(s),wr=c(t),tt=l(t,"H3",{class:!0});var ud=n(tt);bt=l(ud,"A",{id:!0,class:!0,href:!0});var jb=n(bt);ya=l(jb,"SPAN",{});var Sb=n(ya);u(hs.$$.fragment,Sb),Sb.forEach(s),jb.forEach(s),Mp=c(ud),ga=l(ud,"SPAN",{});var xb=n(ga);Ap=i(xb,"Loading pipelines locally"),xb.forEach(s),ud.forEach(s),br=c(t),Uo=l(t,"P",{});var qb=n(Uo);Cp=i(qb,`If you prefer to have complete control over the pipeline and its corresponding files or, as said before, if you want to use pipelines that require an access request without having to be connected to the Hugging Face Hub,
we recommend loading pipelines locally.`),qb.forEach(s),yr=c(t),ge=l(t,"P",{});var Fi=n(ge);Ip=i(Fi,"To load a diffusion pipeline locally, you first need to manually download the whole folder structure on your local disk and then pass a local path to the "),Ro=l(Fi,"A",{href:!0});var Mb=n(Ro);Lp=i(Mb,"DiffusionPipeline.from_pretrained()"),Mb.forEach(s),Op=i(Fi,`. Let\u2019s again look at an example for
`),us=l(Fi,"A",{href:!0,rel:!0});var Ab=n(us);Np=i(Ab,"Runway\u2019s Stable Diffusion Diffusion model"),Ab.forEach(s),Tp=i(Fi,"."),Fi.forEach(s),gr=c(t),Ee=l(t,"P",{});var Gi=n(Ee);zp=i(Gi,"First, you should make use of "),ms=l(Gi,"A",{href:!0,rel:!0});var Cb=n(ms);Ea=l(Cb,"CODE",{});var Ib=n(Ea);Hp=i(Ib,"git-lfs"),Ib.forEach(s),Cb.forEach(s),Up=i(Gi," to download the whole folder structure that has been uploaded to the "),vs=l(Gi,"A",{href:!0,rel:!0});var Lb=n(vs);Rp=i(Lb,"model repository"),Lb.forEach(s),Fp=i(Gi,":"),Gi.forEach(s),Er=c(t),u(_s.$$.fragment,t),Dr=c(t),De=l(t,"P",{});var Bi=n(De);Gp=i(Bi,"The command above will create a local folder called "),Da=l(Bi,"CODE",{});var Ob=n(Da);Bp=i(Ob,"./stable-diffusion-v1-5"),Ob.forEach(s),Kp=i(Bi,` on your disk.
Now, all you have to do is to simply pass the local folder path to `),ka=l(Bi,"CODE",{});var Nb=n(ka);Wp=i(Nb,"from_pretrained"),Nb.forEach(s),Vp=i(Bi,":"),Bi.forEach(s),kr=c(t),u(ws.$$.fragment,t),$r=c(t),ke=l(t,"P",{});var Ki=n(ke);Jp=i(Ki,"If "),$a=l(Ki,"CODE",{});var Tb=n($a);Qp=i(Tb,"repo_id"),Tb.forEach(s),Xp=i(Ki," is a local path, as it is the case here, "),Fo=l(Ki,"A",{href:!0});var zb=n(Fo);Yp=i(zb,"DiffusionPipeline.from_pretrained()"),zb.forEach(s),Zp=i(Ki,` will automatically detect it and therefore not try to download any files from the Hub.
While we usually recommend to load weights directly from the Hub to be certain to stay up to date with the newest changes, loading pipelines locally should be preferred if one
wants to stay anonymous, self-contained applications, etc\u2026`),Ki.forEach(s),Pr=c(t),st=l(t,"H3",{class:!0});var md=n(st);yt=l(md,"A",{id:!0,class:!0,href:!0});var Hb=n(yt);Pa=l(Hb,"SPAN",{});var Ub=n(Pa);u(bs.$$.fragment,Ub),Ub.forEach(s),Hb.forEach(s),ec=c(md),ja=l(md,"SPAN",{});var Rb=n(ja);tc=i(Rb,"Loading customized pipelines"),Rb.forEach(s),md.forEach(s),jr=c(t),R=l(t,"P",{});var Ue=n(R);sc=i(Ue,"Advanced users that want to load customized versions of diffusion pipelines can do so by swapping any of the default components, "),Sa=l(Ue,"EM",{});var Fb=n(Sa);oc=i(Fb,"e.g."),Fb.forEach(s),ic=i(Ue,` the scheduler, with other scheduler classes.
A classical use case of this functionality is to swap the scheduler. `),ys=l(Ue,"A",{href:!0,rel:!0});var Gb=n(ys);ac=i(Gb,"Stable Diffusion v1-5"),Gb.forEach(s),lc=i(Ue," uses the "),Go=l(Ue,"A",{href:!0});var Bb=n(Go);nc=i(Bb,"PNDMScheduler"),Bb.forEach(s),rc=i(Ue,` by default which is generally not the most performant scheduler. Since the release
of stable diffusion, multiple improved schedulers have been published. To use those, the user has to manually load their preferred scheduler and pass it into `),Bo=l(Ue,"A",{href:!0});var Kb=n(Bo);fc=i(Kb,"DiffusionPipeline.from_pretrained()"),Kb.forEach(s),dc=i(Ue,"."),Ue.forEach(s),Sr=c(t),_e=l(t,"P",{});var Do=n(_e);xa=l(Do,"EM",{});var Wb=n(xa);pc=i(Wb,"E.g."),Wb.forEach(s),cc=i(Do," to use "),Ko=l(Do,"A",{href:!0});var Vb=n(Ko);hc=i(Vb,"EulerDiscreteScheduler"),Vb.forEach(s),uc=i(Do," or "),Wo=l(Do,"A",{href:!0});var Jb=n(Wo);mc=i(Jb,"DPMSolverMultistepScheduler"),Jb.forEach(s),vc=i(Do," to have a better quality vs. generation speed trade-off for inference, one could load them as follows:"),Do.forEach(s),xr=c(t),u(gs.$$.fragment,t),qr=c(t),Vo=l(t,"P",{});var Qb=n(Vo);_c=i(Qb,"Three things are worth paying attention to here."),Qb.forEach(s),Mr=c(t),$e=l(t,"UL",{});var Wi=n($e);Jo=l(Wi,"LI",{});var G1=n(Jo);wc=i(G1,"First, the scheduler is loaded with "),Qo=l(G1,"A",{href:!0});var Xb=n(Qo);bc=i(Xb,"SchedulerMixin.from_pretrained()"),Xb.forEach(s),G1.forEach(s),yc=c(Wi),gt=l(Wi,"LI",{});var or=n(gt);gc=i(or,"Second, the scheduler is loaded with a function argument, called "),qa=l(or,"CODE",{});var Yb=n(qa);Ec=i(Yb,'subfolder="scheduler"'),Yb.forEach(s),Dc=i(or," as the configuration of stable diffusion\u2019s scheduling is defined in a "),Es=l(or,"A",{href:!0,rel:!0});var Zb=n(Es);kc=i(Zb,"subfolder of the official pipeline repository"),Zb.forEach(s),or.forEach(s),$c=c(Wi),M=l(Wi,"LI",{});var H=n(M);Pc=i(H,"Third, the scheduler instance can simply be passed with the "),Ma=l(H,"CODE",{});var ey=n(Ma);jc=i(ey,"scheduler"),ey.forEach(s),Sc=i(H," keyword argument to "),Xo=l(H,"A",{href:!0});var ty=n(Xo);xc=i(ty,"DiffusionPipeline.from_pretrained()"),ty.forEach(s),qc=i(H,". This works because the "),Yo=l(H,"A",{href:!0});var sy=n(Yo);Mc=i(sy,"StableDiffusionPipeline"),sy.forEach(s),Ac=i(H," defines its scheduler with the "),Aa=l(H,"CODE",{});var oy=n(Aa);Cc=i(oy,"scheduler"),oy.forEach(s),Ic=i(H," attribute. It\u2019s not possible to use a different name, such as "),Ca=l(H,"CODE",{});var iy=n(Ca);Lc=i(iy,"sampler=scheduler"),iy.forEach(s),Oc=i(H," since "),Ia=l(H,"CODE",{});var ay=n(Ia);Nc=i(ay,"sampler"),ay.forEach(s),Tc=i(H," is not a defined keyword for "),La=l(H,"CODE",{});var ly=n(La);zc=i(ly,"StableDiffusionPipeline.__init__()"),ly.forEach(s),H.forEach(s),Wi.forEach(s),Ar=c(t),le=l(t,"P",{});var Jt=n(le);Hc=i(Jt,"Not only the scheduler components can be customized for diffusion pipelines; in theory, all components of a pipeline can be customized. In practice, however, it often only makes sense to switch out a component that has "),Oa=l(Jt,"STRONG",{});var ny=n(Oa);Uc=i(ny,"compatible"),ny.forEach(s),Rc=i(Jt,` alternatives to what the pipeline expects.
Many scheduler classes are compatible with each other as can be seen `),Ds=l(Jt,"A",{href:!0,rel:!0});var ry=n(Ds);Fc=i(ry,"here"),ry.forEach(s),Gc=i(Jt,". This is not always the case for other components, such as the "),Na=l(Jt,"CODE",{});var fy=n(Na);Bc=i(fy,'"unet"'),fy.forEach(s),Kc=i(Jt,"."),Jt.forEach(s),Cr=c(t),Pe=l(t,"P",{});var Vi=n(Pe);Wc=i(Vi,"One special case that can also be customized is the "),Ta=l(Vi,"CODE",{});var dy=n(Ta);Vc=i(dy,'"safety_checker"'),dy.forEach(s),Jc=i(Vi," of stable diffusion. If you believe the safety checker doesn\u2019t serve you any good, you can simply disable it by passing "),za=l(Vi,"CODE",{});var py=n(za);Qc=i(py,"None"),py.forEach(s),Xc=i(Vi,":"),Vi.forEach(s),Ir=c(t),u(ks.$$.fragment,t),Lr=c(t),F=l(t,"P",{});var Re=n(F);Yc=i(Re,"Another common use case is to reuse the same components in multiple pipelines, "),Ha=l(Re,"EM",{});var cy=n(Ha);Zc=i(cy,"e.g."),cy.forEach(s),eh=i(Re," the weights and configurations of "),$s=l(Re,"A",{href:!0,rel:!0});var hy=n($s);Ua=l(hy,"CODE",{});var uy=n(Ua);th=i(uy,'"runwayml/stable-diffusion-v1-5"'),uy.forEach(s),hy.forEach(s),sh=i(Re," can be used for both "),Zo=l(Re,"A",{href:!0});var my=n(Zo);oh=i(my,"StableDiffusionPipeline"),my.forEach(s),ih=i(Re," and "),ei=l(Re,"A",{href:!0});var vy=n(ei);ah=i(vy,"StableDiffusionImg2ImgPipeline"),vy.forEach(s),lh=i(Re,` and we might not want to
use the exact same weights into RAM twice. In this case, customizing all the input instances would help us
to only load the weights into RAM once:`),Re.forEach(s),Or=c(t),u(Ps.$$.fragment,t),Nr=c(t),Et=l(t,"P",{});var vd=n(Et);nh=i(vd,"Note how the above code snippet makes use of "),ti=l(vd,"A",{href:!0});var _y=n(ti);rh=i(_y,"DiffusionPipeline.components"),_y.forEach(s),fh=i(vd,"."),vd.forEach(s),Tr=c(t),ot=l(t,"H3",{class:!0});var _d=n(ot);Dt=l(_d,"A",{id:!0,class:!0,href:!0});var wy=n(Dt);Ra=l(wy,"SPAN",{});var by=n(Ra);u(js.$$.fragment,by),by.forEach(s),wy.forEach(s),dh=c(_d),Fa=l(_d,"SPAN",{});var yy=n(Fa);ph=i(yy,"Loading variants"),yy.forEach(s),_d.forEach(s),zr=c(t),ne=l(t,"P",{});var Qt=n(ne);ch=i(Qt,`Diffusion Pipeline checkpoints can offer variants of the \u201Cmain\u201D diffusion pipeline checkpoint.
Such checkpoint variants are usually variations of the checkpoint that have advantages for specific use-cases and that are so similar to the \u201Cmain\u201D checkpoint that they `),Ga=l(Qt,"STRONG",{});var gy=n(Ga);hh=i(gy,"should not"),gy.forEach(s),uh=i(Qt,` be put in a new checkpoint.
A variation of a checkpoint has to have `),Ba=l(Qt,"STRONG",{});var Ey=n(Ba);mh=i(Ey,"exactly"),Ey.forEach(s),vh=i(Qt," the same serialization format and "),Ka=l(Qt,"STRONG",{});var Dy=n(Ka);_h=i(Dy,"exactly"),Dy.forEach(s),wh=i(Qt," the same model structure, including all weights having the same tensor shapes."),Qt.forEach(s),Hr=c(t),si=l(t,"P",{});var ky=n(si);bh=i(ky,"Examples of variations are different floating point types and non-ema weights. I.e. \u201Cfp16\u201D, \u201Cbf16\u201D, and \u201Cno_ema\u201D are common variations."),ky.forEach(s),Ur=c(t),it=l(t,"H4",{class:!0});var wd=n(it);kt=l(wd,"A",{id:!0,class:!0,href:!0});var $y=n(kt);Wa=l($y,"SPAN",{});var Py=n(Wa);u(Ss.$$.fragment,Py),Py.forEach(s),$y.forEach(s),yh=c(wd),Va=l(wd,"SPAN",{});var jy=n(Va);gh=i(jy,"Let's first talk about whats **not** checkpoint variant,"),jy.forEach(s),wd.forEach(s),Rr=c(t),je=l(t,"P",{});var Ji=n(je);Eh=i(Ji,"Checkpoint variants do "),Ja=l(Ji,"STRONG",{});var Sy=n(Ja);Dh=i(Sy,"not"),Sy.forEach(s),kh=i(Ji," include different serialization formats (such as "),xs=l(Ji,"A",{href:!0,rel:!0});var xy=n(xs);$h=i(xy,"safetensors"),xy.forEach(s),Ph=i(Ji,`) as weights in different serialization formats are
identical to the weights of the \u201Cmain\u201D checkpoint, just loaded in a different framework.`),Ji.forEach(s),Fr=c(t),G=l(t,"P",{});var Fe=n(G);jh=i(Fe,"Also variants do not correspond to different model structures, "),Qa=l(Fe,"EM",{});var qy=n(Qa);Sh=i(qy,"e.g."),qy.forEach(s),xh=c(Fe),qs=l(Fe,"A",{href:!0,rel:!0});var My=n(qs);qh=i(My,"stable-diffusion-v1-5"),My.forEach(s),Mh=i(Fe," is not a variant of "),Ms=l(Fe,"A",{href:!0,rel:!0});var Ay=n(Ms);Ah=i(Ay,"stable-diffusion-2-0"),Ay.forEach(s),Ch=i(Fe," since the model structure is different (Stable Diffusion 1-5 uses a different "),Xa=l(Fe,"CODE",{});var Cy=n(Xa);Ih=i(Cy,"CLIPTextModel"),Cy.forEach(s),Lh=i(Fe," compared to Stable Diffusion 2.0)."),Fe.forEach(s),Gr=c(t),Se=l(t,"P",{});var Qi=n(Se);Oh=i(Qi,"Pipeline checkpoints that are identical in model structure, but have been trained on different datasets, trained with vastly different training setups and thus correspond to different official releases (such as "),As=l(Qi,"A",{href:!0,rel:!0});var Iy=n(As);Nh=i(Iy,"Stable Diffusion v1-4"),Iy.forEach(s),Th=i(Qi," and "),Cs=l(Qi,"A",{href:!0,rel:!0});var Ly=n(Cs);zh=i(Ly,"Stable Diffusion v1-5"),Ly.forEach(s),Hh=i(Qi,") should probably be stored in individual repositories instead of as variations of eachother."),Qi.forEach(s),Br=c(t),at=l(t,"H4",{class:!0});var bd=n(at);$t=l(bd,"A",{id:!0,class:!0,href:!0});var Oy=n($t);Ya=l(Oy,"SPAN",{});var Ny=n(Ya);u(Is.$$.fragment,Ny),Ny.forEach(s),Oy.forEach(s),Uh=c(bd),Za=l(bd,"SPAN",{});var Ty=n(Za);Rh=i(Ty,"So what are checkpoint variants then?"),Ty.forEach(s),bd.forEach(s),Kr=c(t),A=l(t,"P",{});var J=n(A);Fh=i(J,"Checkpoint variants usually consist of the checkpoint stored in \u201D"),el=l(J,"EM",{});var zy=n(el);Gh=i(zy,"low-precision, low-storage"),zy.forEach(s),Bh=i(J,"\u201D dtype so that less bandwith is required to download them, or of "),tl=l(J,"EM",{});var Hy=n(tl);Kh=i(Hy,"non-exponential-averaged"),Hy.forEach(s),Wh=i(J,` weights that shall be used when continuing fine-tuning from the checkpoint.
Both use cases have clear advantages when their weights are considered variants: they share the same serialization format as the reference weights, and they correspond to a specialization of the \u201Cmain\u201D checkpoint which does not warrant a new model repository.
A checkpoint stored in `),Ls=l(J,"A",{href:!0,rel:!0});var Uy=n(Ls);Vh=i(Uy,"torch\u2019s half-precision / float16 format"),Uy.forEach(s),Jh=i(J,` requires only half the bandwith and storage when downloading the checkpoint,
`),sl=l(J,"STRONG",{});var Ry=n(sl);Qh=i(Ry,"but"),Ry.forEach(s),Xh=i(J,` cannot be used when continuing training or when running the checkpoint on CPU.
Similarly the `),ol=l(J,"EM",{});var Fy=n(ol);Yh=i(Fy,"non-exponential-averaged"),Fy.forEach(s),Zh=i(J," (or non-EMA) version of the checkpoint should be used when continuing fine-tuning of the model checkpoint, "),il=l(J,"STRONG",{});var Gy=n(il);eu=i(Gy,"but"),Gy.forEach(s),tu=i(J," should not be used when using the checkpoint for inference."),J.forEach(s),Wr=c(t),lt=l(t,"H4",{class:!0});var yd=n(lt);Pt=l(yd,"A",{id:!0,class:!0,href:!0});var By=n(Pt);al=l(By,"SPAN",{});var Ky=n(al);u(Os.$$.fragment,Ky),Ky.forEach(s),By.forEach(s),su=c(yd),ll=l(yd,"SPAN",{});var Wy=n(ll);ou=i(Wy,"How to save and load variants"),Wy.forEach(s),yd.forEach(s),Vr=c(t),j=l(t,"P",{});var L=n(j);iu=i(L,"Saving a diffusion pipeline as a variant can be done by providing "),oi=l(L,"A",{href:!0});var Vy=n(oi);au=i(Vy,"DiffusionPipeline.save_pretrained()"),Vy.forEach(s),lu=i(L," with the "),nl=l(L,"CODE",{});var Jy=n(nl);nu=i(Jy,"variant"),Jy.forEach(s),ru=i(L,` argument.
The `),rl=l(L,"CODE",{});var Qy=n(rl);fu=i(Qy,"variant"),Qy.forEach(s),du=i(L," extends the weight name by the provided variation, by changing the default weight name from "),fl=l(L,"CODE",{});var Xy=n(fl);pu=i(Xy,"diffusion_pytorch_model.bin"),Xy.forEach(s),cu=i(L," to "),dl=l(L,"CODE",{});var Yy=n(dl);hu=i(Yy,"diffusion_pytorch_model.{variant}.bin"),Yy.forEach(s),uu=i(L," or from "),pl=l(L,"CODE",{});var Zy=n(pl);mu=i(Zy,"diffusion_pytorch_model.safetensors"),Zy.forEach(s),vu=i(L," to "),cl=l(L,"CODE",{});var eg=n(cl);_u=i(eg,"diffusion_pytorch_model.{variant}.safetensors"),eg.forEach(s),wu=i(L,". By doing so, one creates a variant of the pipeline checkpoint that can be loaded "),hl=l(L,"STRONG",{});var tg=n(hl);bu=i(tg,"instead"),tg.forEach(s),yu=i(L," of the \u201Cmain\u201D pipeline checkpoint."),L.forEach(s),Jr=c(t),xe=l(t,"P",{});var Xi=n(xe);gu=i(Xi,`Let\u2019s have a look at how we could create a float16 variant of a pipeline. First, we load
the \u201Cmain\u201D variant of a checkpoint (stored in `),ul=l(Xi,"CODE",{});var sg=n(ul);Eu=i(sg,"float32"),sg.forEach(s),Du=i(Xi," precision) into mixed precision format, using "),ml=l(Xi,"CODE",{});var og=n(ml);ku=i(og,"torch_dtype=torch.float16"),og.forEach(s),$u=i(Xi,"."),Xi.forEach(s),Qr=c(t),u(Ns.$$.fragment,t),Xr=c(t),jt=l(t,"P",{});var gd=n(jt);Pu=i(gd,`Now all model components of the pipeline are stored in half-precision dtype. We can now save the
pipeline under a `),vl=l(gd,"CODE",{});var ig=n(vl);ju=i(ig,'"fp16"'),ig.forEach(s),Su=i(gd," variant as follows:"),gd.forEach(s),Yr=c(t),u(Ts.$$.fragment,t),Zr=c(t),St=l(t,"P",{});var Ed=n(St);xu=i(Ed,"If we don\u2019t save into an existing "),_l=l(Ed,"CODE",{});var ag=n(_l);qu=i(ag,"stable-diffusion-v1-5"),ag.forEach(s),Mu=i(Ed," folder the new folder would look as follows:"),Ed.forEach(s),ef=c(t),u(zs.$$.fragment,t),tf=c(t),B=l(t,"P",{});var Ge=n(B);Au=i(Ge,"As one can see, all model files now have a "),wl=l(Ge,"CODE",{});var lg=n(wl);Cu=i(lg,".fp16.bin"),lg.forEach(s),Iu=i(Ge," extension instead of just "),bl=l(Ge,"CODE",{});var ng=n(bl);Lu=i(ng,".bin"),ng.forEach(s),Ou=i(Ge,`.
The variant now has to be loaded by also passing a `),yl=l(Ge,"CODE",{});var rg=n(yl);Nu=i(rg,'variant="fp16"'),rg.forEach(s),Tu=i(Ge," to "),ii=l(Ge,"A",{href:!0});var fg=n(ii);zu=i(fg,"DiffusionPipeline.from_pretrained()"),fg.forEach(s),Hu=i(Ge,", e.g.:"),Ge.forEach(s),sf=c(t),u(Hs.$$.fragment,t),of=c(t),ai=l(t,"P",{});var dg=n(ai);Uu=i(dg,"works just fine, while:"),dg.forEach(s),af=c(t),u(Us.$$.fragment,t),lf=c(t),li=l(t,"P",{});var pg=n(li);Ru=i(pg,"throws an Exception:"),pg.forEach(s),nf=c(t),u(Rs.$$.fragment,t),rf=c(t),ni=l(t,"P",{});var cg=n(ni);Fu=i(cg,`This is expected as we don\u2019t have any \u201Cnon-variant\u201D checkpoint files saved locally.
However, the whole idea of pipeline variants is that they can co-exist with the \u201Cmain\u201D variant,
so one would typically also save the \u201Cmain\u201D variant in the same folder. Let\u2019s do this:`),cg.forEach(s),ff=c(t),u(Fs.$$.fragment,t),df=c(t),qe=l(t,"P",{});var Yi=n(qe);Gu=i(Yi,"and upload the pipeline to the Hub under "),Gs=l(Yi,"A",{href:!0,rel:!0});var hg=n(Gs);Bu=i(hg,"diffusers/stable-diffusion-variants"),hg.forEach(s),Ku=i(Yi,`.
The file structure `),Bs=l(Yi,"A",{href:!0,rel:!0});var ug=n(Bs);Wu=i(ug,"on the Hub"),ug.forEach(s),Vu=i(Yi," now looks as follows:"),Yi.forEach(s),pf=c(t),u(Ks.$$.fragment,t),cf=c(t),ri=l(t,"P",{});var mg=n(ri);Ju=i(mg,"We can now both download the \u201Cmain\u201D and the \u201Cfp16\u201D variant from the Hub. Both:"),mg.forEach(s),hf=c(t),u(Ws.$$.fragment,t),uf=c(t),fi=l(t,"P",{});var vg=n(fi);Qu=i(vg,"and"),vg.forEach(s),mf=c(t),u(Vs.$$.fragment,t),vf=c(t),di=l(t,"P",{});var _g=n(di);Xu=i(_g,"works."),_g.forEach(s),_f=c(t),u(xt.$$.fragment,t),wf=c(t),K=l(t,"P",{});var Be=n(K);Yu=i(Be,`Finally, there are cases where only some of the checkpoint files of the pipeline are of a certain
variation. E.g. it\u2019s usually only the UNet checkpoint that has both a `),gl=l(Be,"EM",{});var wg=n(gl);Zu=i(wg,"exponential-mean-averaged"),wg.forEach(s),em=i(Be," (EMA) and a "),El=l(Be,"EM",{});var bg=n(El);tm=i(bg,"non-exponential-mean-averaged"),bg.forEach(s),sm=i(Be,` (non-EMA) version. All other model components, e.g. the text encoder, safety checker or variational auto-encoder usually don\u2019t have such a variation.
In such a case, one would upload just the UNet\u2019s checkpoint file with a `),Dl=l(Be,"CODE",{});var yg=n(Dl);om=i(yg,"non_ema"),yg.forEach(s),im=i(Be," version format (as done "),Js=l(Be,"A",{href:!0,rel:!0});var gg=n(Js);am=i(gg,"here"),gg.forEach(s),lm=i(Be,") and upon calling:"),Be.forEach(s),bf=c(t),u(Qs.$$.fragment,t),yf=c(t),qt=l(t,"P",{});var Dd=n(qt);nm=i(Dd,`the model will use only the \u201Cnon_ema\u201D checkpoint variant if it is available - otherwise it\u2019ll load the
\u201Cmain\u201D variation. In the above example, `),kl=l(Dd,"CODE",{});var Eg=n(kl);rm=i(Eg,'variant="non_ema"'),Eg.forEach(s),fm=i(Dd," would therefore download the following file structure:"),Dd.forEach(s),gf=c(t),u(Xs.$$.fragment,t),Ef=c(t),re=l(t,"P",{});var Xt=n(re);dm=i(Xt,"In a nutshell, using "),$l=l(Xt,"CODE",{});var Dg=n($l);pm=i(Dg,'variant="{variant}"'),Dg.forEach(s),cm=i(Xt," will download all files that match the "),Pl=l(Xt,"CODE",{});var kg=n(Pl);hm=i(kg,"{variant}"),kg.forEach(s),um=i(Xt," and if for a model component such a file variant is not present it will download the \u201Cmain\u201D variant. If neither a \u201Cmain\u201D or "),jl=l(Xt,"CODE",{});var $g=n(jl);mm=i($g,"{variant}"),$g.forEach(s),vm=i(Xt," variant is available, an error will the thrown."),Xt.forEach(s),Df=c(t),nt=l(t,"H3",{class:!0});var kd=n(nt);Mt=l(kd,"A",{id:!0,class:!0,href:!0});var Pg=n(Mt);Sl=l(Pg,"SPAN",{});var jg=n(Sl);u(Ys.$$.fragment,jg),jg.forEach(s),Pg.forEach(s),_m=c(kd),xl=l(kd,"SPAN",{});var Sg=n(xl);wm=i(Sg,"How does loading work?"),Sg.forEach(s),kd.forEach(s),kf=c(t),At=l(t,"P",{});var $d=n(At);bm=i($d,"As a class method, "),pi=l($d,"A",{href:!0});var xg=n(pi);ym=i(xg,"DiffusionPipeline.from_pretrained()"),xg.forEach(s),gm=i($d," is responsible for two things:"),$d.forEach(s),$f=c(t),Ct=l(t,"UL",{});var Pd=n(Ct);Z=l(Pd,"LI",{});var Ke=n(Z);Em=i(Ke,"Download the latest version of the folder structure required to run the "),ql=l(Ke,"CODE",{});var qg=n(ql);Dm=i(qg,"repo_id"),qg.forEach(s),km=i(Ke," with "),Ml=l(Ke,"CODE",{});var Mg=n(Ml);$m=i(Mg,"diffusers"),Mg.forEach(s),Pm=i(Ke," and cache them. If the latest folder structure is available in the local cache, "),ci=l(Ke,"A",{href:!0});var Ag=n(ci);jm=i(Ag,"DiffusionPipeline.from_pretrained()"),Ag.forEach(s),Sm=i(Ke," will simply reuse the cache and "),Al=l(Ke,"STRONG",{});var Cg=n(Al);xm=i(Cg,"not"),Cg.forEach(s),qm=i(Ke," re-download the files."),Ke.forEach(s),Mm=c(Pd),ee=l(Pd,"LI",{});var We=n(ee);Am=i(We,"Load the cached weights into the "),Cl=l(We,"EM",{});var Ig=n(Cl);Cm=i(Ig,"correct"),Ig.forEach(s),Im=i(We," pipeline class \u2013 one of the "),hi=l(We,"A",{href:!0});var Lg=n(hi);Lm=i(Lg,"officially supported pipeline classes"),Lg.forEach(s),Om=i(We," - and return an instance of the class. The "),Il=l(We,"EM",{});var Og=n(Il);Nm=i(Og,"correct"),Og.forEach(s),Tm=i(We," pipeline class is thereby retrieved from the "),Ll=l(We,"CODE",{});var Ng=n(Ll);zm=i(Ng,"model_index.json"),Ng.forEach(s),Hm=i(We," file."),We.forEach(s),Pd.forEach(s),Pf=c(t),W=l(t,"P",{});var Ve=n(W);Um=i(Ve,"The underlying folder structure of diffusion pipelines correspond 1-to-1 to their corresponding class instances, "),Ol=l(Ve,"EM",{});var Tg=n(Ol);Rm=i(Tg,"e.g."),Tg.forEach(s),Fm=c(Ve),ui=l(Ve,"A",{href:!0});var zg=n(ui);Gm=i(zg,"StableDiffusionPipeline"),zg.forEach(s),Bm=i(Ve," for "),Zs=l(Ve,"A",{href:!0,rel:!0});var Hg=n(Zs);Nl=l(Hg,"CODE",{});var Ug=n(Nl);Km=i(Ug,"runwayml/stable-diffusion-v1-5"),Ug.forEach(s),Hg.forEach(s),Wm=i(Ve,`
This can be better understood by looking at an example. Let\u2019s load a pipeline class instance `),Tl=l(Ve,"CODE",{});var Rg=n(Tl);Vm=i(Rg,"pipe"),Rg.forEach(s),Jm=i(Ve," and print it:"),Ve.forEach(s),jf=c(t),u(eo.$$.fragment,t),Sf=c(t),to=l(t,"P",{});var B1=n(to);zl=l(B1,"EM",{});var Fg=n(zl);Qm=i(Fg,"Output"),Fg.forEach(s),Xm=i(B1,":"),B1.forEach(s),xf=c(t),u(so.$$.fragment,t),qf=c(t),Me=l(t,"P",{});var Zi=n(Me);Ym=i(Zi,"First, we see that the official pipeline is the "),mi=l(Zi,"A",{href:!0});var Gg=n(mi);Zm=i(Gg,"StableDiffusionPipeline"),Gg.forEach(s),ev=i(Zi,", and second we see that the "),Hl=l(Zi,"CODE",{});var Bg=n(Hl);tv=i(Bg,"StableDiffusionPipeline"),Bg.forEach(s),sv=i(Zi," consists of 7 components:"),Zi.forEach(s),Mf=c(t),C=l(t,"UL",{});var Q=n(C);Ae=l(Q,"LI",{});var ko=n(Ae);Ul=l(ko,"CODE",{});var Kg=n(Ul);ov=i(Kg,'"feature_extractor"'),Kg.forEach(s),iv=i(ko," of class "),Rl=l(ko,"CODE",{});var Wg=n(Rl);av=i(Wg,"CLIPFeatureExtractor"),Wg.forEach(s),lv=i(ko," as defined "),It=l(ko,"A",{href:!0,rel:!0});var K1=n(It);nv=i(K1,"in "),Fl=l(K1,"CODE",{});var Vg=n(Fl);rv=i(Vg,"transformers"),Vg.forEach(s),K1.forEach(s),fv=i(ko,"."),ko.forEach(s),dv=c(Q),Lt=l(Q,"LI",{});var ir=n(Lt);Gl=l(ir,"CODE",{});var Jg=n(Gl);pv=i(Jg,'"safety_checker"'),Jg.forEach(s),cv=i(ir," as defined "),oo=l(ir,"A",{href:!0,rel:!0});var Qg=n(oo);hv=i(Qg,"here"),Qg.forEach(s),uv=i(ir,"."),ir.forEach(s),mv=c(Q),Ot=l(Q,"LI",{});var ar=n(Ot);Bl=l(ar,"CODE",{});var Xg=n(Bl);vv=i(Xg,'"scheduler"'),Xg.forEach(s),_v=i(ar," of class "),vi=l(ar,"A",{href:!0});var Yg=n(vi);wv=i(Yg,"PNDMScheduler"),Yg.forEach(s),bv=i(ar,"."),ar.forEach(s),yv=c(Q),Ce=l(Q,"LI",{});var $o=n(Ce);Kl=l($o,"CODE",{});var Zg=n(Kl);gv=i(Zg,'"text_encoder"'),Zg.forEach(s),Ev=i($o," of class "),Wl=l($o,"CODE",{});var eE=n(Wl);Dv=i(eE,"CLIPTextModel"),eE.forEach(s),kv=i($o," as defined "),Nt=l($o,"A",{href:!0,rel:!0});var W1=n(Nt);$v=i(W1,"in "),Vl=l(W1,"CODE",{});var tE=n(Vl);Pv=i(tE,"transformers"),tE.forEach(s),W1.forEach(s),jv=i($o,"."),$o.forEach(s),Sv=c(Q),Ie=l(Q,"LI",{});var Po=n(Ie);Jl=l(Po,"CODE",{});var sE=n(Jl);xv=i(sE,'"tokenizer"'),sE.forEach(s),qv=i(Po," of class "),Ql=l(Po,"CODE",{});var oE=n(Ql);Mv=i(oE,"CLIPTokenizer"),oE.forEach(s),Av=i(Po," as defined "),Tt=l(Po,"A",{href:!0,rel:!0});var V1=n(Tt);Cv=i(V1,"in "),Xl=l(V1,"CODE",{});var iE=n(Xl);Iv=i(iE,"transformers"),iE.forEach(s),V1.forEach(s),Lv=i(Po,"."),Po.forEach(s),Ov=c(Q),zt=l(Q,"LI",{});var lr=n(zt);Yl=l(lr,"CODE",{});var aE=n(Yl);Nv=i(aE,'"unet"'),aE.forEach(s),Tv=i(lr," of class "),_i=l(lr,"A",{href:!0});var lE=n(_i);zv=i(lE,"UNet2DConditionModel"),lE.forEach(s),Hv=i(lr,"."),lr.forEach(s),Uv=c(Q),Ht=l(Q,"LI",{});var nr=n(Ht);Zl=l(nr,"CODE",{});var nE=n(Zl);Rv=i(nE,'"vae"'),nE.forEach(s),Fv=i(nr," of class "),wi=l(nr,"A",{href:!0});var rE=n(wi);Gv=i(rE,"AutoencoderKL"),rE.forEach(s),Bv=i(nr,"."),nr.forEach(s),Q.forEach(s),Af=c(t),fe=l(t,"P",{});var Yt=n(fe);Kv=i(Yt,"Let\u2019s now compare the pipeline instance to the folder structure of the model repository "),en=l(Yt,"CODE",{});var fE=n(en);Wv=i(fE,"runwayml/stable-diffusion-v1-5"),fE.forEach(s),Vv=i(Yt,". Looking at the folder structure of "),io=l(Yt,"A",{href:!0,rel:!0});var dE=n(io);tn=l(dE,"CODE",{});var pE=n(tn);Jv=i(pE,"runwayml/stable-diffusion-v1-5"),pE.forEach(s),dE.forEach(s),Qv=i(Yt," on the Hub and  excluding model and saving format variants, we can see it matches 1-to-1 the printed out instance of "),sn=l(Yt,"CODE",{});var cE=n(sn);Xv=i(cE,"StableDiffusionPipeline"),cE.forEach(s),Yv=i(Yt," above:"),Yt.forEach(s),Cf=c(t),u(ao.$$.fragment,t),If=c(t),g=l(t,"P",{});var D=n(g);Zv=i(D,"Each attribute of the instance of "),on=l(D,"CODE",{});var hE=n(on);e_=i(hE,"StableDiffusionPipeline"),hE.forEach(s),t_=i(D," has its configuration and possibly weights defined in a subfolder that is called "),an=l(D,"STRONG",{});var uE=n(an);s_=i(uE,"exactly"),uE.forEach(s),o_=i(D," like the class attribute ("),ln=l(D,"CODE",{});var mE=n(ln);i_=i(mE,'"feature_extractor"'),mE.forEach(s),a_=i(D,", "),nn=l(D,"CODE",{});var vE=n(nn);l_=i(vE,'"safety_checker"'),vE.forEach(s),n_=i(D,", "),rn=l(D,"CODE",{});var _E=n(rn);r_=i(_E,'"scheduler"'),_E.forEach(s),f_=i(D,", "),fn=l(D,"CODE",{});var wE=n(fn);d_=i(wE,'"text_encoder"'),wE.forEach(s),p_=i(D,", "),dn=l(D,"CODE",{});var bE=n(dn);c_=i(bE,'"tokenizer"'),bE.forEach(s),h_=i(D,", "),pn=l(D,"CODE",{});var yE=n(pn);u_=i(yE,'"unet"'),yE.forEach(s),m_=i(D,", "),cn=l(D,"CODE",{});var gE=n(cn);v_=i(gE,'"vae"'),gE.forEach(s),__=i(D,"). Importantly, every pipeline expects a "),hn=l(D,"CODE",{});var EE=n(hn);w_=i(EE,"model_index.json"),EE.forEach(s),b_=i(D," file that tells the "),un=l(D,"CODE",{});var DE=n(un);y_=i(DE,"DiffusionPipeline"),DE.forEach(s),g_=i(D," both:"),D.forEach(s),Lf=c(t),Ut=l(t,"UL",{});var jd=n(Ut);mn=l(jd,"LI",{});var kE=n(mn);E_=i(kE,"which pipeline class should be loaded, and"),kE.forEach(s),D_=c(jd),vn=l(jd,"LI",{});var $E=n(vn);k_=i($E,"what sub-classes from which library are stored in which subfolders"),$E.forEach(s),jd.forEach(s),Of=c(t),Le=l(t,"P",{});var ea=n(Le);$_=i(ea,"In the case of "),_n=l(ea,"CODE",{});var PE=n(_n);P_=i(PE,"runwayml/stable-diffusion-v1-5"),PE.forEach(s),j_=i(ea," the "),wn=l(ea,"CODE",{});var jE=n(wn);S_=i(jE,"model_index.json"),jE.forEach(s),x_=i(ea," is therefore defined as follows:"),ea.forEach(s),Nf=c(t),u(lo.$$.fragment,t),Tf=c(t),Oe=l(t,"UL",{});var ta=n(Oe);Rt=l(ta,"LI",{});var rr=n(Rt);bn=l(rr,"CODE",{});var SE=n(bn);q_=i(SE,"_class_name"),SE.forEach(s),M_=i(rr," tells "),yn=l(rr,"CODE",{});var xE=n(yn);A_=i(xE,"DiffusionPipeline"),xE.forEach(s),C_=i(rr," which pipeline class should be loaded."),rr.forEach(s),I_=c(ta),Ft=l(ta,"LI",{});var fr=n(Ft);gn=l(fr,"CODE",{});var qE=n(gn);L_=i(qE,"_diffusers_version"),qE.forEach(s),O_=i(fr," can be useful to know under which "),En=l(fr,"CODE",{});var ME=n(En);N_=i(ME,"diffusers"),ME.forEach(s),T_=i(fr," version this model was created."),fr.forEach(s),z_=c(ta),Dn=l(ta,"LI",{});var AE=n(Dn);H_=i(AE,"Every component of the pipeline is then defined under the form:"),AE.forEach(s),ta.forEach(s),zf=c(t),u(no.$$.fragment,t),Hf=c(t),Ne=l(t,"UL",{});var sa=n(Ne);Te=l(sa,"LI",{});var jo=n(Te);U_=i(jo,"The "),kn=l(jo,"CODE",{});var CE=n(kn);R_=i(CE,'"name"'),CE.forEach(s),F_=i(jo," field corresponds both to the name of the subfolder in which the configuration and weights are stored as well as the attribute name of the pipeline class (as can be seen "),ro=l(jo,"A",{href:!0,rel:!0});var IE=n(ro);G_=i(IE,"here"),IE.forEach(s),B_=i(jo," and "),fo=l(jo,"A",{href:!0,rel:!0});var LE=n(fo);K_=i(LE,"here"),LE.forEach(s),jo.forEach(s),W_=c(sa),z=l(sa,"LI",{});var me=n(z);V_=i(me,"The "),$n=l(me,"CODE",{});var OE=n($n);J_=i(OE,'"library"'),OE.forEach(s),Q_=i(me," field corresponds to the name of the library, "),Pn=l(me,"EM",{});var NE=n(Pn);X_=i(NE,"e.g."),NE.forEach(s),Y_=c(me),jn=l(me,"CODE",{});var TE=n(jn);Z_=i(TE,"diffusers"),TE.forEach(s),ew=i(me," or "),Sn=l(me,"CODE",{});var zE=n(Sn);tw=i(zE,"transformers"),zE.forEach(s),sw=i(me," from which the "),xn=l(me,"CODE",{});var HE=n(xn);ow=i(HE,'"class"'),HE.forEach(s),iw=i(me," should be loaded"),me.forEach(s),aw=c(sa),de=l(sa,"LI",{});var pt=n(de);lw=i(pt,"The "),qn=l(pt,"CODE",{});var UE=n(qn);nw=i(UE,'"class"'),UE.forEach(s),rw=i(pt," field corresponds to the name of the class, "),Mn=l(pt,"EM",{});var RE=n(Mn);fw=i(RE,"e.g."),RE.forEach(s),dw=c(pt),po=l(pt,"A",{href:!0,rel:!0});var FE=n(po);An=l(FE,"CODE",{});var GE=n(An);pw=i(GE,"CLIPTokenizer"),GE.forEach(s),FE.forEach(s),cw=i(pt," or "),bi=l(pt,"A",{href:!0});var BE=n(bi);hw=i(BE,"UNet2DConditionModel"),BE.forEach(s),pt.forEach(s),sa.forEach(s),Uf=c(t),rt=l(t,"H2",{class:!0});var Sd=n(rt);Gt=l(Sd,"A",{id:!0,class:!0,href:!0});var KE=n(Gt);Cn=l(KE,"SPAN",{});var WE=n(Cn);u(co.$$.fragment,WE),WE.forEach(s),KE.forEach(s),uw=c(Sd),In=l(Sd,"SPAN",{});var VE=n(In);mw=i(VE,"Loading models"),VE.forEach(s),Sd.forEach(s),Rf=c(t),pe=l(t,"P",{});var Zt=n(pe);vw=i(Zt,"Models as defined under "),ho=l(Zt,"A",{href:!0,rel:!0});var JE=n(ho);_w=i(JE,"src/diffusers/models"),JE.forEach(s),ww=i(Zt," can be loaded via the "),yi=l(Zt,"A",{href:!0});var QE=n(yi);bw=i(QE,"ModelMixin.from_pretrained()"),QE.forEach(s),yw=i(Zt," function. The API is very similar the "),gi=l(Zt,"A",{href:!0});var XE=n(gi);gw=i(XE,"DiffusionPipeline.from_pretrained()"),XE.forEach(s),Ew=i(Zt," and works in the same way:"),Zt.forEach(s),Ff=c(t),Bt=l(t,"UL",{});var xd=n(Bt);we=l(xd,"LI",{});var es=n(we);Dw=i(es,"Download the latest version of the model weights and configuration with "),Ln=l(es,"CODE",{});var YE=n(Ln);kw=i(YE,"diffusers"),YE.forEach(s),$w=i(es," and cache them. If the latest files are available in the local cache, "),Ei=l(es,"A",{href:!0});var ZE=n(Ei);Pw=i(ZE,"ModelMixin.from_pretrained()"),ZE.forEach(s),jw=i(es," will simply reuse the cache and "),On=l(es,"STRONG",{});var e2=n(On);Sw=i(e2,"not"),e2.forEach(s),xw=i(es," re-download the files."),es.forEach(s),qw=c(xd),ft=l(xd,"LI",{});var oa=n(ft);Mw=i(oa,"Load the cached weights into the "),Nn=l(oa,"EM",{});var t2=n(Nn);Aw=i(t2,"defined"),t2.forEach(s),Cw=i(oa," model class - one of "),Di=l(oa,"A",{href:!0});var s2=n(Di);Iw=i(s2,"the existing model classes"),s2.forEach(s),Lw=i(oa," - and return an instance of the class."),oa.forEach(s),xd.forEach(s),Gf=c(t),ce=l(t,"P",{});var ts=n(ce);Ow=i(ts,"In constrast to "),ki=l(ts,"A",{href:!0});var o2=n(ki);Nw=i(o2,"DiffusionPipeline.from_pretrained()"),o2.forEach(s),Tw=i(ts,", models rely on fewer files that usually don\u2019t require a folder structure, but just a "),Tn=l(ts,"CODE",{});var i2=n(Tn);zw=i(i2,"diffusion_pytorch_model.bin"),i2.forEach(s),Hw=i(ts," and "),zn=l(ts,"CODE",{});var a2=n(zn);Uw=i(a2,"config.json"),a2.forEach(s),Rw=i(ts," file."),ts.forEach(s),Bf=c(t),$i=l(t,"P",{});var l2=n($i);Fw=i(l2,"Let\u2019s look at an example:"),l2.forEach(s),Kf=c(t),u(uo.$$.fragment,t),Wf=c(t),he=l(t,"P",{});var ss=n(he);Gw=i(ss,"Note how we have to define the "),Hn=l(ss,"CODE",{});var n2=n(Hn);Bw=i(n2,'subfolder="unet"'),n2.forEach(s),Kw=i(ss," argument to tell "),Pi=l(ss,"A",{href:!0});var r2=n(Pi);Ww=i(r2,"ModelMixin.from_pretrained()"),r2.forEach(s),Vw=i(ss," that the model weights are located in a "),mo=l(ss,"A",{href:!0,rel:!0});var f2=n(mo);Jw=i(f2,"subfolder of the repository"),f2.forEach(s),Qw=i(ss,"."),ss.forEach(s),Vf=c(t),ze=l(t,"P",{});var ia=n(ze);Xw=i(ia,"As explained in "),ji=l(ia,"A",{href:!0});var d2=n(ji);Yw=i(d2,"Loading customized pipelines"),d2.forEach(s),Zw=i(ia,", one can pass a loaded model to a diffusion pipeline, via "),Si=l(ia,"A",{href:!0});var p2=n(Si);e1=i(p2,"DiffusionPipeline.from_pretrained()"),p2.forEach(s),t1=i(ia,":"),ia.forEach(s),Jf=c(t),u(vo.$$.fragment,t),Qf=c(t),He=l(t,"P",{});var aa=n(He);s1=i(aa,"If the model files can be found directly at the root level, which is usually only the case for some very simple diffusion models, such as "),_o=l(aa,"A",{href:!0,rel:!0});var c2=n(_o);Un=l(c2,"CODE",{});var h2=n(Un);o1=i(h2,"google/ddpm-cifar10-32"),h2.forEach(s),c2.forEach(s),i1=i(aa,`, we don\u2019t
need to pass a `),Rn=l(aa,"CODE",{});var u2=n(Rn);a1=i(u2,"subfolder"),u2.forEach(s),l1=i(aa," argument:"),aa.forEach(s),Xf=c(t),u(wo.$$.fragment,t),Yf=c(t),N=l(t,"P",{});var ve=n(N);n1=i(ve,"As motivated in "),xi=l(ve,"A",{href:!0});var m2=n(xi);r1=i(m2,"How to save and load variants?"),m2.forEach(s),f1=i(ve,`, models can load and
save variants. To load a model variant, one should pass the `),Fn=l(ve,"CODE",{});var v2=n(Fn);d1=i(v2,"variant"),v2.forEach(s),p1=i(ve," function argument to "),qi=l(ve,"A",{href:!0});var _2=n(qi);c1=i(_2,"ModelMixin.from_pretrained()"),_2.forEach(s),h1=i(ve,". Analogous, to save a model variant, one should pass the "),Gn=l(ve,"CODE",{});var w2=n(Gn);u1=i(w2,"variant"),w2.forEach(s),m1=i(ve," function argument to "),Mi=l(ve,"A",{href:!0});var b2=n(Mi);v1=i(b2,"ModelMixin.save_pretrained()"),b2.forEach(s),_1=i(ve,":"),ve.forEach(s),Zf=c(t),u(bo.$$.fragment,t),ed=c(t),dt=l(t,"H2",{class:!0});var qd=n(dt);Kt=l(qd,"A",{id:!0,class:!0,href:!0});var y2=n(Kt);Bn=l(y2,"SPAN",{});var g2=n(Bn);u(yo.$$.fragment,g2),g2.forEach(s),y2.forEach(s),w1=c(qd),Kn=l(qd,"SPAN",{});var E2=n(Kn);b1=i(E2,"Loading schedulers"),E2.forEach(s),qd.forEach(s),td=c(t),ue=l(t,"P",{});var os=n(ue);y1=i(os,"Schedulers rely on "),Ai=l(os,"A",{href:!0});var D2=n(Ai);g1=i(D2,"SchedulerMixin.from_pretrained()"),D2.forEach(s),E1=i(os,". Schedulers are "),Wn=l(os,"STRONG",{});var k2=n(Wn);D1=i(k2,"not parameterized"),k2.forEach(s),k1=i(os," or "),Vn=l(os,"STRONG",{});var $2=n(Vn);$1=i($2,"trained"),$2.forEach(s),P1=i(os,`, but instead purely defined by a configuration file.
For consistency, we use the same method name as we do for models or pipelines, but no weights are loaded in this case.`),os.forEach(s),sd=c(t),Ci=l(t,"P",{});var P2=n(Ci);j1=i(P2,`In constrast to pipelines or models, loading schedulers does not consume any significant amount of memory and the same configuration file can often be used for a variety of different schedulers.
For example, all of:`),P2.forEach(s),od=c(t),I=l(t,"UL",{});var X=n(I);Jn=l(X,"LI",{});var j2=n(Jn);Ii=l(j2,"A",{href:!0});var S2=n(Ii);S1=i(S2,"DDPMScheduler"),S2.forEach(s),j2.forEach(s),x1=c(X),Qn=l(X,"LI",{});var x2=n(Qn);Li=l(x2,"A",{href:!0});var q2=n(Li);q1=i(q2,"DDIMScheduler"),q2.forEach(s),x2.forEach(s),M1=c(X),Xn=l(X,"LI",{});var M2=n(Xn);Oi=l(M2,"A",{href:!0});var A2=n(Oi);A1=i(A2,"PNDMScheduler"),A2.forEach(s),M2.forEach(s),C1=c(X),Yn=l(X,"LI",{});var C2=n(Yn);Ni=l(C2,"A",{href:!0});var I2=n(Ni);I1=i(I2,"LMSDiscreteScheduler"),I2.forEach(s),C2.forEach(s),L1=c(X),Zn=l(X,"LI",{});var L2=n(Zn);Ti=l(L2,"A",{href:!0});var O2=n(Ti);O1=i(O2,"EulerDiscreteScheduler"),O2.forEach(s),L2.forEach(s),N1=c(X),er=l(X,"LI",{});var N2=n(er);zi=l(N2,"A",{href:!0});var T2=n(zi);T1=i(T2,"EulerAncestralDiscreteScheduler"),T2.forEach(s),N2.forEach(s),z1=c(X),tr=l(X,"LI",{});var z2=n(tr);Hi=l(z2,"A",{href:!0});var H2=n(Hi);H1=i(H2,"DPMSolverMultistepScheduler"),H2.forEach(s),z2.forEach(s),X.forEach(s),id=c(t),Wt=l(t,"P",{});var Md=n(Wt);U1=i(Md,"are compatible with "),Ui=l(Md,"A",{href:!0});var U2=n(Ui);R1=i(U2,"StableDiffusionPipeline"),U2.forEach(s),F1=i(Md," and therefore the same scheduler configuration file can be loaded in any of those classes:"),Md.forEach(s),ad=c(t),u(go.$$.fragment,t),this.h()},h(){d(b,"name","hf:doc:metadata"),d(b,"content",JSON.stringify(Y2)),d(O,"id","loading"),d(O,"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(O,"href","#loading"),d(k,"class","relative group"),d(Ze,"href","/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),d(Co,"href","/docs/diffusers/main/en/api/models#diffusers.ModelMixin.from_pretrained"),d(Io,"href","/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin.from_pretrained"),d(mt,"id","loading-pipelines"),d(mt,"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(mt,"href","#loading-pipelines"),d(et,"class","relative group"),d(Lo,"href","/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),d(rs,"href","https://huggingface.co/models?library=diffusers"),d(rs,"rel","nofollow"),d(fs,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5"),d(fs,"rel","nofollow"),d(Oo,"href","/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),d(No,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),d(vt,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.__call__"),d(To,"href","/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),d(zo,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),d(cs,"href","https://huggingface.co/blog/stable_diffusion#how-does-stable-diffusion-work"),d(cs,"rel","nofollow"),d(Ho,"href","./api/overview#diffusers-summary"),d(bt,"id","loading-pipelines-locally"),d(bt,"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(bt,"href","#loading-pipelines-locally"),d(tt,"class","relative group"),d(Ro,"href","/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),d(us,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5"),d(us,"rel","nofollow"),d(ms,"href","https://git-lfs.github.com/"),d(ms,"rel","nofollow"),d(vs,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5/tree/main"),d(vs,"rel","nofollow"),d(Fo,"href","/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),d(yt,"id","loading-customized-pipelines"),d(yt,"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(yt,"href","#loading-customized-pipelines"),d(st,"class","relative group"),d(ys,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5"),d(ys,"rel","nofollow"),d(Go,"href","/docs/diffusers/main/en/api/schedulers/pndm#diffusers.PNDMScheduler"),d(Bo,"href","/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),d(Ko,"href","/docs/diffusers/main/en/api/schedulers/euler#diffusers.EulerDiscreteScheduler"),d(Wo,"href","/docs/diffusers/main/en/api/schedulers/multistep_dpm_solver#diffusers.DPMSolverMultistepScheduler"),d(Qo,"href","/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin.from_pretrained"),d(Es,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5/tree/main/scheduler"),d(Es,"rel","nofollow"),d(Xo,"href","/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),d(Yo,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),d(Ds,"href","https://github.com/huggingface/diffusers/blob/0dd8c6b4dbab4069de9ed1cafb53cbd495873879/src/diffusers/schedulers/scheduling_ddim.py#L112"),d(Ds,"rel","nofollow"),d($s,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5"),d($s,"rel","nofollow"),d(Zo,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),d(ei,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/img2img#diffusers.StableDiffusionImg2ImgPipeline"),d(ti,"href","/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.components"),d(Dt,"id","loading-variants"),d(Dt,"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(Dt,"href","#loading-variants"),d(ot,"class","relative group"),d(kt,"id","lets-first-talk-about-whats-not-checkpoint-variant"),d(kt,"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(kt,"href","#lets-first-talk-about-whats-not-checkpoint-variant"),d(it,"class","relative group"),d(xs,"href","https://huggingface.co/docs/diffusers/main/en/using-diffusers/using_safetensors"),d(xs,"rel","nofollow"),d(qs,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5"),d(qs,"rel","nofollow"),d(Ms,"href","https://huggingface.co/stabilityai/stable-diffusion-2"),d(Ms,"rel","nofollow"),d(As,"href","https://huggingface.co/CompVis/stable-diffusion-v1-4"),d(As,"rel","nofollow"),d(Cs,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5"),d(Cs,"rel","nofollow"),d($t,"id","so-what-are-checkpoint-variants-then"),d($t,"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($t,"href","#so-what-are-checkpoint-variants-then"),d(at,"class","relative group"),d(Ls,"href","https://pytorch.org/blog/accelerating-training-on-nvidia-gpus-with-pytorch-automatic-mixed-precision/"),d(Ls,"rel","nofollow"),d(Pt,"id","how-to-save-and-load-variants"),d(Pt,"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(Pt,"href","#how-to-save-and-load-variants"),d(lt,"class","relative group"),d(oi,"href","/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.save_pretrained"),d(ii,"href","/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),d(Gs,"href","https://huggingface.co/diffusers/stable-diffusion-variants"),d(Gs,"rel","nofollow"),d(Bs,"href","https://huggingface.co/diffusers/stable-diffusion-variants/tree/main"),d(Bs,"rel","nofollow"),d(Js,"href","https://huggingface.co/diffusers/stable-diffusion-variants/blob/main/unet/diffusion_pytorch_model.non_ema.bin"),d(Js,"rel","nofollow"),d(Mt,"id","how-does-loading-work"),d(Mt,"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(Mt,"href","#how-does-loading-work"),d(nt,"class","relative group"),d(pi,"href","/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),d(ci,"href","/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),d(hi,"href","./api/overview#diffusers-summary"),d(ui,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),d(Zs,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5"),d(Zs,"rel","nofollow"),d(mi,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),d(It,"href","https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPFeatureExtractor"),d(It,"rel","nofollow"),d(oo,"href","https://github.com/huggingface/diffusers/blob/e55687e1e15407f60f32242027b7bb8170e58266/src/diffusers/pipelines/stable_diffusion/safety_checker.py#L32"),d(oo,"rel","nofollow"),d(vi,"href","/docs/diffusers/main/en/api/schedulers/pndm#diffusers.PNDMScheduler"),d(Nt,"href","https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPTextModel"),d(Nt,"rel","nofollow"),d(Tt,"href","https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizer"),d(Tt,"rel","nofollow"),d(_i,"href","/docs/diffusers/main/en/api/models#diffusers.UNet2DConditionModel"),d(wi,"href","/docs/diffusers/main/en/api/models#diffusers.AutoencoderKL"),d(io,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5/tree/main"),d(io,"rel","nofollow"),d(ro,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5/tree/main/bert"),d(ro,"rel","nofollow"),d(fo,"href","https://github.com/huggingface/diffusers/blob/cd502b25cf0debac6f98d27a6638ef95208d1ea2/src/diffusers/pipelines/latent_diffusion/pipeline_latent_diffusion.py#L42"),d(fo,"rel","nofollow"),d(po,"href","https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizer"),d(po,"rel","nofollow"),d(bi,"href","/docs/diffusers/main/en/api/models#diffusers.UNet2DConditionModel"),d(Gt,"id","loading-models"),d(Gt,"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(Gt,"href","#loading-models"),d(rt,"class","relative group"),d(ho,"href","https://github.com/huggingface/diffusers/tree/main/src/diffusers/models"),d(ho,"rel","nofollow"),d(yi,"href","/docs/diffusers/main/en/api/models#diffusers.ModelMixin.from_pretrained"),d(gi,"href","/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),d(Ei,"href","/docs/diffusers/main/en/api/models#diffusers.ModelMixin.from_pretrained"),d(Di,"href","./api/models"),d(ki,"href","/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),d(Pi,"href","/docs/diffusers/main/en/api/models#diffusers.ModelMixin.from_pretrained"),d(mo,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5/tree/main/unet"),d(mo,"rel","nofollow"),d(ji,"href","%22./using-diffusers/loading#loading-customized-pipelines%22"),d(Si,"href","/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),d(_o,"href","https://huggingface.co/google/ddpm-cifar10-32"),d(_o,"rel","nofollow"),d(xi,"href","#how-to-save-and-load-variants"),d(qi,"href","/docs/diffusers/main/en/api/models#diffusers.ModelMixin.from_pretrained"),d(Mi,"href","/docs/diffusers/main/en/api/models#diffusers.ModelMixin.save_pretrained"),d(Kt,"id","loading-schedulers"),d(Kt,"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(Kt,"href","#loading-schedulers"),d(dt,"class","relative group"),d(Ai,"href","/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin.from_pretrained"),d(Ii,"href","/docs/diffusers/main/en/api/schedulers/ddpm#diffusers.DDPMScheduler"),d(Li,"href","/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler"),d(Oi,"href","/docs/diffusers/main/en/api/schedulers/pndm#diffusers.PNDMScheduler"),d(Ni,"href","/docs/diffusers/main/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler"),d(Ti,"href","/docs/diffusers/main/en/api/schedulers/euler#diffusers.EulerDiscreteScheduler"),d(zi,"href","/docs/diffusers/main/en/api/schedulers/euler_ancestral#diffusers.EulerAncestralDiscreteScheduler"),d(Hi,"href","/docs/diffusers/main/en/api/schedulers/multistep_dpm_solver#diffusers.DPMSolverMultistepScheduler"),d(Ui,"href","/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline")},m(t,r){e(document.head,b),f(t,te,r),f(t,k,r),e(k,O),e(O,Y),m(S,Y,null),e(k,U),e(k,se),e(se,Je),f(t,ct,r),f(t,oe,r),e(oe,Qe),e(oe,Xe),e(Xe,is),e(oe,Ye),f(t,ht,r),f(t,ye,r),e(ye,ut),f(t,ie,r),f(t,T,r),e(T,$),e($,P),e(P,xo),e($,qo),e($,Ze),e(Ze,Mo),e(T,Ao),e(T,as),e(as,la),e(la,Ad),e(as,Cd),e(as,Co),e(Co,Id),e(T,Ld),e(T,ls),e(ls,na),e(na,Od),e(ls,Nd),e(ls,Io),e(Io,Td),f(t,dr,r),f(t,et,r),e(et,mt),e(mt,ra),m(ns,ra,null),e(et,zd),e(et,fa),e(fa,Hd),f(t,pr,r),f(t,ae,r),e(ae,Ud),e(ae,Lo),e(Lo,Rd),e(ae,Fd),e(ae,rs),e(rs,Gd),e(ae,Bd),e(ae,fs),e(fs,Kd),e(ae,Wd),f(t,cr,r),m(ds,t,r),f(t,hr,r),f(t,q,r),e(q,Vd),e(q,Oo),e(Oo,Jd),e(q,Qd),e(q,da),e(da,Xd),e(q,Yd),e(q,No),e(No,Zd),e(q,ep),e(q,pa),e(pa,tp),e(q,sp),e(q,vt),e(vt,op),e(vt,ca),e(ca,ip),e(vt,ap),e(q,lp),e(q,ha),e(ha,np),e(q,rp),f(t,ur,r),f(t,_t,r),e(_t,fp),e(_t,To),e(To,dp),e(_t,pp),f(t,mr,r),m(ps,t,r),f(t,vr,r),m(wt,t,r),f(t,_r,r),f(t,E,r),e(E,cp),e(E,ua),e(ua,hp),e(E,up),e(E,ma),e(ma,mp),e(E,vp),e(E,va),e(va,_p),e(E,wp),e(E,_a),e(_a,bp),e(E,yp),e(E,wa),e(wa,gp),e(E,Ep),e(E,ba),e(ba,Dp),e(E,kp),e(E,zo),e(zo,$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(Se,As),e(As,Nh),e(Se,Th),e(Se,Cs),e(Cs,zh),e(Se,Hh),f(t,Br,r),f(t,at,r),e(at,$t),e($t,Ya),m(Is,Ya,null),e(at,Uh),e(at,Za),e(Za,Rh),f(t,Kr,r),f(t,A,r),e(A,Fh),e(A,el),e(el,Gh),e(A,Bh),e(A,tl),e(tl,Kh),e(A,Wh),e(A,Ls),e(Ls,Vh),e(A,Jh),e(A,sl),e(sl,Qh),e(A,Xh),e(A,ol),e(ol,Yh),e(A,Zh),e(A,il),e(il,eu),e(A,tu),f(t,Wr,r),f(t,lt,r),e(lt,Pt),e(Pt,al),m(Os,al,null),e(lt,su),e(lt,ll),e(ll,ou),f(t,Vr,r),f(t,j,r),e(j,iu),e(j,oi),e(oi,au),e(j,lu),e(j,nl),e(nl,nu),e(j,ru),e(j,rl),e(rl,fu),e(j,du),e(j,fl),e(fl,pu),e(j,cu),e(j,dl),e(dl,hu),e(j,uu),e(j,pl),e(pl,mu),e(j,vu),e(j,cl),e(cl,_u),e(j,wu),e(j,hl),e(hl,bu),e(j,yu),f(t,Jr,r),f(t,xe,r),e(xe,gu),e(xe,ul),e(ul,Eu),e(xe,Du),e(xe,ml),e(ml,ku),e(xe,$u),f(t,Qr,r),m(Ns,t,r),f(t,Xr,r),f(t,jt,r),e(jt,Pu),e(jt,vl),e(vl,ju),e(jt,Su),f(t,Yr,r),m(Ts,t,r),f(t,Zr,r),f(t,St,r),e(St,xu),e(St,_l),e(_l,qu),e(St,Mu),f(t,ef,r),m(zs,t,r),f(t,tf,r),f(t,B,r),e(B,Au),e(B,wl),e(wl,Cu),e(B,Iu),e(B,bl),e(bl,Lu),e(B,Ou),e(B,yl),e(yl,Nu),e(B,Tu),e(B,ii),e(ii,zu),e(B,Hu),f(t,sf,r),m(Hs,t,r),f(t,of,r),f(t,ai,r),e(ai,Uu),f(t,af,r),m(Us,t,r),f(t,lf,r),f(t,li,r),e(li,Ru),f(t,nf,r),m(Rs,t,r),f(t,rf,r),f(t,ni,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t_),e(g,an),e(an,s_),e(g,o_),e(g,ln),e(ln,i_),e(g,a_),e(g,nn),e(nn,l_),e(g,n_),e(g,rn),e(rn,r_),e(g,f_),e(g,fn),e(fn,d_),e(g,p_),e(g,dn),e(dn,c_),e(g,h_),e(g,pn),e(pn,u_),e(g,m_),e(g,cn),e(cn,v_),e(g,__),e(g,hn),e(hn,w_),e(g,b_),e(g,un),e(un,y_),e(g,g_),f(t,Lf,r),f(t,Ut,r),e(Ut,mn),e(mn,E_),e(Ut,D_),e(Ut,vn),e(vn,k_),f(t,Of,r),f(t,Le,r),e(Le,$_),e(Le,_n),e(_n,P_),e(Le,j_),e(Le,wn),e(wn,S_),e(Le,x_),f(t,Nf,r),m(lo,t,r),f(t,Tf,r),f(t,Oe,r),e(Oe,Rt),e(Rt,bn),e(bn,q_),e(Rt,M_),e(Rt,yn),e(yn,A_),e(Rt,C_),e(Oe,I_),e(Oe,Ft),e(Ft,gn),e(gn,L_),e(Ft,O_),e(Ft,En),e(En,N_),e(Ft,T_),e(Oe,z_),e(Oe,Dn),e(Dn,H_),f(t,zf,r),m(no,t,r),f(t,Hf,r),f(t,Ne,r),e(Ne,Te),e(Te,U_),e(Te,kn),e(kn,R_),e(Te,F_),e(Te,ro),e(ro,G_),e(Te,B_),e(Te,fo),e(fo,K_),e(Ne,W_),e(Ne,z),e(z,V_),e(z,$n),e($n,J_),e(z,Q_),e(z,Pn),e(Pn,X_),e(z,Y_),e(z,jn),e(jn,Z_),e(z,ew),e(z,Sn),e(Sn,tw),e(z,sw),e(z,xn),e(xn,ow),e(z,iw),e(Ne,aw),e(Ne,de),e(de,lw),e(de,qn),e(qn,nw),e(de,rw),e(de,Mn),e(Mn,fw),e(de,dw),e(de,po),e(po,An),e(An,pw),e(de,cw),e(de,bi),e(bi,hw),f(t,Uf,r),f(t,rt,r),e(rt,Gt),e(Gt,Cn),m(co,Cn,null),e(rt,uw),e(rt,In),e(In,mw),f(t,Rf,r),f(t,pe,r),e(pe,vw),e(pe,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),e(Vn,$1),e(ue,P1),f(t,sd,r),f(t,Ci,r),e(Ci,j1),f(t,od,r),f(t,I,r),e(I,Jn),e(Jn,Ii),e(Ii,S1),e(I,x1),e(I,Qn),e(Qn,Li),e(Li,q1),e(I,M1),e(I,Xn),e(Xn,Oi),e(Oi,A1),e(I,C1),e(I,Yn),e(Yn,Ni),e(Ni,I1),e(I,L1),e(I,Zn),e(Zn,Ti),e(Ti,O1),e(I,N1),e(I,er),e(er,zi),e(zi,T1),e(I,z1),e(I,tr),e(tr,Hi),e(Hi,H1),f(t,id,r),f(t,Wt,r),e(Wt,U1),e(Wt,Ui),e(Ui,R1),e(Wt,F1),f(t,ad,r),m(go,t,r),ld=!0},p(t,[r]){const Eo={};r&2&&(Eo.$$scope={dirty:r,ctx:t}),wt.$set(Eo);const sr={};r&2&&(sr.$$scope={dirty:r,ctx:t}),xt.$set(sr)},i(t){ld||(v(S.$$.fragment,t),v(ns.$$.fragment,t),v(ds.$$.fragment,t),v(ps.$$.fragment,t),v(wt.$$.fragment,t),v(hs.$$.fragment,t),v(_s.$$.fragment,t),v(ws.$$.fragment,t),v(bs.$$.fragment,t),v(gs.$$.fragment,t),v(ks.$$.fragment,t),v(Ps.$$.fragment,t),v(js.$$.fragment,t),v(Ss.$$.fragment,t),v(Is.$$.fragment,t),v(Os.$$.fragment,t),v(Ns.$$.fragment,t),v(Ts.$$.fragment,t),v(zs.$$.fragment,t),v(Hs.$$.fragment,t),v(Us.$$.fragment,t),v(Rs.$$.fragment,t),v(Fs.$$.fragment,t),v(Ks.$$.fragment,t),v(Ws.$$.fragment,t),v(Vs.$$.fragment,t),v(xt.$$.fragment,t),v(Qs.$$.fragment,t),v(Xs.$$.fragment,t),v(Ys.$$.fragment,t),v(eo.$$.fragment,t),v(so.$$.fragment,t),v(ao.$$.fragment,t),v(lo.$$.fragment,t),v(no.$$.fragment,t),v(co.$$.fragment,t),v(uo.$$.fragment,t),v(vo.$$.fragment,t),v(wo.$$.fragment,t),v(bo.$$.fragment,t),v(yo.$$.fragment,t),v(go.$$.fragment,t),ld=!0)},o(t){_(S.$$.fragment,t),_(ns.$$.fragment,t),_(ds.$$.fragment,t),_(ps.$$.fragment,t),_(wt.$$.fragment,t),_(hs.$$.fragment,t),_(_s.$$.fragment,t),_(ws.$$.fragment,t),_(bs.$$.fragment,t),_(gs.$$.fragment,t),_(ks.$$.fragment,t),_(Ps.$$.fragment,t),_(js.$$.fragment,t),_(Ss.$$.fragment,t),_(Is.$$.fragment,t),_(Os.$$.fragment,t),_(Ns.$$.fragment,t),_(Ts.$$.fragment,t),_(zs.$$.fragment,t),_(Hs.$$.fragment,t),_(Us.$$.fragment,t),_(Rs.$$.fragment,t),_(Fs.$$.fragment,t),_(Ks.$$.fragment,t),_(Ws.$$.fragment,t),_(Vs.$$.fragment,t),_(xt.$$.fragment,t),_(Qs.$$.fragment,t),_(Xs.$$.fragment,t),_(Ys.$$.fragment,t),_(eo.$$.fragment,t),_(so.$$.fragment,t),_(ao.$$.fragment,t),_(lo.$$.fragment,t),_(no.$$.fragment,t),_(co.$$.fragment,t),_(uo.$$.fragment,t),_(vo.$$.fragment,t),_(wo.$$.fragment,t),_(bo.$$.fragment,t),_(yo.$$.fragment,t),_(go.$$.fragment,t),ld=!1},d(t){s(b),t&&s(te),t&&s(k),w(S),t&&s(ct),t&&s(oe),t&&s(ht),t&&s(ye),t&&s(ie),t&&s(T),t&&s(dr),t&&s(et),w(ns),t&&s(pr),t&&s(ae),t&&s(cr),w(ds,t),t&&s(hr),t&&s(q),t&&s(ur),t&&s(_t),t&&s(mr),w(ps,t),t&&s(vr),w(wt,t),t&&s(_r),t&&s(E),t&&s(wr),t&&s(tt),w(hs),t&&s(br),t&&s(Uo),t&&s(yr),t&&s(ge),t&&s(gr),t&&s(Ee),t&&s(Er),w(_s,t),t&&s(Dr),t&&s(De),t&&s(kr),w(ws,t),t&&s($r),t&&s(ke),t&&s(Pr),t&&s(st),w(bs),t&&s(jr),t&&s(R),t&&s(Sr),t&&s(_e),t&&s(xr),w(gs,t),t&&s(qr),t&&s(Vo),t&&s(Mr),t&&s($e),t&&s(Ar),t&&s(le),t&&s(Cr),t&&s(Pe),t&&s(Ir),w(ks,t),t&&s(Lr),t&&s(F),t&&s(Or),w(Ps,t),t&&s(Nr),t&&s(Et),t&&s(Tr),t&&s(ot),w(js),t&&s(zr),t&&s(ne),t&&s(Hr),t&&s(si),t&&s(Ur),t&&s(it),w(Ss),t&&s(Rr),t&&s(je),t&&s(Fr),t&&s(G),t&&s(Gr),t&&s(Se),t&&s(Br),t&&s(at),w(Is),t&&s(Kr),t&&s(A),t&&s(Wr),t&&s(lt),w(Os),t&&s(Vr),t&&s(j),t&&s(Jr),t&&s(xe),t&&s(Qr),w(Ns,t),t&&s(Xr),t&&s(jt),t&&s(Yr),w(Ts,t),t&&s(Zr),t&&s(St),t&&s(ef),w(zs,t),t&&s(tf),t&&s(B),t&&s(sf),w(Hs,t),t&&s(of),t&&s(ai),t&&s(af),w(Us,t),t&&s(lf),t&&s(li),t&&s(nf),w(Rs,t),t&&s(rf),t&&s(ni),t&&s(ff),w(Fs,t),t&&s(df),t&&s(qe),t&&s(pf),w(Ks,t),t&&s(cf),t&&s(ri),t&&s(hf),w(Ws,t),t&&s(uf),t&&s(fi),t&&s(mf),w(Vs,t),t&&s(vf),t&&s(di),t&&s(_f),w(xt,t),t&&s(wf),t&&s(K),t&&s(bf),w(Qs,t),t&&s(yf),t&&s(qt),t&&s(gf),w(Xs,t),t&&s(Ef),t&&s(re),t&&s(Df),t&&s(nt),w(Ys),t&&s(kf),t&&s(At),t&&s($f),t&&s(Ct),t&&s(Pf),t&&s(W),t&&s(jf),w(eo,t),t&&s(Sf),t&&s(to),t&&s(xf),w(so,t),t&&s(qf),t&&s(Me),t&&s(Mf),t&&s(C),t&&s(Af),t&&s(fe),t&&s(Cf),w(ao,t),t&&s(If),t&&s(g),t&&s(Lf),t&&s(Ut),t&&s(Of),t&&s(Le),t&&s(Nf),w(lo,t),t&&s(Tf),t&&s(Oe),t&&s(zf),w(no,t),t&&s(Hf),t&&s(Ne),t&&s(Uf),t&&s(rt),w(co),t&&s(Rf),t&&s(pe),t&&s(Ff),t&&s(Bt),t&&s(Gf),t&&s(ce),t&&s(Bf),t&&s($i),t&&s(Kf),w(uo,t),t&&s(Wf),t&&s(he),t&&s(Vf),t&&s(ze),t&&s(Jf),w(vo,t),t&&s(Qf),t&&s(He),t&&s(Xf),w(wo,t),t&&s(Yf),t&&s(N),t&&s(Zf),w(bo,t),t&&s(ed),t&&s(dt),w(yo),t&&s(td),t&&s(ue),t&&s(sd),t&&s(Ci),t&&s(od),t&&s(I),t&&s(id),t&&s(Wt),t&&s(ad),w(go,t)}}}const Y2={local:"loading-pipelines-that-require-access-request",sections:[{local:null,sections:[{local:"loading-pipelines-locally",title:"Loading pipelines locally"},{local:"loading-customized-pipelines",title:"Loading customized pipelines"},{local:"loading-variants",sections:[{local:"lets-first-talk-about-whats-not-checkpoint-variant",title:"Let's first talk about whats **not** checkpoint variant,"},{local:"so-what-are-checkpoint-variants-then",title:"So what are checkpoint variants then? "},{local:"how-to-save-and-load-variants",title:"How to save and load variants"}],title:"Loading variants"},{local:"how-does-loading-work",sections:[{local:"using-revision-to-load-pipeline-variants-is-deprecated",title:"Using `revision` to load pipeline variants is deprecated"}],title:"How does loading work?"}],title:null},{local:"loading-models",title:"Loading models"},{local:"loading-schedulers",title:"Loading schedulers"}],title:"Loading pipelines that require access request"};function Z2(So){return W2(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class i5 extends F2{constructor(b){super();G2(this,b,Z2,X2,B2,{})}}export{i5 as default,Y2 as metadata};
