import{S as Ai,i as Li,s as Ci,e as i,k as f,w as D,t as s,M as qi,c as n,d as o,m as p,a,x as E,h as r,b as h,G as e,g as b,y as k,q as x,o as I,B as T,v as Oi,L as Si}from"../../chunks/vendor-hf-doc-builder.js";import{T as Go}from"../../chunks/Tip-hf-doc-builder.js";import{D as we}from"../../chunks/Docstring-hf-doc-builder.js";import{C as ji}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Ro}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Ti}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Xi(C){let d;return{c(){d=s("One should not use the Diffusion Pipeline class for training or fine-tuning a diffusion model. Individual \n	components of diffusion pipelines are usually trained individually, so we suggest to directly work \n	with `UNetModel` and `UNetConditionModel`.")},l(v){d=r(v,"One should not use the Diffusion Pipeline class for training or fine-tuning a diffusion model. Individual \n	components of diffusion pipelines are usually trained individually, so we suggest to directly work \n	with `UNetModel` and `UNetConditionModel`.")},m(v,c){b(v,d,c)},d(v){v&&o(d)}}}function zi(C){let d,v,c,m,y,l,g,q,M,W,A,N,O;return{c(){d=i("p"),v=s("It is required to be logged in ("),c=i("code"),m=s("huggingface-cli login"),y=s(") when you want to use private or "),l=i("a"),g=s(`gated
models`),q=s(", "),M=i("em"),W=s("e.g."),A=f(),N=i("code"),O=s('"runwayml/stable-diffusion-v1-5"'),this.h()},l(U){d=n(U,"P",{});var j=a(d);v=r(j,"It is required to be logged in ("),c=n(j,"CODE",{});var X=a(c);m=r(X,"huggingface-cli login"),X.forEach(o),y=r(j,") when you want to use private or "),l=n(j,"A",{href:!0,rel:!0});var Pe=a(l);g=r(Pe,`gated
models`),Pe.forEach(o),q=r(j,", "),M=n(j,"EM",{});var De=a(M);W=r(De,"e.g."),De.forEach(o),A=p(j),N=n(j,"CODE",{});var ne=a(N);O=r(ne,'"runwayml/stable-diffusion-v1-5"'),ne.forEach(o),j.forEach(o),this.h()},h(){h(l,"href","https://huggingface.co/docs/hub/models-gated#gated-models"),h(l,"rel","nofollow")},m(U,j){b(U,d,j),e(d,v),e(d,c),e(c,m),e(d,y),e(d,l),e(l,g),e(d,q),e(d,M),e(M,W),e(d,A),e(d,N),e(N,O)},d(U){U&&o(d)}}}function Mi(C){let d,v,c,m,y;return{c(){d=i("p"),v=s("Activate the special "),c=i("a"),m=s("\u201Coffline-mode\u201D"),y=s(` to use
this method in a firewalled environment.`),this.h()},l(l){d=n(l,"P",{});var g=a(d);v=r(g,"Activate the special "),c=n(g,"A",{href:!0,rel:!0});var q=a(c);m=r(q,"\u201Coffline-mode\u201D"),q.forEach(o),y=r(g,` to use
this method in a firewalled environment.`),g.forEach(o),this.h()},h(){h(c,"href","https://huggingface.co/diffusers/installation.html#offline-mode"),h(c,"rel","nofollow")},m(l,g){b(l,d,g),e(d,v),e(d,c),e(c,m),e(d,y)},d(l){l&&o(d)}}}function Ni(C){let d,v,c,m,y;return m=new ji({props:{code:`from diffusers import DiffusionPipeline

# Download pipeline from huggingface.co and cache.
pipeline = DiffusionPipeline.from_pretrained("CompVis/ldm-text2im-large-256")

# Download pipeline that requires an authorization token
# For more information on access tokens, please refer to this section
# of the documentation](https://huggingface.co/docs/hub/security-tokens)
pipeline = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")

# Use a different scheduler
from diffusers import LMSDiscreteScheduler

scheduler = LMSDiscreteScheduler.from_config(pipeline.scheduler.config)
pipeline.scheduler = scheduler`,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=i("p"),v=s("Examples:"),c=f(),D(m.$$.fragment)},l(l){d=n(l,"P",{});var g=a(d);v=r(g,"Examples:"),g.forEach(o),c=p(l),E(m.$$.fragment,l)},m(l,g){b(l,d,g),e(d,v),b(l,c,g),k(m,l,g),y=!0},p:Si,i(l){y||(x(m.$$.fragment,l),y=!0)},o(l){I(m.$$.fragment,l),y=!1},d(l){l&&o(d),l&&o(c),T(m,l)}}}function Ui(C){let d,v,c,m,y;return m=new ji({props:{code:`from diffusers import (
    StableDiffusionPipeline,
    StableDiffusionImg2ImgPipeline,
    StableDiffusionInpaintPipeline,
)

text2img = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
img2img = StableDiffusionImg2ImgPipeline(**text2img.components)
inpaint = StableDiffusionInpaintPipeline(**text2img.components)`,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=i("p"),v=s("Examples:"),c=f(),D(m.$$.fragment)},l(l){d=n(l,"P",{});var g=a(d);v=r(g,"Examples:"),g.forEach(o),c=p(l),E(m.$$.fragment,l)},m(l,g){b(l,d,g),e(d,v),b(l,c,g),k(m,l,g),y=!0},p:Si,i(l){y||(x(m.$$.fragment,l),y=!0)},o(l){I(m.$$.fragment,l),y=!1},d(l){l&&o(d),l&&o(c),T(m,l)}}}function Vi(C){let d,v,c,m,y,l,g,q,M,W,A,N,O,U,j,X,Pe,De,ne,B,at,P,kt,Ee,xt,It,Le,Tt,St,ke,jt,At,Ce,Lt,Ct,qe,qt,Ot,Oe,Xt,zt,lt,G,Mt,xe,Nt,Ut,dt,V,R,Xe,se,Vt,ze,Ft,ft,_,re,Ht,Me,Yt,Wt,Ie,Te,Bt,Gt,Rt,ae,Ne,Jt,Kt,Ue,Qt,Zt,Ve,eo,to,le,J,Fe,oo,io,He,no,so,ro,K,Ye,ao,lo,We,fo,po,co,w,de,mo,Be,uo,ho,fe,go,Ge,_o,vo,bo,pe,yo,Re,$o,wo,Po,ce,Do,Je,Eo,ko,xo,Q,Io,Z,To,ee,So,te,me,jo,ue,Ao,Ke,Lo,Co,qo,Se,he,Oo,je,ge,Xo,z,_e,zo,ve,Mo,Qe,No,Uo,Vo,oe,pt,F,ie,Ze,be,Fo,et,Ho,ct,H,ye,Yo,tt,Wo,mt;return l=new Ro({}),B=new Go({props:{$$slots:{default:[Xi]},$$scope:{ctx:C}}}),se=new Ro({}),re=new we({props:{name:"class diffusers.DiffusionPipeline",anchor:"diffusers.DiffusionPipeline",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.11.0/src/diffusers/pipeline_utils.py#L138"}}),de=new we({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.11.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.torch_dtype",description:"<strong>torch_dtype</strong> (<code>str</code> or <code>torch.dtype</code>, <em>optional</em>) &#x2014;",name:"torch_dtype"},{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.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.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.return_cached_folder",description:`<strong>return_cached_folder</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
If set to <code>True</code>, path to downloaded cached folder will be returned in addition to loaded pipeline.`,name:"return_cached_folder"},{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"}],source:"https://github.com/huggingface/diffusers/blob/v0.11.0/src/diffusers/pipeline_utils.py#L286"}}),Q=new Go({props:{$$slots:{default:[zi]},$$scope:{ctx:C}}}),Z=new Go({props:{$$slots:{default:[Mi]},$$scope:{ctx:C}}}),ee=new Ti({props:{anchor:"diffusers.DiffusionPipeline.from_pretrained.example",$$slots:{default:[Ni]},$$scope:{ctx:C}}}),me=new we({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"}],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"}],source:"https://github.com/huggingface/diffusers/blob/v0.11.0/src/diffusers/pipeline_utils.py#L191"}}),he=new we({props:{name:"to",anchor:"diffusers.DiffusionPipeline.to",parameters:[{name:"torch_device",val:": typing.Union[str, torch.device, NoneType] = None"}],source:"https://github.com/huggingface/diffusers/blob/v0.11.0/src/diffusers/pipeline_utils.py#L254"}}),ge=new we({props:{name:"device",anchor:"diffusers.DiffusionPipeline.device",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.11.0/src/diffusers/pipeline_utils.py#L273",returnDescription:`
<p>The torch device on which the pipeline is located.</p>
`,returnType:`
<p><code>torch.device</code></p>
`}}),_e=new we({props:{name:"components",anchor:"diffusers.DiffusionPipeline.components",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.11.0/src/diffusers/pipeline_utils.py#L743",returnDescription:`
<p>A dictionaly containing all the modules needed to initialize the pipeline.</p>
`}}),oe=new Ti({props:{anchor:"diffusers.DiffusionPipeline.components.example",$$slots:{default:[Ui]},$$scope:{ctx:C}}}),be=new Ro({}),ye=new we({props:{name:"class diffusers.pipeline_utils.ImagePipelineOutput",anchor:"diffusers.pipeline_utils.ImagePipelineOutput",parameters:[{name:"images",val:": typing.Union[typing.List[PIL.Image.Image], numpy.ndarray]"}],parametersDescription:[{anchor:"diffusers.pipeline_utils.ImagePipelineOutput.images",description:`<strong>images</strong> (<code>List[PIL.Image.Image]</code> or <code>np.ndarray</code>) &#x2014;
List of denoised PIL images of length <code>batch_size</code> or numpy array of shape <code>(batch_size, height, width, num_channels)</code>. PIL images or numpy array present the denoised images of the diffusion pipeline.`,name:"images"}],source:"https://github.com/huggingface/diffusers/blob/v0.11.0/src/diffusers/pipeline_utils.py#L94"}}),{c(){d=i("meta"),v=f(),c=i("h1"),m=i("a"),y=i("span"),D(l.$$.fragment),g=f(),q=i("span"),M=s("Pipelines"),W=f(),A=i("p"),N=s("The "),O=i("a"),U=s("DiffusionPipeline"),j=s(" is the easiest way to load any pretrained diffusion pipeline from the "),X=i("a"),Pe=s("Hub"),De=s(" and to use it in inference."),ne=f(),D(B.$$.fragment),at=f(),P=i("p"),kt=s("Any diffusion pipeline that is loaded with "),Ee=i("a"),xt=s("from_pretrained()"),It=s(` will automatically
detect the pipeline type, `),Le=i("em"),Tt=s("e.g."),St=f(),ke=i("a"),jt=s("StableDiffusionPipeline"),At=s(` and consequently load each component of the
pipeline and pass them into the `),Ce=i("code"),Lt=s("__init__"),Ct=s(" function of the pipeline, "),qe=i("em"),qt=s("e.g."),Ot=f(),Oe=i("code"),Xt=s("__init__()"),zt=s("."),lt=f(),G=i("p"),Mt=s("Any pipeline object can be saved locally with "),xe=i("a"),Nt=s("save_pretrained()"),Ut=s("."),dt=f(),V=i("h2"),R=i("a"),Xe=i("span"),D(se.$$.fragment),Vt=f(),ze=i("span"),Ft=s("DiffusionPipeline"),ft=f(),_=i("div"),D(re.$$.fragment),Ht=f(),Me=i("p"),Yt=s("Base class for all models."),Wt=f(),Ie=i("p"),Te=i("a"),Bt=s("DiffusionPipeline"),Gt=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:`),Rt=f(),ae=i("ul"),Ne=i("li"),Jt=s("move all PyTorch modules to the device of your choice"),Kt=f(),Ue=i("li"),Qt=s("enabling/disabling the progress bar for the denoising iteration"),Zt=f(),Ve=i("p"),eo=s("Class attributes:"),to=f(),le=i("ul"),J=i("li"),Fe=i("strong"),oo=s("config_name"),io=s(" ("),He=i("code"),no=s("str"),so=s(`) \u2014 name of the config file that will store the class and module names of all
components of the diffusion pipeline.`),ro=f(),K=i("li"),Ye=i("strong"),ao=s("_optional_components"),lo=s(" (List"),We=i("code"),fo=s("str"),po=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).`),co=f(),w=i("div"),D(de.$$.fragment),mo=f(),Be=i("p"),uo=s("Instantiate a PyTorch diffusion pipeline from pre-trained pipeline weights."),ho=f(),fe=i("p"),go=s("The pipeline is set in evaluation mode by default using "),Ge=i("code"),_o=s("model.eval()"),vo=s(" (Dropout modules are deactivated)."),bo=f(),pe=i("p"),yo=s("The warning "),Re=i("em"),$o=s("Weights from XXX not initialized from pretrained model"),wo=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.`),Po=f(),ce=i("p"),Do=s("The warning "),Je=i("em"),Eo=s("Weights from XXX not used in YYY"),ko=s(` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),xo=f(),D(Q.$$.fragment),Io=f(),D(Z.$$.fragment),To=f(),D(ee.$$.fragment),So=f(),te=i("div"),D(me.$$.fragment),jo=f(),ue=i("p"),Ao=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 `),Ke=i("code"),Lo=s("[from_pretrained()](/docs/diffusers/v0.11.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained)"),Co=s(" class method."),qo=f(),Se=i("div"),D(he.$$.fragment),Oo=f(),je=i("div"),D(ge.$$.fragment),Xo=f(),z=i("div"),D(_e.$$.fragment),zo=f(),ve=i("p"),Mo=s("The "),Qe=i("code"),No=s("self.components"),Uo=s(` property can be useful to run different pipelines with the same weights and
configurations to not have to re-allocate memory.`),Vo=f(),D(oe.$$.fragment),pt=f(),F=i("h2"),ie=i("a"),Ze=i("span"),D(be.$$.fragment),Fo=f(),et=i("span"),Ho=s("ImagePipelineOutput"),ct=s(`

By default diffusion pipelines return an object of class
`),H=i("div"),D(ye.$$.fragment),Yo=f(),tt=i("p"),Wo=s("Output class for image pipelines."),this.h()},l(t){const u=qi('[data-svelte="svelte-1phssyn"]',document.head);d=n(u,"META",{name:!0,content:!0}),u.forEach(o),v=p(t),c=n(t,"H1",{class:!0});var $e=a(c);m=n($e,"A",{id:!0,class:!0,href:!0});var ot=a(m);y=n(ot,"SPAN",{});var it=a(y);E(l.$$.fragment,it),it.forEach(o),ot.forEach(o),g=p($e),q=n($e,"SPAN",{});var nt=a(q);M=r(nt,"Pipelines"),nt.forEach(o),$e.forEach(o),W=p(t),A=n(t,"P",{});var Y=a(A);N=r(Y,"The "),O=n(Y,"A",{href:!0});var Jo=a(O);U=r(Jo,"DiffusionPipeline"),Jo.forEach(o),j=r(Y," is the easiest way to load any pretrained diffusion pipeline from the "),X=n(Y,"A",{href:!0,rel:!0});var Ko=a(X);Pe=r(Ko,"Hub"),Ko.forEach(o),De=r(Y," and to use it in inference."),Y.forEach(o),ne=p(t),E(B.$$.fragment,t),at=p(t),P=n(t,"P",{});var L=a(P);kt=r(L,"Any diffusion pipeline that is loaded with "),Ee=n(L,"A",{href:!0});var Qo=a(Ee);xt=r(Qo,"from_pretrained()"),Qo.forEach(o),It=r(L,` will automatically
detect the pipeline type, `),Le=n(L,"EM",{});var Zo=a(Le);Tt=r(Zo,"e.g."),Zo.forEach(o),St=p(L),ke=n(L,"A",{href:!0});var ei=a(ke);jt=r(ei,"StableDiffusionPipeline"),ei.forEach(o),At=r(L,` and consequently load each component of the
pipeline and pass them into the `),Ce=n(L,"CODE",{});var ti=a(Ce);Lt=r(ti,"__init__"),ti.forEach(o),Ct=r(L," function of the pipeline, "),qe=n(L,"EM",{});var oi=a(qe);qt=r(oi,"e.g."),oi.forEach(o),Ot=p(L),Oe=n(L,"CODE",{});var ii=a(Oe);Xt=r(ii,"__init__()"),ii.forEach(o),zt=r(L,"."),L.forEach(o),lt=p(t),G=n(t,"P",{});var ut=a(G);Mt=r(ut,"Any pipeline object can be saved locally with "),xe=n(ut,"A",{href:!0});var ni=a(xe);Nt=r(ni,"save_pretrained()"),ni.forEach(o),Ut=r(ut,"."),ut.forEach(o),dt=p(t),V=n(t,"H2",{class:!0});var ht=a(V);R=n(ht,"A",{id:!0,class:!0,href:!0});var si=a(R);Xe=n(si,"SPAN",{});var ri=a(Xe);E(se.$$.fragment,ri),ri.forEach(o),si.forEach(o),Vt=p(ht),ze=n(ht,"SPAN",{});var ai=a(ze);Ft=r(ai,"DiffusionPipeline"),ai.forEach(o),ht.forEach(o),ft=p(t),_=n(t,"DIV",{class:!0});var $=a(_);E(re.$$.fragment,$),Ht=p($),Me=n($,"P",{});var li=a(Me);Yt=r(li,"Base class for all models."),li.forEach(o),Wt=p($),Ie=n($,"P",{});var Bo=a(Ie);Te=n(Bo,"A",{href:!0});var di=a(Te);Bt=r(di,"DiffusionPipeline"),di.forEach(o),Gt=r(Bo,` 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:`),Bo.forEach(o),Rt=p($),ae=n($,"UL",{});var gt=a(ae);Ne=n(gt,"LI",{});var fi=a(Ne);Jt=r(fi,"move all PyTorch modules to the device of your choice"),fi.forEach(o),Kt=p(gt),Ue=n(gt,"LI",{});var pi=a(Ue);Qt=r(pi,"enabling/disabling the progress bar for the denoising iteration"),pi.forEach(o),gt.forEach(o),Zt=p($),Ve=n($,"P",{});var ci=a(Ve);eo=r(ci,"Class attributes:"),ci.forEach(o),to=p($),le=n($,"UL",{});var _t=a(le);J=n(_t,"LI",{});var st=a(J);Fe=n(st,"STRONG",{});var mi=a(Fe);oo=r(mi,"config_name"),mi.forEach(o),io=r(st," ("),He=n(st,"CODE",{});var ui=a(He);no=r(ui,"str"),ui.forEach(o),so=r(st,`) \u2014 name of the config file that will store the class and module names of all
components of the diffusion pipeline.`),st.forEach(o),ro=p(_t),K=n(_t,"LI",{});var rt=a(K);Ye=n(rt,"STRONG",{});var hi=a(Ye);ao=r(hi,"_optional_components"),hi.forEach(o),lo=r(rt," (List"),We=n(rt,"CODE",{});var gi=a(We);fo=r(gi,"str"),gi.forEach(o),po=r(rt,`) \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).`),rt.forEach(o),_t.forEach(o),co=p($),w=n($,"DIV",{class:!0});var S=a(w);E(de.$$.fragment,S),mo=p(S),Be=n(S,"P",{});var _i=a(Be);uo=r(_i,"Instantiate a PyTorch diffusion pipeline from pre-trained pipeline weights."),_i.forEach(o),ho=p(S),fe=n(S,"P",{});var vt=a(fe);go=r(vt,"The pipeline is set in evaluation mode by default using "),Ge=n(vt,"CODE",{});var vi=a(Ge);_o=r(vi,"model.eval()"),vi.forEach(o),vo=r(vt," (Dropout modules are deactivated)."),vt.forEach(o),bo=p(S),pe=n(S,"P",{});var bt=a(pe);yo=r(bt,"The warning "),Re=n(bt,"EM",{});var bi=a(Re);$o=r(bi,"Weights from XXX not initialized from pretrained model"),bi.forEach(o),wo=r(bt,` 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.`),bt.forEach(o),Po=p(S),ce=n(S,"P",{});var yt=a(ce);Do=r(yt,"The warning "),Je=n(yt,"EM",{});var yi=a(Je);Eo=r(yi,"Weights from XXX not used in YYY"),yi.forEach(o),ko=r(yt,` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),yt.forEach(o),xo=p(S),E(Q.$$.fragment,S),Io=p(S),E(Z.$$.fragment,S),To=p(S),E(ee.$$.fragment,S),S.forEach(o),So=p($),te=n($,"DIV",{class:!0});var $t=a(te);E(me.$$.fragment,$t),jo=p($t),ue=n($t,"P",{});var wt=a(ue);Ao=r(wt,`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 `),Ke=n(wt,"CODE",{});var $i=a(Ke);Lo=r($i,"[from_pretrained()](/docs/diffusers/v0.11.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained)"),$i.forEach(o),Co=r(wt," class method."),wt.forEach(o),$t.forEach(o),qo=p($),Se=n($,"DIV",{class:!0});var wi=a(Se);E(he.$$.fragment,wi),wi.forEach(o),Oo=p($),je=n($,"DIV",{class:!0});var Pi=a(je);E(ge.$$.fragment,Pi),Pi.forEach(o),Xo=p($),z=n($,"DIV",{class:!0});var Ae=a(z);E(_e.$$.fragment,Ae),zo=p(Ae),ve=n(Ae,"P",{});var Pt=a(ve);Mo=r(Pt,"The "),Qe=n(Pt,"CODE",{});var Di=a(Qe);No=r(Di,"self.components"),Di.forEach(o),Uo=r(Pt,` property can be useful to run different pipelines with the same weights and
configurations to not have to re-allocate memory.`),Pt.forEach(o),Vo=p(Ae),E(oe.$$.fragment,Ae),Ae.forEach(o),$.forEach(o),pt=p(t),F=n(t,"H2",{class:!0});var Dt=a(F);ie=n(Dt,"A",{id:!0,class:!0,href:!0});var Ei=a(ie);Ze=n(Ei,"SPAN",{});var ki=a(Ze);E(be.$$.fragment,ki),ki.forEach(o),Ei.forEach(o),Fo=p(Dt),et=n(Dt,"SPAN",{});var xi=a(et);Ho=r(xi,"ImagePipelineOutput"),xi.forEach(o),Dt.forEach(o),ct=r(t,`

By default diffusion pipelines return an object of class
`),H=n(t,"DIV",{class:!0});var Et=a(H);E(ye.$$.fragment,Et),Yo=p(Et),tt=n(Et,"P",{});var Ii=a(tt);Wo=r(Ii,"Output class for image pipelines."),Ii.forEach(o),Et.forEach(o),this.h()},h(){h(d,"name","hf:doc:metadata"),h(d,"content",JSON.stringify(Fi)),h(m,"id","pipelines"),h(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"),h(m,"href","#pipelines"),h(c,"class","relative group"),h(O,"href","/docs/diffusers/v0.11.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),h(X,"href","https://huggingface.co/models?library=diffusers"),h(X,"rel","nofollow"),h(Ee,"href","/docs/diffusers/v0.11.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),h(ke,"href","/docs/diffusers/v0.11.0/en/api/pipelines/stable_diffusion#diffusers.StableDiffusionPipeline"),h(xe,"href","/docs/diffusers/v0.11.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.save_pretrained"),h(R,"id","diffusers.DiffusionPipeline"),h(R,"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(R,"href","#diffusers.DiffusionPipeline"),h(V,"class","relative group"),h(Te,"href","/docs/diffusers/v0.11.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),h(w,"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(Se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(_,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ie,"id","diffusers.pipeline_utils.ImagePipelineOutput"),h(ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(ie,"href","#diffusers.pipeline_utils.ImagePipelineOutput"),h(F,"class","relative group"),h(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,u){e(document.head,d),b(t,v,u),b(t,c,u),e(c,m),e(m,y),k(l,y,null),e(c,g),e(c,q),e(q,M),b(t,W,u),b(t,A,u),e(A,N),e(A,O),e(O,U),e(A,j),e(A,X),e(X,Pe),e(A,De),b(t,ne,u),k(B,t,u),b(t,at,u),b(t,P,u),e(P,kt),e(P,Ee),e(Ee,xt),e(P,It),e(P,Le),e(Le,Tt),e(P,St),e(P,ke),e(ke,jt),e(P,At),e(P,Ce),e(Ce,Lt),e(P,Ct),e(P,qe),e(qe,qt),e(P,Ot),e(P,Oe),e(Oe,Xt),e(P,zt),b(t,lt,u),b(t,G,u),e(G,Mt),e(G,xe),e(xe,Nt),e(G,Ut),b(t,dt,u),b(t,V,u),e(V,R),e(R,Xe),k(se,Xe,null),e(V,Vt),e(V,ze),e(ze,Ft),b(t,ft,u),b(t,_,u),k(re,_,null),e(_,Ht),e(_,Me),e(Me,Yt),e(_,Wt),e(_,Ie),e(Ie,Te),e(Te,Bt),e(Ie,Gt),e(_,Rt),e(_,ae),e(ae,Ne),e(Ne,Jt),e(ae,Kt),e(ae,Ue),e(Ue,Qt),e(_,Zt),e(_,Ve),e(Ve,eo),e(_,to),e(_,le),e(le,J),e(J,Fe),e(Fe,oo),e(J,io),e(J,He),e(He,no),e(J,so),e(le,ro),e(le,K),e(K,Ye),e(Ye,ao),e(K,lo),e(K,We),e(We,fo),e(K,po),e(_,co),e(_,w),k(de,w,null),e(w,mo),e(w,Be),e(Be,uo),e(w,ho),e(w,fe),e(fe,go),e(fe,Ge),e(Ge,_o),e(fe,vo),e(w,bo),e(w,pe),e(pe,yo),e(pe,Re),e(Re,$o),e(pe,wo),e(w,Po),e(w,ce),e(ce,Do),e(ce,Je),e(Je,Eo),e(ce,ko),e(w,xo),k(Q,w,null),e(w,Io),k(Z,w,null),e(w,To),k(ee,w,null),e(_,So),e(_,te),k(me,te,null),e(te,jo),e(te,ue),e(ue,Ao),e(ue,Ke),e(Ke,Lo),e(ue,Co),e(_,qo),e(_,Se),k(he,Se,null),e(_,Oo),e(_,je),k(ge,je,null),e(_,Xo),e(_,z),k(_e,z,null),e(z,zo),e(z,ve),e(ve,Mo),e(ve,Qe),e(Qe,No),e(ve,Uo),e(z,Vo),k(oe,z,null),b(t,pt,u),b(t,F,u),e(F,ie),e(ie,Ze),k(be,Ze,null),e(F,Fo),e(F,et),e(et,Ho),b(t,ct,u),b(t,H,u),k(ye,H,null),e(H,Yo),e(H,tt),e(tt,Wo),mt=!0},p(t,[u]){const $e={};u&2&&($e.$$scope={dirty:u,ctx:t}),B.$set($e);const ot={};u&2&&(ot.$$scope={dirty:u,ctx:t}),Q.$set(ot);const it={};u&2&&(it.$$scope={dirty:u,ctx:t}),Z.$set(it);const nt={};u&2&&(nt.$$scope={dirty:u,ctx:t}),ee.$set(nt);const Y={};u&2&&(Y.$$scope={dirty:u,ctx:t}),oe.$set(Y)},i(t){mt||(x(l.$$.fragment,t),x(B.$$.fragment,t),x(se.$$.fragment,t),x(re.$$.fragment,t),x(de.$$.fragment,t),x(Q.$$.fragment,t),x(Z.$$.fragment,t),x(ee.$$.fragment,t),x(me.$$.fragment,t),x(he.$$.fragment,t),x(ge.$$.fragment,t),x(_e.$$.fragment,t),x(oe.$$.fragment,t),x(be.$$.fragment,t),x(ye.$$.fragment,t),mt=!0)},o(t){I(l.$$.fragment,t),I(B.$$.fragment,t),I(se.$$.fragment,t),I(re.$$.fragment,t),I(de.$$.fragment,t),I(Q.$$.fragment,t),I(Z.$$.fragment,t),I(ee.$$.fragment,t),I(me.$$.fragment,t),I(he.$$.fragment,t),I(ge.$$.fragment,t),I(_e.$$.fragment,t),I(oe.$$.fragment,t),I(be.$$.fragment,t),I(ye.$$.fragment,t),mt=!1},d(t){o(d),t&&o(v),t&&o(c),T(l),t&&o(W),t&&o(A),t&&o(ne),T(B,t),t&&o(at),t&&o(P),t&&o(lt),t&&o(G),t&&o(dt),t&&o(V),T(se),t&&o(ft),t&&o(_),T(re),T(de),T(Q),T(Z),T(ee),T(me),T(he),T(ge),T(_e),T(oe),t&&o(pt),t&&o(F),T(be),t&&o(ct),t&&o(H),T(ye)}}}const Fi={local:"pipelines",sections:[{local:"diffusers.DiffusionPipeline",title:"DiffusionPipeline"},{local:"diffusers.pipeline_utils.ImagePipelineOutput",title:"ImagePipelineOutput"}],title:"Pipelines"};function Hi(C){return Oi(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ki extends Ai{constructor(d){super();Li(this,d,Hi,Vi,Ci,{})}}export{Ki as default,Fi as metadata};
