import{S as xi,i as Pi,s as Di,e as n,k as p,w,t as s,M as Ei,c as i,d as t,m as f,a,x as $,h as r,b as g,G as e,g as k,y as x,q as P,o as D,B as E,v as ki,L as Cn}from"../../chunks/vendor-hf-doc-builder.js";import{T as Lt}from"../../chunks/Tip-hf-doc-builder.js";import{D as X}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Nn}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as $i}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Bn}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Mi(Z){let d;return{c(){d=s("You shouldn't use the [DiffusionPipeline](/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline) class for training or finetuning a diffusion model. Individual \ncomponents (for example, `UNetModel` and `UNetConditionModel`) of diffusion pipelines are usually trained individually, so we suggest directly working with instead.")},l(_){d=r(_,"You shouldn't use the [DiffusionPipeline](/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline) class for training or finetuning a diffusion model. Individual \ncomponents (for example, `UNetModel` and `UNetConditionModel`) of diffusion pipelines are usually trained individually, so we suggest directly working with instead.")},m(_,c){k(_,d,c)},d(_){_&&t(d)}}}function Ti(Z){let d,_,c,m,v;return m=new Nn({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(){d=n("p"),_=s("Examples:"),c=p(),w(m.$$.fragment)},l(l){d=i(l,"P",{});var h=a(d);_=r(h,"Examples:"),h.forEach(t),c=f(l),$(m.$$.fragment,l)},m(l,h){k(l,d,h),e(d,_),k(l,c,h),x(m,l,h),v=!0},p:Cn,i(l){v||(P(m.$$.fragment,l),v=!0)},o(l){D(m.$$.fragment,l),v=!1},d(l){l&&t(d),l&&t(c),E(m,l)}}}function Wi(Z){let d,_,c,m,v,l,h,U;return{c(){d=n("p"),_=s("To use private or "),c=n("a"),m=s("gated models"),v=s(`, log-in with
`),l=n("code"),h=s("huggingface-cli login"),U=s("."),this.h()},l(G){d=i(G,"P",{});var T=a(d);_=r(T,"To use private or "),c=i(T,"A",{href:!0,rel:!0});var W=a(c);m=r(W,"gated models"),W.forEach(t),v=r(T,`, log-in with
`),l=i(T,"CODE",{});var V=a(l);h=r(V,"huggingface-cli login"),V.forEach(t),U=r(T,"."),T.forEach(t),this.h()},h(){g(c,"href","https://huggingface.co/docs/hub/models-gated#gated-models"),g(c,"rel","nofollow")},m(G,T){k(G,d,T),e(d,_),e(d,c),e(c,m),e(d,v),e(d,l),e(l,h),e(d,U)},d(G){G&&t(d)}}}function Zi(Z){let d,_,c,m,v;return m=new Nn({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(){d=n("p"),_=s("Examples:"),c=p(),w(m.$$.fragment)},l(l){d=i(l,"P",{});var h=a(d);_=r(h,"Examples:"),h.forEach(t),c=f(l),$(m.$$.fragment,l)},m(l,h){k(l,d,h),e(d,_),k(l,c,h),x(m,l,h),v=!0},p:Cn,i(l){v||(P(m.$$.fragment,l),v=!0)},o(l){D(m.$$.fragment,l),v=!1},d(l){l&&t(d),l&&t(c),E(m,l)}}}function Ui(Z){let d,_,c,m,v,l,h,U,G,T,W,V,C;return{c(){d=n("p"),_=s("It is required to be logged in ("),c=n("code"),m=s("huggingface-cli login"),v=s(") when you want to use private or "),l=n("a"),h=s(`gated
models`),U=s(", "),G=n("em"),T=s("e.g."),W=p(),V=n("code"),C=s('"runwayml/stable-diffusion-v1-5"'),this.h()},l(Y){d=i(Y,"P",{});var j=a(d);_=r(j,"It is required to be logged in ("),c=i(j,"CODE",{});var N=a(c);m=r(N,"huggingface-cli login"),N.forEach(t),v=r(j,") when you want to use private or "),l=i(j,"A",{href:!0,rel:!0});var Je=a(l);h=r(Je,`gated
models`),Je.forEach(t),U=r(j,", "),G=i(j,"EM",{});var Xe=a(G);T=r(Xe,"e.g."),Xe.forEach(t),W=f(j),V=i(j,"CODE",{});var ce=a(V);C=r(ce,'"runwayml/stable-diffusion-v1-5"'),ce.forEach(t),j.forEach(t),this.h()},h(){g(l,"href","https://huggingface.co/docs/hub/models-gated#gated-models"),g(l,"rel","nofollow")},m(Y,j){k(Y,d,j),e(d,_),e(d,c),e(c,m),e(d,v),e(d,l),e(l,h),e(d,U),e(d,G),e(G,T),e(d,W),e(d,V),e(V,C)},d(Y){Y&&t(d)}}}function Ii(Z){let d,_,c,m,v;return{c(){d=n("p"),_=s("Activate the special "),c=n("a"),m=s("\u201Coffline-mode\u201D"),v=s(` to use
this method in a firewalled environment.`),this.h()},l(l){d=i(l,"P",{});var h=a(d);_=r(h,"Activate the special "),c=i(h,"A",{href:!0,rel:!0});var U=a(c);m=r(U,"\u201Coffline-mode\u201D"),U.forEach(t),v=r(h,` to use
this method in a firewalled environment.`),h.forEach(t),this.h()},h(){g(c,"href","https://huggingface.co/diffusers/installation.html#offline-mode"),g(c,"rel","nofollow")},m(l,h){k(l,d,h),e(d,_),e(d,c),e(c,m),e(d,v)},d(l){l&&t(d)}}}function Gi(Z){let d,_,c,m,v;return m=new Nn({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(){d=n("p"),_=s("Examples:"),c=p(),w(m.$$.fragment)},l(l){d=i(l,"P",{});var h=a(d);_=r(h,"Examples:"),h.forEach(t),c=f(l),$(m.$$.fragment,l)},m(l,h){k(l,d,h),e(d,_),k(l,c,h),x(m,l,h),v=!0},p:Cn,i(l){v||(P(m.$$.fragment,l),v=!0)},o(l){D(m.$$.fragment,l),v=!1},d(l){l&&t(d),l&&t(c),E(m,l)}}}function ji(Z){let d,_,c,m,v,l,h,U,G,T,W,V,C,Y,j,N,Je,Xe,ce,z,Mt,B,zt,Ve,Ht,Qt,Be,Ot,Kt,ze,eo,to,Tt,H,oo,Ce,no,io,Wt,q,Q,He,me,ao,Qe,so,Zt,u,ue,ro,Oe,lo,po,Ne,Ae,fo,co,mo,he,Ke,uo,ho,et,go,bo,tt,_o,vo,ge,O,ot,yo,wo,nt,$o,xo,Po,K,it,Do,Eo,at,ko,Mo,To,ee,be,Wo,st,Zo,Uo,Se,_e,Io,Re,ve,Go,A,ye,jo,we,Jo,rt,Xo,Vo,Bo,te,Co,oe,$e,No,xe,Ao,lt,So,Ro,Fo,ne,Pe,Yo,dt,qo,Lo,S,De,zo,pt,Ho,Qo,ie,Oo,R,Ee,Ko,ft,en,tn,ct,on,nn,J,ke,an,mt,sn,rn,ut,ln,dn,ht,pn,fn,ae,cn,M,Me,mn,gt,un,hn,Te,gn,bt,bn,_n,vn,We,yn,_t,wn,$n,xn,Ze,Pn,vt,Dn,En,kn,se,Mn,re,Tn,le,Wn,de,Ue,Zn,yt,Un,In,pe,Ie,Gn,Ge,jn,Fe,Jn,Xn,Ut;return l=new $i({}),z=new Lt({props:{$$slots:{default:[Mi]},$$scope:{ctx:Z}}}),me=new $i({}),ue=new X({props:{name:"class diffusers.DiffusionPipeline",anchor:"diffusers.DiffusionPipeline",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/pipeline_utils.py#L459"}}),be=new X({props:{name:"__call__",anchor:"diffusers.DiffusionPipeline.__call__",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}]}}),_e=new X({props:{name:"device",anchor:"diffusers.DiffusionPipeline.device",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/pipeline_utils.py#L699",returnDescription:`
<p>The torch device on which the pipeline is located.</p>
`,returnType:`
<p><code>torch.device</code></p>
`}}),ve=new X({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.17.0/src/diffusers/pipelines/pipeline_utils.py#L624"}}),ye=new X({props:{name:"components",anchor:"diffusers.DiffusionPipeline.components",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/pipeline_utils.py#L1372",returnDescription:`
<p>A dictionary containing all the modules needed to initialize the pipeline.</p>
`}}),te=new Bn({props:{anchor:"diffusers.DiffusionPipeline.components.example",$$slots:{default:[Ti]},$$scope:{ctx:Z}}}),$e=new X({props:{name:"disable_attention_slicing",anchor:"diffusers.DiffusionPipeline.disable_attention_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/pipeline_utils.py#L1508"}}),Pe=new X({props:{name:"disable_xformers_memory_efficient_attention",anchor:"diffusers.DiffusionPipeline.disable_xformers_memory_efficient_attention",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/pipeline_utils.py#L1466"}}),De=new X({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 repository id (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 repository id (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 False, 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(bool,",description:`<strong>local_files_only(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to only load local model weights and configuration files or not. If set to True, the model
won&#x2019;t be downloaded from the Hub.`,name:"local_files_only(bool,"},{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> when loading from the Hub and to local version of &#x2014;",name:"custom_revision"},{anchor:"diffusers.DiffusionPipeline.download.diffusers",description:`<strong><code>diffusers</code></strong> when loading from GitHub) &#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 diffusers version when loading a
custom pipeline from GitHub.`,name:"diffusers"},{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.17.0/src/diffusers/pipelines/pipeline_utils.py#L1111",returnDescription:`
<p>A path to the downloaded pipeline.</p>
`,returnType:`
<p><code>os.PathLike</code></p>
`}}),ie=new Lt({props:{$$slots:{default:[Wi]},$$scope:{ctx:Z}}}),Ee=new X({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.17.0/src/diffusers/pipelines/pipeline_utils.py#L1492"}}),ke=new X({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.17.0/src/diffusers/pipelines/pipeline_utils.py#L1434"}}),ae=new Bn({props:{anchor:"diffusers.DiffusionPipeline.enable_xformers_memory_efficient_attention.example",$$slots:{default:[Zi]},$$scope:{ctx:Z}}}),Me=new X({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> of a pretrained pipeline hosted inside a model repo on
<a href="https://huggingface.co/" rel="nofollow">https://huggingface.co/</a> Valid repo ids have to be located under a user or organization name, like
<code>CompVis/ldm-text2im-large-256</code>.</li>
<li>A path to a <em>directory</em> containing pipeline weights saved using
<a href="/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.save_pretrained">save_pretrained()</a>, e.g., <code>./my_pipeline_directory/</code>.</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 under this dtype. If <code>&quot;auto&quot;</code> is passed the dtype
will be 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>This is an experimental feature and is likely to change in the future.</p>

					</div>
<p>Can be either:</p>
<ul>
<li>
<p>A string, the <em>repo id</em> of a custom pipeline hosted inside a model repo on
<a href="https://huggingface.co/" rel="nofollow">https://huggingface.co/</a>. Valid repo ids have to be located under a user or organization name,
like <code>hf-internal-testing/diffusers-dummy-pipeline</code>.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>It is required that the model repo has a file, called <code>pipeline.py</code> that defines the custom
pipeline.</p>

					</div>
</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">https://github.com/huggingface/diffusers/tree/main/examples/community</a>. Valid file names have to
match exactly the file name without <code>.py</code> located under the above link, <em>e.g.</em>
<code>clip_guided_stable_diffusion</code>.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>Community pipelines are always loaded from the current <code>main</code> branch of GitHub.</p>

					</div>
</li>
<li>
<p>A path to a <em>directory</em> containing a custom pipeline, e.g., <code>./my_pipeline_directory/</code>.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>It is required that the directory has a file, called <code>pipeline.py</code> that defines the custom
pipeline.</p>

					</div>
</li>
</ul>
<p>For more information on how to load and create custom pipelines, please have a look at <a href="https://huggingface.co/docs/diffusers/using-diffusers/custom_pipeline_overview" rel="nofollow">Loading and
Adding Custom
Pipelines</a>`,name:"custom_pipeline"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.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.from_pretrained.cache_dir",description:`<strong>cache_dir</strong> (<code>Union[str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be used.`,name:"cache_dir"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.`,name:"resume_download"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.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, e.g., <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.from_pretrained.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.from_pretrained.local_files_only(bool,",description:`<strong>local_files_only(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to only look at local files (i.e., do not try to download the model).`,name:"local_files_only(bool,"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.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>, will use the token generated
when running <code>huggingface-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"use_auth_token"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.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, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so <code>revision</code> can be any
identifier allowed by git.`,name:"revision"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.custom_revision",description:`<strong>custom_revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code> when loading from the Hub and to local version of <code>diffusers</code> when loading from GitHub) &#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 diffusers version when loading a
custom pipeline from GitHub.`,name:"custom_revision"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.mirror",description:`<strong>mirror</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Mirror source to accelerate downloads in China. If you are from China and have an accessibility
problem, you can set this option to resolve it. Note that we do not guarantee the timeliness or safety.
Please refer to the mirror site for more information. specify the folder name here.`,name:"mirror"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.device_map",description:`<strong>device_map</strong> (<code>str</code> or <code>Dict[str, Union[int, str, torch.device]]</code>, <em>optional</em>) &#x2014;
A map that specifies where each submodule should go. It doesn&#x2019;t need to be refined to each
parameter/buffer name, once a given module name is inside, every submodule of it will be sent to the
same device.</p>
<p>To have Accelerate compute the most optimized <code>device_map</code> automatically, set <code>device_map=&quot;auto&quot;</code>. For
more information about each option see <a href="https://hf.co/docs/accelerate/main/en/usage_guides/big_modeling#designing-a-device-map" rel="nofollow">designing a device
map</a>.`,name:"device_map"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.max_memory",description:`<strong>max_memory</strong> (<code>Dict</code>, <em>optional</em>) &#x2014;
A dictionary device identifier to maximum memory. Will default to the maximum memory available for each
GPU and the available CPU RAM if unset.`,name:"max_memory"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.offload_folder",description:`<strong>offload_folder</strong> (<code>str</code> or <code>os.PathLike</code>, <em>optional</em>) &#x2014;
If the <code>device_map</code> contains any value <code>&quot;disk&quot;</code>, the folder where we will offload weights.`,name:"offload_folder"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.offload_state_dict",description:`<strong>offload_state_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If <code>True</code>, will temporarily offload the CPU state dict to the hard drive to avoid getting out of CPU
RAM if the weight of the CPU state dict + the biggest shard of the checkpoint does not fit. Defaults to
<code>True</code> when there is some disk offload.`,name:"offload_state_dict"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.low_cpu_mem_usage",description:`<strong>low_cpu_mem_usage</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code> if torch version &gt;= 1.9.0 else <code>False</code>) &#x2014;
Speed up model loading by not initializing the weights and only loading the pre-trained weights. This
also tries to not use more than 1x model size in CPU memory (including peak memory) while loading the
model. This is only supported when torch version &gt;= 1.9.0. If you are using an older version of torch,
setting this argument to <code>True</code> will raise an error.`,name:"low_cpu_mem_usage"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.use_safetensors",description:`<strong>use_safetensors</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
If set to <code>None</code>, the pipeline will load the <code>safetensors</code> weights if they&#x2019;re available <strong>and</strong> if the
<code>safetensors</code> library is installed. If set to <code>True</code>, the pipeline will forcibly load the models from
<code>safetensors</code> weights. If set to <code>False</code> the pipeline will <em>not</em> use <code>safetensors</code>.`,name:"use_safetensors"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.kwargs",description:`<strong>kwargs</strong> (remaining dictionary of keyword arguments, <em>optional</em>) &#x2014;
Can be used to overwrite load - and saveable variables - <em>i.e.</em> the pipeline components - of the
specific pipeline class. The overwritten components are then directly passed to the pipelines
<code>__init__</code> method. See example below for more information.`,name:"kwargs"},{anchor:"diffusers.DiffusionPipeline.from_pretrained.variant",description:`<strong>variant</strong> (<code>str</code>, <em>optional</em>) &#x2014;
If specified load weights from <code>variant</code> filename, <em>e.g.</em> pytorch_model.<variant>.bin. <code>variant</code> is
ignored when using <code>from_flax</code>.</variant>`,name:"variant"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/pipeline_utils.py#L714"}}),se=new Lt({props:{$$slots:{default:[Ui]},$$scope:{ctx:Z}}}),re=new Lt({props:{$$slots:{default:[Ii]},$$scope:{ctx:Z}}}),le=new Bn({props:{anchor:"diffusers.DiffusionPipeline.from_pretrained.example",$$slots:{default:[Gi]},$$scope:{ctx:Z}}}),Ue=new X({props:{name:"numpy_to_pil",anchor:"diffusers.DiffusionPipeline.numpy_to_pil",parameters:[{name:"images",val:""}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/pipeline_utils.py#L1409"}}),Ie=new X({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 which to save. 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 (that uses <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 pytorch_model.<variant>.bin.</variant>`,name:"variant"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/pipeline_utils.py#L537"}}),{c(){d=n("meta"),_=p(),c=n("h1"),m=n("a"),v=n("span"),w(l.$$.fragment),h=p(),U=n("span"),G=s("Pipelines"),T=p(),W=n("p"),V=s("The "),C=n("a"),Y=s("DiffusionPipeline"),j=s(" is the easiest way to load any pretrained diffusion pipeline from the "),N=n("a"),Je=s("Hub"),Xe=s(" and use it for inference."),ce=p(),w(z.$$.fragment),Mt=p(),B=n("p"),zt=s("The pipeline type (for example "),Ve=n("a"),Ht=s("StableDiffusionPipeline"),Qt=s(") of any diffusion pipeline loaded with "),Be=n("a"),Ot=s("from_pretrained()"),Kt=s(` is automatically
detected and pipeline components are loaded and passed to the `),ze=n("code"),eo=s("__init__"),to=s(" function of the pipeline."),Tt=p(),H=n("p"),oo=s("Any pipeline object can be saved locally with "),Ce=n("a"),no=s("save_pretrained()"),io=s("."),Wt=p(),q=n("h2"),Q=n("a"),He=n("span"),w(me.$$.fragment),ao=p(),Qe=n("span"),so=s("DiffusionPipeline"),Zt=p(),u=n("div"),w(ue.$$.fragment),ro=p(),Oe=n("p"),lo=s("Base class for all models."),po=p(),Ne=n("p"),Ae=n("a"),fo=s("DiffusionPipeline"),co=s(` takes care of storing all components (models, schedulers, processors) for diffusion pipelines
and handles methods for loading, downloading and saving models as well as a few methods common to all pipelines to:`),mo=p(),he=n("ul"),Ke=n("li"),uo=s("move all PyTorch modules to the device of your choice"),ho=p(),et=n("li"),go=s("enabling/disabling the progress bar for the denoising iteration"),bo=p(),tt=n("p"),_o=s("Class attributes:"),vo=p(),ge=n("ul"),O=n("li"),ot=n("strong"),yo=s("config_name"),wo=s(" ("),nt=n("code"),$o=s("str"),xo=s(`) \u2014 name of the config file that will store the class and module names of all
components of the diffusion pipeline.`),Po=p(),K=n("li"),it=n("strong"),Do=s("_optional_components"),Eo=s(" (List"),at=n("code"),ko=s("str"),Mo=s(`) \u2014 list of all components that are optional so they don\u2019t have to be
passed for the pipeline to function (should be overridden by subclasses).`),To=p(),ee=n("div"),w(be.$$.fragment),Wo=p(),st=n("p"),Zo=s("Call self as a function."),Uo=p(),Se=n("div"),w(_e.$$.fragment),Io=p(),Re=n("div"),w(ve.$$.fragment),Go=p(),A=n("div"),w(ye.$$.fragment),jo=p(),we=n("p"),Jo=s("The "),rt=n("code"),Xo=s("self.components"),Vo=s(` property can be useful to run different pipelines with the same weights and
configurations to not have to re-allocate memory.`),Bo=p(),w(te.$$.fragment),Co=p(),oe=n("div"),w($e.$$.fragment),No=p(),xe=n("p"),Ao=s("Disable sliced attention computation. If "),lt=n("code"),So=s("enable_attention_slicing"),Ro=s(` was previously invoked, this method will go
back to computing attention in one step.`),Fo=p(),ne=n("div"),w(Pe.$$.fragment),Yo=p(),dt=n("p"),qo=s("Disable memory efficient attention as implemented in xformers."),Lo=p(),S=n("div"),w(De.$$.fragment),zo=p(),pt=n("p"),Ho=s("Download and cache a PyTorch diffusion pipeline from pretrained pipeline weights."),Qo=p(),w(ie.$$.fragment),Oo=p(),R=n("div"),w(Ee.$$.fragment),Ko=p(),ft=n("p"),en=s("Enable sliced attention computation."),tn=p(),ct=n("p"),on=s(`When this option is enabled, the attention module will split 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.`),nn=p(),J=n("div"),w(ke.$$.fragment),an=p(),mt=n("p"),sn=s("Enable memory efficient attention as implemented in xformers."),rn=p(),ut=n("p"),ln=s(`When this option is enabled, you should observe lower GPU memory usage and a potential speed up at inference
time. Speed up at training time is not guaranteed.`),dn=p(),ht=n("p"),pn=s(`Warning: When Memory Efficient Attention and Sliced attention are both enabled, the Memory Efficient Attention
is used.`),fn=p(),w(ae.$$.fragment),cn=p(),M=n("div"),w(Me.$$.fragment),mn=p(),gt=n("p"),un=s("Instantiate a PyTorch diffusion pipeline from pre-trained pipeline weights."),hn=p(),Te=n("p"),gn=s("The pipeline is set in evaluation mode by default using "),bt=n("code"),bn=s("model.eval()"),_n=s(" (Dropout modules are deactivated)."),vn=p(),We=n("p"),yn=s("The warning "),_t=n("em"),wn=s("Weights from XXX not initialized from pretrained model"),$n=s(` means that the weights of XXX do not come
pretrained with the rest of the model. It is up to you to train those weights with a downstream fine-tuning
task.`),xn=p(),Ze=n("p"),Pn=s("The warning "),vt=n("em"),Dn=s("Weights from XXX not used in YYY"),En=s(` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),kn=p(),w(se.$$.fragment),Mn=p(),w(re.$$.fragment),Tn=p(),w(le.$$.fragment),Wn=p(),de=n("div"),w(Ue.$$.fragment),Zn=p(),yt=n("p"),Un=s("Convert a numpy image or a batch of images to a PIL image."),In=p(),pe=n("div"),w(Ie.$$.fragment),Gn=p(),Ge=n("p"),jn=s(`Save all variables of the pipeline that can be saved and loaded as well as the pipelines configuration file to
a directory. A pipeline variable can be saved and loaded if its class implements both a save and loading
method. The pipeline can easily be re-loaded using the `),Fe=n("a"),Jn=s("from_pretrained()"),Xn=s(" class method."),this.h()},l(o){const y=Ei('[data-svelte="svelte-1phssyn"]',document.head);d=i(y,"META",{name:!0,content:!0}),y.forEach(t),_=f(o),c=i(o,"H1",{class:!0});var je=a(c);m=i(je,"A",{id:!0,class:!0,href:!0});var wt=a(m);v=i(wt,"SPAN",{});var $t=a(v);$(l.$$.fragment,$t),$t.forEach(t),wt.forEach(t),h=f(je),U=i(je,"SPAN",{});var xt=a(U);G=r(xt,"Pipelines"),xt.forEach(t),je.forEach(t),T=f(o),W=i(o,"P",{});var L=a(W);V=r(L,"The "),C=i(L,"A",{href:!0});var Pt=a(C);Y=r(Pt,"DiffusionPipeline"),Pt.forEach(t),j=r(L," is the easiest way to load any pretrained diffusion pipeline from the "),N=i(L,"A",{href:!0,rel:!0});var Dt=a(N);Je=r(Dt,"Hub"),Dt.forEach(t),Xe=r(L," and use it for inference."),L.forEach(t),ce=f(o),$(z.$$.fragment,o),Mt=f(o),B=i(o,"P",{});var fe=a(B);zt=r(fe,"The pipeline type (for example "),Ve=i(fe,"A",{href:!0});var An=a(Ve);Ht=r(An,"StableDiffusionPipeline"),An.forEach(t),Qt=r(fe,") of any diffusion pipeline loaded with "),Be=i(fe,"A",{href:!0});var Sn=a(Be);Ot=r(Sn,"from_pretrained()"),Sn.forEach(t),Kt=r(fe,` is automatically
detected and pipeline components are loaded and passed to the `),ze=i(fe,"CODE",{});var Rn=a(ze);eo=r(Rn,"__init__"),Rn.forEach(t),to=r(fe," function of the pipeline."),fe.forEach(t),Tt=f(o),H=i(o,"P",{});var It=a(H);oo=r(It,"Any pipeline object can be saved locally with "),Ce=i(It,"A",{href:!0});var Fn=a(Ce);no=r(Fn,"save_pretrained()"),Fn.forEach(t),io=r(It,"."),It.forEach(t),Wt=f(o),q=i(o,"H2",{class:!0});var Gt=a(q);Q=i(Gt,"A",{id:!0,class:!0,href:!0});var Yn=a(Q);He=i(Yn,"SPAN",{});var qn=a(He);$(me.$$.fragment,qn),qn.forEach(t),Yn.forEach(t),ao=f(Gt),Qe=i(Gt,"SPAN",{});var Ln=a(Qe);so=r(Ln,"DiffusionPipeline"),Ln.forEach(t),Gt.forEach(t),Zt=f(o),u=i(o,"DIV",{class:!0});var b=a(u);$(ue.$$.fragment,b),ro=f(b),Oe=i(b,"P",{});var zn=a(Oe);lo=r(zn,"Base class for all models."),zn.forEach(t),po=f(b),Ne=i(b,"P",{});var Vn=a(Ne);Ae=i(Vn,"A",{href:!0});var Hn=a(Ae);fo=r(Hn,"DiffusionPipeline"),Hn.forEach(t),co=r(Vn,` takes care of storing all components (models, schedulers, processors) for diffusion pipelines
and handles methods for loading, downloading and saving models as well as a few methods common to all pipelines to:`),Vn.forEach(t),mo=f(b),he=i(b,"UL",{});var jt=a(he);Ke=i(jt,"LI",{});var Qn=a(Ke);uo=r(Qn,"move all PyTorch modules to the device of your choice"),Qn.forEach(t),ho=f(jt),et=i(jt,"LI",{});var On=a(et);go=r(On,"enabling/disabling the progress bar for the denoising iteration"),On.forEach(t),jt.forEach(t),bo=f(b),tt=i(b,"P",{});var Kn=a(tt);_o=r(Kn,"Class attributes:"),Kn.forEach(t),vo=f(b),ge=i(b,"UL",{});var Jt=a(ge);O=i(Jt,"LI",{});var Et=a(O);ot=i(Et,"STRONG",{});var ei=a(ot);yo=r(ei,"config_name"),ei.forEach(t),wo=r(Et," ("),nt=i(Et,"CODE",{});var ti=a(nt);$o=r(ti,"str"),ti.forEach(t),xo=r(Et,`) \u2014 name of the config file that will store the class and module names of all
components of the diffusion pipeline.`),Et.forEach(t),Po=f(Jt),K=i(Jt,"LI",{});var kt=a(K);it=i(kt,"STRONG",{});var oi=a(it);Do=r(oi,"_optional_components"),oi.forEach(t),Eo=r(kt," (List"),at=i(kt,"CODE",{});var ni=a(at);ko=r(ni,"str"),ni.forEach(t),Mo=r(kt,`) \u2014 list of all components that are optional so they don\u2019t have to be
passed for the pipeline to function (should be overridden by subclasses).`),kt.forEach(t),Jt.forEach(t),To=f(b),ee=i(b,"DIV",{class:!0});var Xt=a(ee);$(be.$$.fragment,Xt),Wo=f(Xt),st=i(Xt,"P",{});var ii=a(st);Zo=r(ii,"Call self as a function."),ii.forEach(t),Xt.forEach(t),Uo=f(b),Se=i(b,"DIV",{class:!0});var ai=a(Se);$(_e.$$.fragment,ai),ai.forEach(t),Io=f(b),Re=i(b,"DIV",{class:!0});var si=a(Re);$(ve.$$.fragment,si),si.forEach(t),Go=f(b),A=i(b,"DIV",{class:!0});var Ye=a(A);$(ye.$$.fragment,Ye),jo=f(Ye),we=i(Ye,"P",{});var Vt=a(we);Jo=r(Vt,"The "),rt=i(Vt,"CODE",{});var ri=a(rt);Xo=r(ri,"self.components"),ri.forEach(t),Vo=r(Vt,` property can be useful to run different pipelines with the same weights and
configurations to not have to re-allocate memory.`),Vt.forEach(t),Bo=f(Ye),$(te.$$.fragment,Ye),Ye.forEach(t),Co=f(b),oe=i(b,"DIV",{class:!0});var Bt=a(oe);$($e.$$.fragment,Bt),No=f(Bt),xe=i(Bt,"P",{});var Ct=a(xe);Ao=r(Ct,"Disable sliced attention computation. If "),lt=i(Ct,"CODE",{});var li=a(lt);So=r(li,"enable_attention_slicing"),li.forEach(t),Ro=r(Ct,` was previously invoked, this method will go
back to computing attention in one step.`),Ct.forEach(t),Bt.forEach(t),Fo=f(b),ne=i(b,"DIV",{class:!0});var Nt=a(ne);$(Pe.$$.fragment,Nt),Yo=f(Nt),dt=i(Nt,"P",{});var di=a(dt);qo=r(di,"Disable memory efficient attention as implemented in xformers."),di.forEach(t),Nt.forEach(t),Lo=f(b),S=i(b,"DIV",{class:!0});var qe=a(S);$(De.$$.fragment,qe),zo=f(qe),pt=i(qe,"P",{});var pi=a(pt);Ho=r(pi,"Download and cache a PyTorch diffusion pipeline from pretrained pipeline weights."),pi.forEach(t),Qo=f(qe),$(ie.$$.fragment,qe),qe.forEach(t),Oo=f(b),R=i(b,"DIV",{class:!0});var Le=a(R);$(Ee.$$.fragment,Le),Ko=f(Le),ft=i(Le,"P",{});var fi=a(ft);en=r(fi,"Enable sliced attention computation."),fi.forEach(t),tn=f(Le),ct=i(Le,"P",{});var ci=a(ct);on=r(ci,`When this option is enabled, the attention module will split 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.`),ci.forEach(t),Le.forEach(t),nn=f(b),J=i(b,"DIV",{class:!0});var F=a(J);$(ke.$$.fragment,F),an=f(F),mt=i(F,"P",{});var mi=a(mt);sn=r(mi,"Enable memory efficient attention as implemented in xformers."),mi.forEach(t),rn=f(F),ut=i(F,"P",{});var ui=a(ut);ln=r(ui,`When this option is enabled, you should observe lower GPU memory usage and a potential speed up at inference
time. Speed up at training time is not guaranteed.`),ui.forEach(t),dn=f(F),ht=i(F,"P",{});var hi=a(ht);pn=r(hi,`Warning: When Memory Efficient Attention and Sliced attention are both enabled, the Memory Efficient Attention
is used.`),hi.forEach(t),fn=f(F),$(ae.$$.fragment,F),F.forEach(t),cn=f(b),M=i(b,"DIV",{class:!0});var I=a(M);$(Me.$$.fragment,I),mn=f(I),gt=i(I,"P",{});var gi=a(gt);un=r(gi,"Instantiate a PyTorch diffusion pipeline from pre-trained pipeline weights."),gi.forEach(t),hn=f(I),Te=i(I,"P",{});var At=a(Te);gn=r(At,"The pipeline is set in evaluation mode by default using "),bt=i(At,"CODE",{});var bi=a(bt);bn=r(bi,"model.eval()"),bi.forEach(t),_n=r(At," (Dropout modules are deactivated)."),At.forEach(t),vn=f(I),We=i(I,"P",{});var St=a(We);yn=r(St,"The warning "),_t=i(St,"EM",{});var _i=a(_t);wn=r(_i,"Weights from XXX not initialized from pretrained model"),_i.forEach(t),$n=r(St,` means that the weights of XXX do not come
pretrained with the rest of the model. It is up to you to train those weights with a downstream fine-tuning
task.`),St.forEach(t),xn=f(I),Ze=i(I,"P",{});var Rt=a(Ze);Pn=r(Rt,"The warning "),vt=i(Rt,"EM",{});var vi=a(vt);Dn=r(vi,"Weights from XXX not used in YYY"),vi.forEach(t),En=r(Rt,` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),Rt.forEach(t),kn=f(I),$(se.$$.fragment,I),Mn=f(I),$(re.$$.fragment,I),Tn=f(I),$(le.$$.fragment,I),I.forEach(t),Wn=f(b),de=i(b,"DIV",{class:!0});var Ft=a(de);$(Ue.$$.fragment,Ft),Zn=f(Ft),yt=i(Ft,"P",{});var yi=a(yt);Un=r(yi,"Convert a numpy image or a batch of images to a PIL image."),yi.forEach(t),Ft.forEach(t),In=f(b),pe=i(b,"DIV",{class:!0});var Yt=a(pe);$(Ie.$$.fragment,Yt),Gn=f(Yt),Ge=i(Yt,"P",{});var qt=a(Ge);jn=r(qt,`Save all variables of the pipeline that can be saved and loaded as well as the pipelines configuration file to
a directory. A pipeline variable can be saved and loaded if its class implements both a save and loading
method. The pipeline can easily be re-loaded using the `),Fe=i(qt,"A",{href:!0});var wi=a(Fe);Jn=r(wi,"from_pretrained()"),wi.forEach(t),Xn=r(qt," class method."),qt.forEach(t),Yt.forEach(t),b.forEach(t),this.h()},h(){g(d,"name","hf:doc:metadata"),g(d,"content",JSON.stringify(Ji)),g(m,"id","pipelines"),g(m,"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"),g(m,"href","#pipelines"),g(c,"class","relative group"),g(C,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),g(N,"href","https://huggingface.co/models?library=diffusers"),g(N,"rel","nofollow"),g(Ve,"href","/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),g(Be,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),g(Ce,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.save_pretrained"),g(Q,"id","diffusers.DiffusionPipeline"),g(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"),g(Q,"href","#diffusers.DiffusionPipeline"),g(q,"class","relative group"),g(Ae,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),g(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(Fe,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),g(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),g(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,y){e(document.head,d),k(o,_,y),k(o,c,y),e(c,m),e(m,v),x(l,v,null),e(c,h),e(c,U),e(U,G),k(o,T,y),k(o,W,y),e(W,V),e(W,C),e(C,Y),e(W,j),e(W,N),e(N,Je),e(W,Xe),k(o,ce,y),x(z,o,y),k(o,Mt,y),k(o,B,y),e(B,zt),e(B,Ve),e(Ve,Ht),e(B,Qt),e(B,Be),e(Be,Ot),e(B,Kt),e(B,ze),e(ze,eo),e(B,to),k(o,Tt,y),k(o,H,y),e(H,oo),e(H,Ce),e(Ce,no),e(H,io),k(o,Wt,y),k(o,q,y),e(q,Q),e(Q,He),x(me,He,null),e(q,ao),e(q,Qe),e(Qe,so),k(o,Zt,y),k(o,u,y),x(ue,u,null),e(u,ro),e(u,Oe),e(Oe,lo),e(u,po),e(u,Ne),e(Ne,Ae),e(Ae,fo),e(Ne,co),e(u,mo),e(u,he),e(he,Ke),e(Ke,uo),e(he,ho),e(he,et),e(et,go),e(u,bo),e(u,tt),e(tt,_o),e(u,vo),e(u,ge),e(ge,O),e(O,ot),e(ot,yo),e(O,wo),e(O,nt),e(nt,$o),e(O,xo),e(ge,Po),e(ge,K),e(K,it),e(it,Do),e(K,Eo),e(K,at),e(at,ko),e(K,Mo),e(u,To),e(u,ee),x(be,ee,null),e(ee,Wo),e(ee,st),e(st,Zo),e(u,Uo),e(u,Se),x(_e,Se,null),e(u,Io),e(u,Re),x(ve,Re,null),e(u,Go),e(u,A),x(ye,A,null),e(A,jo),e(A,we),e(we,Jo),e(we,rt),e(rt,Xo),e(we,Vo),e(A,Bo),x(te,A,null),e(u,Co),e(u,oe),x($e,oe,null),e(oe,No),e(oe,xe),e(xe,Ao),e(xe,lt),e(lt,So),e(xe,Ro),e(u,Fo),e(u,ne),x(Pe,ne,null),e(ne,Yo),e(ne,dt),e(dt,qo),e(u,Lo),e(u,S),x(De,S,null),e(S,zo),e(S,pt),e(pt,Ho),e(S,Qo),x(ie,S,null),e(u,Oo),e(u,R),x(Ee,R,null),e(R,Ko),e(R,ft),e(ft,en),e(R,tn),e(R,ct),e(ct,on),e(u,nn),e(u,J),x(ke,J,null),e(J,an),e(J,mt),e(mt,sn),e(J,rn),e(J,ut),e(ut,ln),e(J,dn),e(J,ht),e(ht,pn),e(J,fn),x(ae,J,null),e(u,cn),e(u,M),x(Me,M,null),e(M,mn),e(M,gt),e(gt,un),e(M,hn),e(M,Te),e(Te,gn),e(Te,bt),e(bt,bn),e(Te,_n),e(M,vn),e(M,We),e(We,yn),e(We,_t),e(_t,wn),e(We,$n),e(M,xn),e(M,Ze),e(Ze,Pn),e(Ze,vt),e(vt,Dn),e(Ze,En),e(M,kn),x(se,M,null),e(M,Mn),x(re,M,null),e(M,Tn),x(le,M,null),e(u,Wn),e(u,de),x(Ue,de,null),e(de,Zn),e(de,yt),e(yt,Un),e(u,In),e(u,pe),x(Ie,pe,null),e(pe,Gn),e(pe,Ge),e(Ge,jn),e(Ge,Fe),e(Fe,Jn),e(Ge,Xn),Ut=!0},p(o,[y]){const je={};y&2&&(je.$$scope={dirty:y,ctx:o}),z.$set(je);const wt={};y&2&&(wt.$$scope={dirty:y,ctx:o}),te.$set(wt);const $t={};y&2&&($t.$$scope={dirty:y,ctx:o}),ie.$set($t);const xt={};y&2&&(xt.$$scope={dirty:y,ctx:o}),ae.$set(xt);const L={};y&2&&(L.$$scope={dirty:y,ctx:o}),se.$set(L);const Pt={};y&2&&(Pt.$$scope={dirty:y,ctx:o}),re.$set(Pt);const Dt={};y&2&&(Dt.$$scope={dirty:y,ctx:o}),le.$set(Dt)},i(o){Ut||(P(l.$$.fragment,o),P(z.$$.fragment,o),P(me.$$.fragment,o),P(ue.$$.fragment,o),P(be.$$.fragment,o),P(_e.$$.fragment,o),P(ve.$$.fragment,o),P(ye.$$.fragment,o),P(te.$$.fragment,o),P($e.$$.fragment,o),P(Pe.$$.fragment,o),P(De.$$.fragment,o),P(ie.$$.fragment,o),P(Ee.$$.fragment,o),P(ke.$$.fragment,o),P(ae.$$.fragment,o),P(Me.$$.fragment,o),P(se.$$.fragment,o),P(re.$$.fragment,o),P(le.$$.fragment,o),P(Ue.$$.fragment,o),P(Ie.$$.fragment,o),Ut=!0)},o(o){D(l.$$.fragment,o),D(z.$$.fragment,o),D(me.$$.fragment,o),D(ue.$$.fragment,o),D(be.$$.fragment,o),D(_e.$$.fragment,o),D(ve.$$.fragment,o),D(ye.$$.fragment,o),D(te.$$.fragment,o),D($e.$$.fragment,o),D(Pe.$$.fragment,o),D(De.$$.fragment,o),D(ie.$$.fragment,o),D(Ee.$$.fragment,o),D(ke.$$.fragment,o),D(ae.$$.fragment,o),D(Me.$$.fragment,o),D(se.$$.fragment,o),D(re.$$.fragment,o),D(le.$$.fragment,o),D(Ue.$$.fragment,o),D(Ie.$$.fragment,o),Ut=!1},d(o){t(d),o&&t(_),o&&t(c),E(l),o&&t(T),o&&t(W),o&&t(ce),E(z,o),o&&t(Mt),o&&t(B),o&&t(Tt),o&&t(H),o&&t(Wt),o&&t(q),E(me),o&&t(Zt),o&&t(u),E(ue),E(be),E(_e),E(ve),E(ye),E(te),E($e),E(Pe),E(De),E(ie),E(Ee),E(ke),E(ae),E(Me),E(se),E(re),E(le),E(Ue),E(Ie)}}}const Ji={local:"pipelines",sections:[{local:"diffusers.DiffusionPipeline",title:"DiffusionPipeline"}],title:"Pipelines"};function Xi(Z){return ki(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ri extends xi{constructor(d){super();Pi(this,d,Xi,ji,Di,{})}}export{Ri as default,Ji as metadata};
