import{S as $o,i as wo,s as Mo,e as o,k as f,w as $,t as a,M as jo,c as i,d as t,m,a as r,x as w,h as l,b as h,G as e,g as U,y as M,q as j,o as Z,B as E,v as Zo,L as Ht}from"../../chunks/vendor-hf-doc-builder.js";import{T as zt}from"../../chunks/Tip-hf-doc-builder.js";import{D as V}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Qt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as vo}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Lt}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Eo(D){let p,_,d,c,b,s,u,P,T,x,G;return{c(){p=o("p"),_=a("You shouldn\u2019t use the "),d=o("a"),c=a("DiffusionPipeline"),b=a(` class for training or finetuning a diffusion model. Individual
components (for example, `),s=o("a"),u=a("UNet2DModel"),P=a(" and "),T=o("a"),x=a("UNet2DConditionModel"),G=a(") of diffusion pipelines are usually trained individually, so we suggest directly working with them instead."),this.h()},l(J){p=i(J,"P",{});var W=r(p);_=l(W,"You shouldn\u2019t use the "),d=i(W,"A",{href:!0});var Be=r(d);c=l(Be,"DiffusionPipeline"),Be.forEach(t),b=l(W,` class for training or finetuning a diffusion model. Individual
components (for example, `),s=i(W,"A",{href:!0});var Ne=r(s);u=l(Ne,"UNet2DModel"),Ne.forEach(t),P=l(W," and "),T=i(W,"A",{href:!0});var R=r(T);x=l(R,"UNet2DConditionModel"),R.forEach(t),G=l(W,") of diffusion pipelines are usually trained individually, so we suggest directly working with them instead."),W.forEach(t),this.h()},h(){h(d,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),h(s,"href","/docs/diffusers/v0.18.0/en/api/models/unet2d#diffusers.UNet2DModel"),h(T,"href","/docs/diffusers/v0.18.0/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel")},m(J,W){U(J,p,W),e(p,_),e(p,d),e(d,c),e(p,b),e(p,s),e(s,u),e(p,P),e(p,T),e(T,x),e(p,G)},d(J){J&&t(p)}}}function xo(D){let p,_,d,c,b;return c=new Qt({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMCglMEElMjAlMjAlMjAlMjBTdGFibGVEaWZmdXNpb25QaXBlbGluZSUyQyUwQSUyMCUyMCUyMCUyMFN0YWJsZURpZmZ1c2lvbkltZzJJbWdQaXBlbGluZSUyQyUwQSUyMCUyMCUyMCUyMFN0YWJsZURpZmZ1c2lvbklucGFpbnRQaXBlbGluZSUyQyUwQSklMEElMEF0ZXh0MmltZyUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMiklMEFpbWcyaW1nJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uSW1nMkltZ1BpcGVsaW5lKCoqdGV4dDJpbWcuY29tcG9uZW50cyklMEFpbnBhaW50JTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uSW5wYWludFBpcGVsaW5lKCoqdGV4dDJpbWcuY29tcG9uZW50cyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> (
<span class="hljs-meta">... </span>    StableDiffusionPipeline,
<span class="hljs-meta">... </span>    StableDiffusionImg2ImgPipeline,
<span class="hljs-meta">... </span>    StableDiffusionInpaintPipeline,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>text2img = StableDiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>img2img = StableDiffusionImg2ImgPipeline(**text2img.components)
<span class="hljs-meta">&gt;&gt;&gt; </span>inpaint = StableDiffusionInpaintPipeline(**text2img.components)`}}),{c(){p=o("p"),_=a("Examples:"),d=f(),$(c.$$.fragment)},l(s){p=i(s,"P",{});var u=r(p);_=l(u,"Examples:"),u.forEach(t),d=m(s),w(c.$$.fragment,s)},m(s,u){U(s,p,u),e(p,_),U(s,d,u),M(c,s,u),b=!0},p:Ht,i(s){b||(j(c.$$.fragment,s),b=!0)},o(s){Z(c.$$.fragment,s),b=!1},d(s){s&&t(p),s&&t(d),E(c,s)}}}function Uo(D){let p,_,d,c,b,s,u,P;return{c(){p=o("p"),_=a("To use private or "),d=o("a"),c=a("gated models"),b=a(`, log-in with
`),s=o("code"),u=a("huggingface-cli login"),P=a("."),this.h()},l(T){p=i(T,"P",{});var x=r(p);_=l(x,"To use private or "),d=i(x,"A",{href:!0,rel:!0});var G=r(d);c=l(G,"gated models"),G.forEach(t),b=l(x,`, log-in with
`),s=i(x,"CODE",{});var J=r(s);u=l(J,"huggingface-cli login"),J.forEach(t),P=l(x,"."),x.forEach(t),this.h()},h(){h(d,"href","https://huggingface.co/docs/hub/models-gated#gated-models"),h(d,"rel","nofollow")},m(T,x){U(T,p,x),e(p,_),e(p,d),e(d,c),e(p,b),e(p,s),e(s,u),e(p,P)},d(T){T&&t(p)}}}function To(D){let p,_;return{c(){p=o("p"),_=a(`\u26A0\uFE0F When memory efficient attention and sliced attention are both enabled, memory efficient attention takes
precedent.`)},l(d){p=i(d,"P",{});var c=r(p);_=l(c,`\u26A0\uFE0F When memory efficient attention and sliced attention are both enabled, memory efficient attention takes
precedent.`),c.forEach(t)},m(d,c){U(d,p,c),e(p,_)},d(d){d&&t(p)}}}function Go(D){let p,_,d,c,b;return c=new Qt({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEFmcm9tJTIweGZvcm1lcnMub3BzJTIwaW1wb3J0JTIwTWVtb3J5RWZmaWNpZW50QXR0ZW50aW9uRmxhc2hBdHRlbnRpb25PcCUwQSUwQXBpcGUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLTItMSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlJTIwJTNEJTIwcGlwZS50byglMjJjdWRhJTIyKSUwQXBpcGUuZW5hYmxlX3hmb3JtZXJzX21lbW9yeV9lZmZpY2llbnRfYXR0ZW50aW9uKGF0dGVudGlvbl9vcCUzRE1lbW9yeUVmZmljaWVudEF0dGVudGlvbkZsYXNoQXR0ZW50aW9uT3ApJTBBJTIzJTIwV29ya2Fyb3VuZCUyMGZvciUyMG5vdCUyMGFjY2VwdGluZyUyMGF0dGVudGlvbiUyMHNoYXBlJTIwdXNpbmclMjBWQUUlMjBmb3IlMjBGbGFzaCUyMEF0dGVudGlvbiUwQXBpcGUudmFlLmVuYWJsZV94Zm9ybWVyc19tZW1vcnlfZWZmaWNpZW50X2F0dGVudGlvbihhdHRlbnRpb25fb3AlM0ROb25lKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> xformers.ops <span class="hljs-keyword">import</span> MemoryEfficientAttentionFlashAttentionOp

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;stabilityai/stable-diffusion-2-1&quot;</span>, torch_dtype=torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.enable_xformers_memory_efficient_attention(attention_op=MemoryEfficientAttentionFlashAttentionOp)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Workaround for not accepting attention shape using VAE for Flash Attention</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.vae.enable_xformers_memory_efficient_attention(attention_op=<span class="hljs-literal">None</span>)`}}),{c(){p=o("p"),_=a("Examples:"),d=f(),$(c.$$.fragment)},l(s){p=i(s,"P",{});var u=r(p);_=l(u,"Examples:"),u.forEach(t),d=m(s),w(c.$$.fragment,s)},m(s,u){U(s,p,u),e(p,_),U(s,d,u),M(c,s,u),b=!0},p:Ht,i(s){b||(j(c.$$.fragment,s),b=!0)},o(s){Z(c.$$.fragment,s),b=!1},d(s){s&&t(p),s&&t(d),E(c,s)}}}function Do(D){let p,_,d,c,b;return c=new Qt({props:{code:"U29tZSUyMHdlaWdodHMlMjBvZiUyMFVOZXQyRENvbmRpdGlvbk1vZGVsJTIwd2VyZSUyMG5vdCUyMGluaXRpYWxpemVkJTIwZnJvbSUyMHRoZSUyMG1vZGVsJTIwY2hlY2twb2ludCUyMGF0JTIwcnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjBhbmQlMjBhcmUlMjBuZXdseSUyMGluaXRpYWxpemVkJTIwYmVjYXVzZSUyMHRoZSUyMHNoYXBlcyUyMGRpZCUyMG5vdCUyMG1hdGNoJTNBJTBBLSUyMGNvbnZfaW4ud2VpZ2h0JTNBJTIwZm91bmQlMjBzaGFwZSUyMHRvcmNoLlNpemUoJTVCMzIwJTJDJTIwNCUyQyUyMDMlMkMlMjAzJTVEKSUyMGluJTIwdGhlJTIwY2hlY2twb2ludCUyMGFuZCUyMHRvcmNoLlNpemUoJTVCMzIwJTJDJTIwOSUyQyUyMDMlMkMlMjAzJTVEKSUyMGluJTIwdGhlJTIwbW9kZWwlMjBpbnN0YW50aWF0ZWQlMEFZb3UlMjBzaG91bGQlMjBwcm9iYWJseSUyMFRSQUlOJTIwdGhpcyUyMG1vZGVsJTIwb24lMjBhJTIwZG93bi1zdHJlYW0lMjB0YXNrJTIwdG8lMjBiZSUyMGFibGUlMjB0byUyMHVzZSUyMGl0JTIwZm9yJTIwcHJlZGljdGlvbnMlMjBhbmQlMjBpbmZlcmVuY2Uu",highlighted:`<span class="hljs-comment">Some</span> <span class="hljs-comment">weights</span> <span class="hljs-comment">of</span> <span class="hljs-comment">UNet2DConditionModel were not initialized from the model checkpoint at</span> <span class="hljs-comment">runwayml/stable</span><span class="hljs-literal">-</span><span class="hljs-comment">diffusion</span><span class="hljs-literal">-</span><span class="hljs-comment">v1</span><span class="hljs-literal">-</span><span class="hljs-comment">5 and are newly initialized because the shapes did</span> <span class="hljs-comment">not</span> <span class="hljs-comment">match:</span>
<span class="hljs-literal">-</span> <span class="hljs-comment">conv_in</span><span class="hljs-string">.</span><span class="hljs-comment">weight:</span> <span class="hljs-comment">found</span> <span class="hljs-comment">shape</span> <span class="hljs-comment">torch</span><span class="hljs-string">.</span><span class="hljs-comment">Size(</span><span class="hljs-title">[</span><span class="hljs-comment">320</span><span class="hljs-string">,</span> <span class="hljs-comment">4</span><span class="hljs-string">,</span> <span class="hljs-comment">3</span><span class="hljs-string">,</span> <span class="hljs-comment">3</span><span class="hljs-title">]</span><span class="hljs-comment">) in the checkpoint and</span> <span class="hljs-comment">torch</span><span class="hljs-string">.</span><span class="hljs-comment">Size(</span><span class="hljs-title">[</span><span class="hljs-comment">320</span><span class="hljs-string">,</span> <span class="hljs-comment">9</span><span class="hljs-string">,</span> <span class="hljs-comment">3</span><span class="hljs-string">,</span> <span class="hljs-comment">3</span><span class="hljs-title">]</span><span class="hljs-comment">) in the model instantiated</span>
<span class="hljs-comment">You</span> <span class="hljs-comment">should</span> <span class="hljs-comment">probably</span> <span class="hljs-comment">TRAIN this model on a down-stream task to be able to use it for predictions and inference</span><span class="hljs-string">.</span>`}}),{c(){p=o("p"),_=a("If you get the error message below, you need to finetune the weights for your downstream task:"),d=f(),$(c.$$.fragment)},l(s){p=i(s,"P",{});var u=r(p);_=l(u,"If you get the error message below, you need to finetune the weights for your downstream task:"),u.forEach(t),d=m(s),w(c.$$.fragment,s)},m(s,u){U(s,p,u),e(p,_),U(s,d,u),M(c,s,u),b=!0},p:Ht,i(s){b||(j(c.$$.fragment,s),b=!0)},o(s){Z(c.$$.fragment,s),b=!1},d(s){s&&t(p),s&&t(d),E(c,s)}}}function Po(D){let p,_,d,c,b,s,u,P;return{c(){p=o("p"),_=a("To use private or "),d=o("a"),c=a("gated"),b=a(` models, log-in with
`),s=o("code"),u=a("huggingface-cli login"),P=a("."),this.h()},l(T){p=i(T,"P",{});var x=r(p);_=l(x,"To use private or "),d=i(x,"A",{href:!0,rel:!0});var G=r(d);c=l(G,"gated"),G.forEach(t),b=l(x,` models, log-in with
`),s=i(x,"CODE",{});var J=r(s);u=l(J,"huggingface-cli login"),J.forEach(t),P=l(x,"."),x.forEach(t),this.h()},h(){h(d,"href","https://huggingface.co/docs/hub/models-gated#gated-models"),h(d,"rel","nofollow")},m(T,x){U(T,p,x),e(p,_),e(p,d),e(d,c),e(p,b),e(p,s),e(s,u),e(p,P)},d(T){T&&t(p)}}}function Wo(D){let p,_,d,c,b;return c=new Qt({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBJTIzJTIwRG93bmxvYWQlMjBwaXBlbGluZSUyMGZyb20lMjBodWdnaW5nZmFjZS5jbyUyMGFuZCUyMGNhY2hlLiUwQXBpcGVsaW5lJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMkNvbXBWaXMlMkZsZG0tdGV4dDJpbS1sYXJnZS0yNTYlMjIpJTBBJTBBJTIzJTIwRG93bmxvYWQlMjBwaXBlbGluZSUyMHRoYXQlMjByZXF1aXJlcyUyMGFuJTIwYXV0aG9yaXphdGlvbiUyMHRva2VuJTBBJTIzJTIwRm9yJTIwbW9yZSUyMGluZm9ybWF0aW9uJTIwb24lMjBhY2Nlc3MlMjB0b2tlbnMlMkMlMjBwbGVhc2UlMjByZWZlciUyMHRvJTIwdGhpcyUyMHNlY3Rpb24lMEElMjMlMjBvZiUyMHRoZSUyMGRvY3VtZW50YXRpb24lNUQoaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRvY3MlMkZodWIlMkZzZWN1cml0eS10b2tlbnMpJTBBcGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLXYxLTUlMjIpJTBBJTBBJTIzJTIwVXNlJTIwYSUyMGRpZmZlcmVudCUyMHNjaGVkdWxlciUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBMTVNEaXNjcmV0ZVNjaGVkdWxlciUwQSUwQXNjaGVkdWxlciUyMCUzRCUyMExNU0Rpc2NyZXRlU2NoZWR1bGVyLmZyb21fY29uZmlnKHBpcGVsaW5lLnNjaGVkdWxlci5jb25maWcpJTBBcGlwZWxpbmUuc2NoZWR1bGVyJTIwJTNEJTIwc2NoZWR1bGVy",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Download pipeline from huggingface.co and cache.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;CompVis/ldm-text2im-large-256&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Download pipeline that requires an authorization token</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># For more information on access tokens, please refer to this section</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># of the documentation](https://huggingface.co/docs/hub/security-tokens)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Use a different scheduler</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> LMSDiscreteScheduler

<span class="hljs-meta">&gt;&gt;&gt; </span>scheduler = LMSDiscreteScheduler.from_config(pipeline.scheduler.config)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline.scheduler = scheduler`}}),{c(){p=o("p"),_=a("Examples:"),d=f(),$(c.$$.fragment)},l(s){p=i(s,"P",{});var u=r(p);_=l(u,"Examples:"),u.forEach(t),d=m(s),w(c.$$.fragment,s)},m(s,u){U(s,p,u),e(p,_),U(s,d,u),M(c,s,u),b=!0},p:Ht,i(s){b||(j(c.$$.fragment,s),b=!0)},o(s){Z(c.$$.fragment,s),b=!1},d(s){s&&t(p),s&&t(d),E(c,s)}}}function ko(D){let p,_,d,c,b,s,u,P,T,x,G,J,W,Be,Ne,R,qt,Ot,Zt,L,Et,B,Kt,Se,en,tn,Ce,nn,sn,Qe,on,an,xt,H,ln,Re,rn,pn,Ut,A,Q,qe,fe,dn,Oe,cn,Tt,g,me,fn,Ke,mn,un,Fe,Xe,hn,gn,bn,ue,et,_n,yn,tt,vn,$n,nt,wn,Mn,he,q,st,jn,Zn,ot,En,xn,Un,O,it,Tn,Gn,at,Dn,Pn,Wn,K,ge,kn,lt,Jn,In,Ye,be,Vn,Ae,_e,Bn,N,ye,Nn,ve,Sn,rt,Cn,Rn,Fn,$e,Xn,pt,Yn,An,zn,ee,Ln,te,we,Hn,Me,Qn,dt,qn,On,Kn,ne,je,es,Ze,ts,Ee,ns,ss,os,F,xe,is,ct,as,ls,se,rs,X,Ue,ps,ft,ds,cs,mt,fs,ms,I,Te,us,Ge,hs,De,gs,bs,_s,ut,ys,vs,oe,$s,ie,ws,k,Pe,Ms,ht,js,Zs,We,Es,gt,xs,Us,Ts,ae,Gs,le,Ds,re,Ps,pe,ke,Ws,bt,ks,Js,de,Je,Is,Ie,Vs,ze,Bs,Ns,Gt;return s=new vo({}),L=new zt({props:{$$slots:{default:[Eo]},$$scope:{ctx:D}}}),fe=new vo({}),me=new V({props:{name:"class diffusers.DiffusionPipeline",anchor:"diffusers.DiffusionPipeline",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/pipeline_utils.py#L458"}}),ge=new V({props:{name:"__call__",anchor:"diffusers.DiffusionPipeline.__call__",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}]}}),be=new V({props:{name:"device",anchor:"diffusers.DiffusionPipeline.device",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/pipeline_utils.py#L698",returnDescription:`
<p>The torch device on which the pipeline is located.</p>
`,returnType:`
<p><code>torch.device</code></p>
`}}),_e=new V({props:{name:"to",anchor:"diffusers.DiffusionPipeline.to",parameters:[{name:"torch_device",val:": typing.Union[str, torch.device, NoneType] = None"},{name:"torch_dtype",val:": typing.Optional[torch.dtype] = None"},{name:"silence_dtype_warnings",val:": bool = False"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/pipeline_utils.py#L623"}}),ye=new V({props:{name:"components",anchor:"diffusers.DiffusionPipeline.components",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/pipeline_utils.py#L1338"}}),ee=new Lt({props:{anchor:"diffusers.DiffusionPipeline.components.example",$$slots:{default:[xo]},$$scope:{ctx:D}}}),we=new V({props:{name:"disable_attention_slicing",anchor:"diffusers.DiffusionPipeline.disable_attention_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/pipeline_utils.py#L1477"}}),je=new V({props:{name:"disable_xformers_memory_efficient_attention",anchor:"diffusers.DiffusionPipeline.disable_xformers_memory_efficient_attention",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/pipeline_utils.py#L1435"}}),xe=new V({props:{name:"download",anchor:"diffusers.DiffusionPipeline.download",parameters:[{name:"pretrained_model_name",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.DiffusionPipeline.download.pretrained_model_name",description:`<strong>pretrained_model_name</strong> (<code>str</code> or <code>os.PathLike</code>, <em>optional</em>) &#x2014;
A string, the <em>repository id</em> (for example <code>CompVis/ldm-text2im-large-256</code>) of a pretrained pipeline
hosted on the Hub.`,name:"pretrained_model_name"},{anchor:"diffusers.DiffusionPipeline.download.custom_pipeline",description:`<strong>custom_pipeline</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Can be either:</p>
<ul>
<li>
<p>A string, the <em>repository id</em> (for example <code>CompVis/ldm-text2im-large-256</code>) of a pretrained
pipeline hosted on the Hub. The repository must contain a file called <code>pipeline.py</code> that defines
the custom pipeline.</p>
</li>
<li>
<p>A string, the <em>file name</em> of a community pipeline hosted on GitHub under
<a href="https://github.com/huggingface/diffusers/tree/main/examples/community" rel="nofollow">Community</a>. Valid file
names must match the file name and not the pipeline script (<code>clip_guided_stable_diffusion</code>
instead of <code>clip_guided_stable_diffusion.py</code>). Community pipelines are always loaded from the
current <code>main</code> branch of GitHub.</p>
</li>
<li>
<p>A path to a <em>directory</em> (<code>./my_pipeline_directory/</code>) containing a custom pipeline. The directory
must contain a file called <code>pipeline.py</code> that defines the custom pipeline.</p>
</li>
</ul>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>&#x1F9EA; This is an experimental feature and may change in the future.</p>

					</div>
<p>For more information on how to load and create custom pipelines, take a look at <a href="https://huggingface.co/docs/diffusers/main/en/using-diffusers/contribute_pipeline" rel="nofollow">How to contribute a
community pipeline</a>.`,name:"custom_pipeline"},{anchor:"diffusers.DiffusionPipeline.download.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.`,name:"force_download"},{anchor:"diffusers.DiffusionPipeline.download.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to resume downloading the model weights and configuration files. If set to <code>False</code>, any
incompletely downloaded files are deleted.`,name:"resume_download"},{anchor:"diffusers.DiffusionPipeline.download.proxies",description:`<strong>proxies</strong> (<code>Dict[str, str]</code>, <em>optional</em>) &#x2014;
A dictionary of proxy servers to use by protocol or endpoint, for example, <code>{&apos;http&apos;: &apos;foo.bar:3128&apos;, &apos;http://hostname&apos;: &apos;foo.bar:4012&apos;}</code>. The proxies are used on each request.`,name:"proxies"},{anchor:"diffusers.DiffusionPipeline.download.output_loading_info(bool,",description:`<strong>output_loading_info(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to also return a dictionary containing missing keys, unexpected keys and error messages.`,name:"output_loading_info(bool,"},{anchor:"diffusers.DiffusionPipeline.download.local_files_only",description:`<strong>local_files_only</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to only load local model weights and configuration files or not. If set to <code>True</code>, the model
won&#x2019;t be downloaded from the Hub.`,name:"local_files_only"},{anchor:"diffusers.DiffusionPipeline.download.use_auth_token",description:`<strong>use_auth_token</strong> (<code>str</code> or <em>bool</em>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, the token generated from
<code>diffusers-cli login</code> (stored in <code>~/.huggingface</code>) is used.`,name:"use_auth_token"},{anchor:"diffusers.DiffusionPipeline.download.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, a commit id, or any identifier
allowed by Git.`,name:"revision"},{anchor:"diffusers.DiffusionPipeline.download.custom_revision",description:`<strong>custom_revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, or a commit id similar to
<code>revision</code> when loading a custom pipeline from the Hub. It can be a &#x1F917; Diffusers version when loading a
custom pipeline from GitHub, otherwise it defaults to <code>&quot;main&quot;</code> when loading from the Hub.`,name:"custom_revision"},{anchor:"diffusers.DiffusionPipeline.download.mirror",description:`<strong>mirror</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Mirror source to resolve accessibility issues if you&#x2019;re downloading a model in China. We do not
guarantee the timeliness or safety of the source, and you should refer to the mirror site for more
information.`,name:"mirror"},{anchor:"diffusers.DiffusionPipeline.download.variant",description:`<strong>variant</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Load weights from a specified variant filename such as <code>&quot;fp16&quot;</code> or <code>&quot;ema&quot;</code>. This is ignored when
loading <code>from_flax</code>.`,name:"variant"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/pipeline_utils.py#L1078",returnDescription:`
<p>A path to the downloaded pipeline.</p>
`,returnType:`
<p><code>os.PathLike</code></p>
`}}),se=new zt({props:{$$slots:{default:[Uo]},$$scope:{ctx:D}}}),Ue=new V({props:{name:"enable_attention_slicing",anchor:"diffusers.DiffusionPipeline.enable_attention_slicing",parameters:[{name:"slice_size",val:": typing.Union[str, int, NoneType] = 'auto'"}],parametersDescription:[{anchor:"diffusers.DiffusionPipeline.enable_attention_slicing.slice_size",description:`<strong>slice_size</strong> (<code>str</code> or <code>int</code>, <em>optional</em>, defaults to <code>&quot;auto&quot;</code>) &#x2014;
When <code>&quot;auto&quot;</code>, halves the input to the attention heads, so attention will be computed in two steps. If
<code>&quot;max&quot;</code>, maximum amount of memory will be saved by running only one slice at a time. If a number is
provided, uses as many slices as <code>attention_head_dim // slice_size</code>. In this case, <code>attention_head_dim</code>
must be a multiple of <code>slice_size</code>.`,name:"slice_size"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/pipeline_utils.py#L1461"}}),Te=new V({props:{name:"enable_xformers_memory_efficient_attention",anchor:"diffusers.DiffusionPipeline.enable_xformers_memory_efficient_attention",parameters:[{name:"attention_op",val:": typing.Optional[typing.Callable] = None"}],parametersDescription:[{anchor:"diffusers.DiffusionPipeline.enable_xformers_memory_efficient_attention.attention_op",description:`<strong>attention_op</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
Override the default <code>None</code> operator for use as <code>op</code> argument to the
<a href="https://facebookresearch.github.io/xformers/components/ops.html#xformers.ops.memory_efficient_attention" rel="nofollow"><code>memory_efficient_attention()</code></a>
function of xFormers.`,name:"attention_op"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/pipeline_utils.py#L1399"}}),oe=new zt({props:{warning:!0,$$slots:{default:[To]},$$scope:{ctx:D}}}),ie=new Lt({props:{anchor:"diffusers.DiffusionPipeline.enable_xformers_memory_efficient_attention.example",$$slots:{default:[Go]},$$scope:{ctx:D}}}),Pe=new V({props:{name:"from_pretrained",anchor:"diffusers.DiffusionPipeline.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, os.PathLike, NoneType]"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.DiffusionPipeline.from_pretrained.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code> or <code>os.PathLike</code>, <em>optional</em>) &#x2014;
Can be either:</p>
<ul>
<li>A string, the <em>repo id</em> (for example <code>CompVis/ldm-text2im-large-256</code>) of a pretrained pipeline
hosted on the Hub.</li>
<li>A path to a <em>directory</em> (for example <code>./my_pipeline_directory/</code>) containing pipeline weights
saved using
<a href="/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.save_pretrained">save_pretrained()</a>.</li>
</ul>`,name:"pretrained_model_name_or_path"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.torch_dtype",description:`<strong>torch_dtype</strong> (<code>str</code> or <code>torch.dtype</code>, <em>optional</em>) &#x2014;
Override the default <code>torch.dtype</code> and load the model with another dtype. If &#x201C;auto&#x201D; is passed, the
dtype is automatically derived from the model&#x2019;s weights.`,name:"torch_dtype"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.custom_pipeline",description:`<strong>custom_pipeline</strong> (<code>str</code>, <em>optional</em>) &#x2014;</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>&#x1F9EA; This is an experimental feature and may change in the future.</p>

					</div>
<p>Can be either:</p>
<ul>
<li>A string, the <em>repo id</em> (for example <code>hf-internal-testing/diffusers-dummy-pipeline</code>) of a custom
pipeline hosted on the Hub. The repository must contain a file called pipeline.py that defines
the custom pipeline.</li>
<li>A string, the <em>file name</em> of a community pipeline hosted on GitHub under
<a href="https://github.com/huggingface/diffusers/tree/main/examples/community" rel="nofollow">Community</a>. Valid file
names must match the file name and not the pipeline script (<code>clip_guided_stable_diffusion</code>
instead of <code>clip_guided_stable_diffusion.py</code>). Community pipelines are always loaded from the
current main branch of GitHub.</li>
<li>A path to a directory (<code>./my_pipeline_directory/</code>) containing a custom pipeline. The directory
must contain a file called <code>pipeline.py</code> that defines the custom pipeline.</li>
</ul>`,name:"custom_pipeline"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/pipeline_utils.py#L713"}}),ae=new Lt({props:{anchor:"diffusers.DiffusionPipeline.from_pretrained.example",$$slots:{default:[Do]},$$scope:{ctx:D}}}),le=new zt({props:{$$slots:{default:[Po]},$$scope:{ctx:D}}}),re=new Lt({props:{anchor:"diffusers.DiffusionPipeline.from_pretrained.example-2",$$slots:{default:[Wo]},$$scope:{ctx:D}}}),ke=new V({props:{name:"numpy_to_pil",anchor:"diffusers.DiffusionPipeline.numpy_to_pil",parameters:[{name:"images",val:""}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/pipeline_utils.py#L1374"}}),Je=new V({props:{name:"save_pretrained",anchor:"diffusers.DiffusionPipeline.save_pretrained",parameters:[{name:"save_directory",val:": typing.Union[str, os.PathLike]"},{name:"safe_serialization",val:": bool = False"},{name:"variant",val:": typing.Optional[str] = None"}],parametersDescription:[{anchor:"diffusers.DiffusionPipeline.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory to save a pipeline to. Will be created if it doesn&#x2019;t exist.`,name:"save_directory"},{anchor:"diffusers.DiffusionPipeline.save_pretrained.safe_serialization",description:`<strong>safe_serialization</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to save the model using <code>safetensors</code> or the traditional PyTorch way with <code>pickle</code>.`,name:"safe_serialization"},{anchor:"diffusers.DiffusionPipeline.save_pretrained.variant",description:`<strong>variant</strong> (<code>str</code>, <em>optional</em>) &#x2014;
If specified, weights are saved in the format <code>pytorch_model.&lt;variant&gt;.bin</code>.`,name:"variant"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/pipeline_utils.py#L536"}}),{c(){p=o("meta"),_=f(),d=o("h1"),c=o("a"),b=o("span"),$(s.$$.fragment),u=f(),P=o("span"),T=a("Pipelines"),x=f(),G=o("p"),J=a("The "),W=o("a"),Be=a("DiffusionPipeline"),Ne=a(" is the quickest way to load any pretrained diffusion pipeline from the "),R=o("a"),qt=a("Hub"),Ot=a(" for inference."),Zt=f(),$(L.$$.fragment),Et=f(),B=o("p"),Kt=a("The pipeline type (for example "),Se=o("a"),en=a("StableDiffusionPipeline"),tn=a(") of any diffusion pipeline loaded with "),Ce=o("a"),nn=a("from_pretrained()"),sn=a(` is automatically
detected and pipeline components are loaded and passed to the `),Qe=o("code"),on=a("__init__"),an=a(" function of the pipeline."),xt=f(),H=o("p"),ln=a("Any pipeline object can be saved locally with "),Re=o("a"),rn=a("save_pretrained()"),pn=a("."),Ut=f(),A=o("h2"),Q=o("a"),qe=o("span"),$(fe.$$.fragment),dn=f(),Oe=o("span"),cn=a("DiffusionPipeline"),Tt=f(),g=o("div"),$(me.$$.fragment),fn=f(),Ke=o("p"),mn=a("Base class for all pipelines."),un=f(),Fe=o("p"),Xe=o("a"),hn=a("DiffusionPipeline"),gn=a(` stores all components (models, schedulers, and processors) for diffusion pipelines and
provides methods for loading, downloading and saving models. It also includes methods to:`),bn=f(),ue=o("ul"),et=o("li"),_n=a("move all PyTorch modules to the device of your choice"),yn=f(),tt=o("li"),vn=a("enabling/disabling the progress bar for the denoising iteration"),$n=f(),nt=o("p"),wn=a("Class attributes:"),Mn=f(),he=o("ul"),q=o("li"),st=o("strong"),jn=a("config_name"),Zn=a(" ("),ot=o("code"),En=a("str"),xn=a(`) \u2014 The configuration filename that stores the class and module names of all the
diffusion pipeline\u2019s components.`),Un=f(),O=o("li"),it=o("strong"),Tn=a("_optional_components"),Gn=a(" (List"),at=o("code"),Dn=a("str"),Pn=a(`) \u2014 List of all optional components that don\u2019t have to be passed to the
pipeline to function (should be overridden by subclasses).`),Wn=f(),K=o("div"),$(ge.$$.fragment),kn=f(),lt=o("p"),Jn=a("Call self as a function."),In=f(),Ye=o("div"),$(be.$$.fragment),Vn=f(),Ae=o("div"),$(_e.$$.fragment),Bn=f(),N=o("div"),$(ye.$$.fragment),Nn=f(),ve=o("p"),Sn=a("The "),rt=o("code"),Cn=a("self.components"),Rn=a(` property can be useful to run different pipelines with the same weights and
configurations without reallocating additional memory.`),Fn=f(),$e=o("p"),Xn=a("Returns ("),pt=o("code"),Yn=a("dict"),An=a(`):
A dictionary containing all the modules needed to initialize the pipeline.`),zn=f(),$(ee.$$.fragment),Ln=f(),te=o("div"),$(we.$$.fragment),Hn=f(),Me=o("p"),Qn=a("Disable sliced attention computation. If "),dt=o("code"),qn=a("enable_attention_slicing"),On=a(` was previously called, attention is
computed in one step.`),Kn=f(),ne=o("div"),$(je.$$.fragment),es=f(),Ze=o("p"),ts=a("Disable memory efficient attention from "),Ee=o("a"),ns=a("xFormers"),ss=a("."),os=f(),F=o("div"),$(xe.$$.fragment),is=f(),ct=o("p"),as=a("Download and cache a PyTorch diffusion pipeline from pretrained pipeline weights."),ls=f(),$(se.$$.fragment),rs=f(),X=o("div"),$(Ue.$$.fragment),ps=f(),ft=o("p"),ds=a("Enable sliced attention computation."),cs=f(),mt=o("p"),fs=a(`When this option is enabled, the attention module splits the input tensor in slices to compute attention in
several steps. This is useful to save some memory in exchange for a small speed decrease.`),ms=f(),I=o("div"),$(Te.$$.fragment),us=f(),Ge=o("p"),hs=a("Enable memory efficient attention from "),De=o("a"),gs=a("xFormers"),bs=a("."),_s=f(),ut=o("p"),ys=a(`When this option is enabled, you should observe lower GPU memory usage and a potential speed up during
inference. Speed up during training is not guaranteed.`),vs=f(),$(oe.$$.fragment),$s=f(),$(ie.$$.fragment),ws=f(),k=o("div"),$(Pe.$$.fragment),Ms=f(),ht=o("p"),js=a("Instantiate a PyTorch diffusion pipeline from pretrained pipeline weights."),Zs=f(),We=o("p"),Es=a("The pipeline is set in evaluation mode ("),gt=o("code"),xs=a("model.eval()"),Us=a(") by default."),Ts=f(),$(ae.$$.fragment),Gs=f(),$(le.$$.fragment),Ds=f(),$(re.$$.fragment),Ps=f(),pe=o("div"),$(ke.$$.fragment),Ws=f(),bt=o("p"),ks=a("Convert a NumPy image or a batch of images to a PIL image."),Js=f(),de=o("div"),$(Je.$$.fragment),Is=f(),Ie=o("p"),Vs=a(`Save all saveable variables of the pipeline to a directory. A pipeline variable can be saved and loaded if its
class implements both a save and loading method. The pipeline is easily reloaded using the
`),ze=o("a"),Bs=a("from_pretrained()"),Ns=a(" class method."),this.h()},l(n){const v=jo('[data-svelte="svelte-1phssyn"]',document.head);p=i(v,"META",{name:!0,content:!0}),v.forEach(t),_=m(n),d=i(n,"H1",{class:!0});var Ve=r(d);c=i(Ve,"A",{id:!0,class:!0,href:!0});var _t=r(c);b=i(_t,"SPAN",{});var yt=r(b);w(s.$$.fragment,yt),yt.forEach(t),_t.forEach(t),u=m(Ve),P=i(Ve,"SPAN",{});var vt=r(P);T=l(vt,"Pipelines"),vt.forEach(t),Ve.forEach(t),x=m(n),G=i(n,"P",{});var z=r(G);J=l(z,"The "),W=i(z,"A",{href:!0});var $t=r(W);Be=l($t,"DiffusionPipeline"),$t.forEach(t),Ne=l(z," is the quickest way to load any pretrained diffusion pipeline from the "),R=i(z,"A",{href:!0,rel:!0});var wt=r(R);qt=l(wt,"Hub"),wt.forEach(t),Ot=l(z," for inference."),z.forEach(t),Zt=m(n),w(L.$$.fragment,n),Et=m(n),B=i(n,"P",{});var C=r(B);Kt=l(C,"The pipeline type (for example "),Se=i(C,"A",{href:!0});var Cs=r(Se);en=l(Cs,"StableDiffusionPipeline"),Cs.forEach(t),tn=l(C,") of any diffusion pipeline loaded with "),Ce=i(C,"A",{href:!0});var Rs=r(Ce);nn=l(Rs,"from_pretrained()"),Rs.forEach(t),sn=l(C,` is automatically
detected and pipeline components are loaded and passed to the `),Qe=i(C,"CODE",{});var Fs=r(Qe);on=l(Fs,"__init__"),Fs.forEach(t),an=l(C," function of the pipeline."),C.forEach(t),xt=m(n),H=i(n,"P",{});var Dt=r(H);ln=l(Dt,"Any pipeline object can be saved locally with "),Re=i(Dt,"A",{href:!0});var Xs=r(Re);rn=l(Xs,"save_pretrained()"),Xs.forEach(t),pn=l(Dt,"."),Dt.forEach(t),Ut=m(n),A=i(n,"H2",{class:!0});var Pt=r(A);Q=i(Pt,"A",{id:!0,class:!0,href:!0});var Ys=r(Q);qe=i(Ys,"SPAN",{});var As=r(qe);w(fe.$$.fragment,As),As.forEach(t),Ys.forEach(t),dn=m(Pt),Oe=i(Pt,"SPAN",{});var zs=r(Oe);cn=l(zs,"DiffusionPipeline"),zs.forEach(t),Pt.forEach(t),Tt=m(n),g=i(n,"DIV",{class:!0});var y=r(g);w(me.$$.fragment,y),fn=m(y),Ke=i(y,"P",{});var Ls=r(Ke);mn=l(Ls,"Base class for all pipelines."),Ls.forEach(t),un=m(y),Fe=i(y,"P",{});var Ss=r(Fe);Xe=i(Ss,"A",{href:!0});var Hs=r(Xe);hn=l(Hs,"DiffusionPipeline"),Hs.forEach(t),gn=l(Ss,` stores all components (models, schedulers, and processors) for diffusion pipelines and
provides methods for loading, downloading and saving models. It also includes methods to:`),Ss.forEach(t),bn=m(y),ue=i(y,"UL",{});var Wt=r(ue);et=i(Wt,"LI",{});var Qs=r(et);_n=l(Qs,"move all PyTorch modules to the device of your choice"),Qs.forEach(t),yn=m(Wt),tt=i(Wt,"LI",{});var qs=r(tt);vn=l(qs,"enabling/disabling the progress bar for the denoising iteration"),qs.forEach(t),Wt.forEach(t),$n=m(y),nt=i(y,"P",{});var Os=r(nt);wn=l(Os,"Class attributes:"),Os.forEach(t),Mn=m(y),he=i(y,"UL",{});var kt=r(he);q=i(kt,"LI",{});var Mt=r(q);st=i(Mt,"STRONG",{});var Ks=r(st);jn=l(Ks,"config_name"),Ks.forEach(t),Zn=l(Mt," ("),ot=i(Mt,"CODE",{});var eo=r(ot);En=l(eo,"str"),eo.forEach(t),xn=l(Mt,`) \u2014 The configuration filename that stores the class and module names of all the
diffusion pipeline\u2019s components.`),Mt.forEach(t),Un=m(kt),O=i(kt,"LI",{});var jt=r(O);it=i(jt,"STRONG",{});var to=r(it);Tn=l(to,"_optional_components"),to.forEach(t),Gn=l(jt," (List"),at=i(jt,"CODE",{});var no=r(at);Dn=l(no,"str"),no.forEach(t),Pn=l(jt,`) \u2014 List of all optional components that don\u2019t have to be passed to the
pipeline to function (should be overridden by subclasses).`),jt.forEach(t),kt.forEach(t),Wn=m(y),K=i(y,"DIV",{class:!0});var Jt=r(K);w(ge.$$.fragment,Jt),kn=m(Jt),lt=i(Jt,"P",{});var so=r(lt);Jn=l(so,"Call self as a function."),so.forEach(t),Jt.forEach(t),In=m(y),Ye=i(y,"DIV",{class:!0});var oo=r(Ye);w(be.$$.fragment,oo),oo.forEach(t),Vn=m(y),Ae=i(y,"DIV",{class:!0});var io=r(Ae);w(_e.$$.fragment,io),io.forEach(t),Bn=m(y),N=i(y,"DIV",{class:!0});var ce=r(N);w(ye.$$.fragment,ce),Nn=m(ce),ve=i(ce,"P",{});var It=r(ve);Sn=l(It,"The "),rt=i(It,"CODE",{});var ao=r(rt);Cn=l(ao,"self.components"),ao.forEach(t),Rn=l(It,` property can be useful to run different pipelines with the same weights and
configurations without reallocating additional memory.`),It.forEach(t),Fn=m(ce),$e=i(ce,"P",{});var Vt=r($e);Xn=l(Vt,"Returns ("),pt=i(Vt,"CODE",{});var lo=r(pt);Yn=l(lo,"dict"),lo.forEach(t),An=l(Vt,`):
A dictionary containing all the modules needed to initialize the pipeline.`),Vt.forEach(t),zn=m(ce),w(ee.$$.fragment,ce),ce.forEach(t),Ln=m(y),te=i(y,"DIV",{class:!0});var Bt=r(te);w(we.$$.fragment,Bt),Hn=m(Bt),Me=i(Bt,"P",{});var Nt=r(Me);Qn=l(Nt,"Disable sliced attention computation. If "),dt=i(Nt,"CODE",{});var ro=r(dt);qn=l(ro,"enable_attention_slicing"),ro.forEach(t),On=l(Nt,` was previously called, attention is
computed in one step.`),Nt.forEach(t),Bt.forEach(t),Kn=m(y),ne=i(y,"DIV",{class:!0});var St=r(ne);w(je.$$.fragment,St),es=m(St),Ze=i(St,"P",{});var Ct=r(Ze);ts=l(Ct,"Disable memory efficient attention from "),Ee=i(Ct,"A",{href:!0,rel:!0});var po=r(Ee);ns=l(po,"xFormers"),po.forEach(t),ss=l(Ct,"."),Ct.forEach(t),St.forEach(t),os=m(y),F=i(y,"DIV",{class:!0});var Le=r(F);w(xe.$$.fragment,Le),is=m(Le),ct=i(Le,"P",{});var co=r(ct);as=l(co,"Download and cache a PyTorch diffusion pipeline from pretrained pipeline weights."),co.forEach(t),ls=m(Le),w(se.$$.fragment,Le),Le.forEach(t),rs=m(y),X=i(y,"DIV",{class:!0});var He=r(X);w(Ue.$$.fragment,He),ps=m(He),ft=i(He,"P",{});var fo=r(ft);ds=l(fo,"Enable sliced attention computation."),fo.forEach(t),cs=m(He),mt=i(He,"P",{});var mo=r(mt);fs=l(mo,`When this option is enabled, the attention module splits the input tensor in slices to compute attention in
several steps. This is useful to save some memory in exchange for a small speed decrease.`),mo.forEach(t),He.forEach(t),ms=m(y),I=i(y,"DIV",{class:!0});var Y=r(I);w(Te.$$.fragment,Y),us=m(Y),Ge=i(Y,"P",{});var Rt=r(Ge);hs=l(Rt,"Enable memory efficient attention from "),De=i(Rt,"A",{href:!0,rel:!0});var uo=r(De);gs=l(uo,"xFormers"),uo.forEach(t),bs=l(Rt,"."),Rt.forEach(t),_s=m(Y),ut=i(Y,"P",{});var ho=r(ut);ys=l(ho,`When this option is enabled, you should observe lower GPU memory usage and a potential speed up during
inference. Speed up during training is not guaranteed.`),ho.forEach(t),vs=m(Y),w(oe.$$.fragment,Y),$s=m(Y),w(ie.$$.fragment,Y),Y.forEach(t),ws=m(y),k=i(y,"DIV",{class:!0});var S=r(k);w(Pe.$$.fragment,S),Ms=m(S),ht=i(S,"P",{});var go=r(ht);js=l(go,"Instantiate a PyTorch diffusion pipeline from pretrained pipeline weights."),go.forEach(t),Zs=m(S),We=i(S,"P",{});var Ft=r(We);Es=l(Ft,"The pipeline is set in evaluation mode ("),gt=i(Ft,"CODE",{});var bo=r(gt);xs=l(bo,"model.eval()"),bo.forEach(t),Us=l(Ft,") by default."),Ft.forEach(t),Ts=m(S),w(ae.$$.fragment,S),Gs=m(S),w(le.$$.fragment,S),Ds=m(S),w(re.$$.fragment,S),S.forEach(t),Ps=m(y),pe=i(y,"DIV",{class:!0});var Xt=r(pe);w(ke.$$.fragment,Xt),Ws=m(Xt),bt=i(Xt,"P",{});var _o=r(bt);ks=l(_o,"Convert a NumPy image or a batch of images to a PIL image."),_o.forEach(t),Xt.forEach(t),Js=m(y),de=i(y,"DIV",{class:!0});var Yt=r(de);w(Je.$$.fragment,Yt),Is=m(Yt),Ie=i(Yt,"P",{});var At=r(Ie);Vs=l(At,`Save all saveable variables of the pipeline to a directory. A pipeline variable can be saved and loaded if its
class implements both a save and loading method. The pipeline is easily reloaded using the
`),ze=i(At,"A",{href:!0});var yo=r(ze);Bs=l(yo,"from_pretrained()"),yo.forEach(t),Ns=l(At," class method."),At.forEach(t),Yt.forEach(t),y.forEach(t),this.h()},h(){h(p,"name","hf:doc:metadata"),h(p,"content",JSON.stringify(Jo)),h(c,"id","pipelines"),h(c,"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"),h(c,"href","#pipelines"),h(d,"class","relative group"),h(W,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),h(R,"href","https://huggingface.co/models?library=diffusers"),h(R,"rel","nofollow"),h(Se,"href","/docs/diffusers/v0.18.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),h(Ce,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),h(Re,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.save_pretrained"),h(Q,"id","diffusers.DiffusionPipeline"),h(Q,"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"),h(Q,"href","#diffusers.DiffusionPipeline"),h(A,"class","relative group"),h(Xe,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),h(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ee,"href","https://facebookresearch.github.io/xformers/"),h(Ee,"rel","nofollow"),h(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(De,"href","https://facebookresearch.github.io/xformers/"),h(De,"rel","nofollow"),h(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ze,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),h(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(g,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(n,v){e(document.head,p),U(n,_,v),U(n,d,v),e(d,c),e(c,b),M(s,b,null),e(d,u),e(d,P),e(P,T),U(n,x,v),U(n,G,v),e(G,J),e(G,W),e(W,Be),e(G,Ne),e(G,R),e(R,qt),e(G,Ot),U(n,Zt,v),M(L,n,v),U(n,Et,v),U(n,B,v),e(B,Kt),e(B,Se),e(Se,en),e(B,tn),e(B,Ce),e(Ce,nn),e(B,sn),e(B,Qe),e(Qe,on),e(B,an),U(n,xt,v),U(n,H,v),e(H,ln),e(H,Re),e(Re,rn),e(H,pn),U(n,Ut,v),U(n,A,v),e(A,Q),e(Q,qe),M(fe,qe,null),e(A,dn),e(A,Oe),e(Oe,cn),U(n,Tt,v),U(n,g,v),M(me,g,null),e(g,fn),e(g,Ke),e(Ke,mn),e(g,un),e(g,Fe),e(Fe,Xe),e(Xe,hn),e(Fe,gn),e(g,bn),e(g,ue),e(ue,et),e(et,_n),e(ue,yn),e(ue,tt),e(tt,vn),e(g,$n),e(g,nt),e(nt,wn),e(g,Mn),e(g,he),e(he,q),e(q,st),e(st,jn),e(q,Zn),e(q,ot),e(ot,En),e(q,xn),e(he,Un),e(he,O),e(O,it),e(it,Tn),e(O,Gn),e(O,at),e(at,Dn),e(O,Pn),e(g,Wn),e(g,K),M(ge,K,null),e(K,kn),e(K,lt),e(lt,Jn),e(g,In),e(g,Ye),M(be,Ye,null),e(g,Vn),e(g,Ae),M(_e,Ae,null),e(g,Bn),e(g,N),M(ye,N,null),e(N,Nn),e(N,ve),e(ve,Sn),e(ve,rt),e(rt,Cn),e(ve,Rn),e(N,Fn),e(N,$e),e($e,Xn),e($e,pt),e(pt,Yn),e($e,An),e(N,zn),M(ee,N,null),e(g,Ln),e(g,te),M(we,te,null),e(te,Hn),e(te,Me),e(Me,Qn),e(Me,dt),e(dt,qn),e(Me,On),e(g,Kn),e(g,ne),M(je,ne,null),e(ne,es),e(ne,Ze),e(Ze,ts),e(Ze,Ee),e(Ee,ns),e(Ze,ss),e(g,os),e(g,F),M(xe,F,null),e(F,is),e(F,ct),e(ct,as),e(F,ls),M(se,F,null),e(g,rs),e(g,X),M(Ue,X,null),e(X,ps),e(X,ft),e(ft,ds),e(X,cs),e(X,mt),e(mt,fs),e(g,ms),e(g,I),M(Te,I,null),e(I,us),e(I,Ge),e(Ge,hs),e(Ge,De),e(De,gs),e(Ge,bs),e(I,_s),e(I,ut),e(ut,ys),e(I,vs),M(oe,I,null),e(I,$s),M(ie,I,null),e(g,ws),e(g,k),M(Pe,k,null),e(k,Ms),e(k,ht),e(ht,js),e(k,Zs),e(k,We),e(We,Es),e(We,gt),e(gt,xs),e(We,Us),e(k,Ts),M(ae,k,null),e(k,Gs),M(le,k,null),e(k,Ds),M(re,k,null),e(g,Ps),e(g,pe),M(ke,pe,null),e(pe,Ws),e(pe,bt),e(bt,ks),e(g,Js),e(g,de),M(Je,de,null),e(de,Is),e(de,Ie),e(Ie,Vs),e(Ie,ze),e(ze,Bs),e(Ie,Ns),Gt=!0},p(n,[v]){const Ve={};v&2&&(Ve.$$scope={dirty:v,ctx:n}),L.$set(Ve);const _t={};v&2&&(_t.$$scope={dirty:v,ctx:n}),ee.$set(_t);const yt={};v&2&&(yt.$$scope={dirty:v,ctx:n}),se.$set(yt);const vt={};v&2&&(vt.$$scope={dirty:v,ctx:n}),oe.$set(vt);const z={};v&2&&(z.$$scope={dirty:v,ctx:n}),ie.$set(z);const $t={};v&2&&($t.$$scope={dirty:v,ctx:n}),ae.$set($t);const wt={};v&2&&(wt.$$scope={dirty:v,ctx:n}),le.$set(wt);const C={};v&2&&(C.$$scope={dirty:v,ctx:n}),re.$set(C)},i(n){Gt||(j(s.$$.fragment,n),j(L.$$.fragment,n),j(fe.$$.fragment,n),j(me.$$.fragment,n),j(ge.$$.fragment,n),j(be.$$.fragment,n),j(_e.$$.fragment,n),j(ye.$$.fragment,n),j(ee.$$.fragment,n),j(we.$$.fragment,n),j(je.$$.fragment,n),j(xe.$$.fragment,n),j(se.$$.fragment,n),j(Ue.$$.fragment,n),j(Te.$$.fragment,n),j(oe.$$.fragment,n),j(ie.$$.fragment,n),j(Pe.$$.fragment,n),j(ae.$$.fragment,n),j(le.$$.fragment,n),j(re.$$.fragment,n),j(ke.$$.fragment,n),j(Je.$$.fragment,n),Gt=!0)},o(n){Z(s.$$.fragment,n),Z(L.$$.fragment,n),Z(fe.$$.fragment,n),Z(me.$$.fragment,n),Z(ge.$$.fragment,n),Z(be.$$.fragment,n),Z(_e.$$.fragment,n),Z(ye.$$.fragment,n),Z(ee.$$.fragment,n),Z(we.$$.fragment,n),Z(je.$$.fragment,n),Z(xe.$$.fragment,n),Z(se.$$.fragment,n),Z(Ue.$$.fragment,n),Z(Te.$$.fragment,n),Z(oe.$$.fragment,n),Z(ie.$$.fragment,n),Z(Pe.$$.fragment,n),Z(ae.$$.fragment,n),Z(le.$$.fragment,n),Z(re.$$.fragment,n),Z(ke.$$.fragment,n),Z(Je.$$.fragment,n),Gt=!1},d(n){t(p),n&&t(_),n&&t(d),E(s),n&&t(x),n&&t(G),n&&t(Zt),E(L,n),n&&t(Et),n&&t(B),n&&t(xt),n&&t(H),n&&t(Ut),n&&t(A),E(fe),n&&t(Tt),n&&t(g),E(me),E(ge),E(be),E(_e),E(ye),E(ee),E(we),E(je),E(xe),E(se),E(Ue),E(Te),E(oe),E(ie),E(Pe),E(ae),E(le),E(re),E(ke),E(Je)}}}const Jo={local:"pipelines",sections:[{local:"diffusers.DiffusionPipeline",title:"DiffusionPipeline"}],title:"Pipelines"};function Io(D){return Zo(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Fo extends $o{constructor(p){super();wo(this,p,Io,ko,Mo,{})}}export{Fo as default,Jo as metadata};
