import{S as yo,i as wo,s as Po,e as o,k as d,w as D,t as r,M as Do,c as n,d as i,m as f,a as s,x as E,h as a,b as h,G as e,g as b,y as k,q as x,o as I,B as j,v as Eo,L as bo}from"../../chunks/vendor-hf-doc-builder.js";import{T as Xi}from"../../chunks/Tip-hf-doc-builder.js";import{D as $e}from"../../chunks/Docstring-hf-doc-builder.js";import{C as $o}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Vi}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as vo}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ko(L){let p;return{c(){p=r("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){p=a(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,p,c)},d(v){v&&i(p)}}}function xo(L){let p,v,c,u,$,l,g,q,M,B,A,N,O;return{c(){p=o("p"),v=r("It is required to be logged in ("),c=o("code"),u=r("huggingface-cli login"),$=r(") when you want to use private or "),l=o("a"),g=r(`gated
models`),q=r(", "),M=o("em"),B=r("e.g."),A=d(),N=o("code"),O=r('"CompVis/stable-diffusion-v1-4"'),this.h()},l(Y){p=n(Y,"P",{});var C=s(p);v=a(C,"It is required to be logged in ("),c=n(C,"CODE",{});var X=s(c);u=a(X,"huggingface-cli login"),X.forEach(i),$=a(C,") when you want to use private or "),l=n(C,"A",{href:!0,rel:!0});var ye=s(l);g=a(ye,`gated
models`),ye.forEach(i),q=a(C,", "),M=n(C,"EM",{});var we=s(M);B=a(we,"e.g."),we.forEach(i),A=f(C),N=n(C,"CODE",{});var oe=s(N);O=a(oe,'"CompVis/stable-diffusion-v1-4"'),oe.forEach(i),C.forEach(i),this.h()},h(){h(l,"href","https://huggingface.co/docs/hub/models-gated#gated-models"),h(l,"rel","nofollow")},m(Y,C){b(Y,p,C),e(p,v),e(p,c),e(c,u),e(p,$),e(p,l),e(l,g),e(p,q),e(p,M),e(M,B),e(p,A),e(p,N),e(N,O)},d(Y){Y&&i(p)}}}function Io(L){let p,v,c,u,$;return{c(){p=o("p"),v=r("Activate the special "),c=o("a"),u=r("\u201Coffline-mode\u201D"),$=r(` to use
this method in a firewalled environment.`),this.h()},l(l){p=n(l,"P",{});var g=s(p);v=a(g,"Activate the special "),c=n(g,"A",{href:!0,rel:!0});var q=s(c);u=a(q,"\u201Coffline-mode\u201D"),q.forEach(i),$=a(g,` to use
this method in a firewalled environment.`),g.forEach(i),this.h()},h(){h(c,"href","https://huggingface.co/diffusers/installation.html#offline-mode"),h(c,"rel","nofollow")},m(l,g){b(l,p,g),e(p,v),e(p,c),e(c,u),e(p,$)},d(l){l&&i(p)}}}function jo(L){let p,v,c,u,$;return u=new $o({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("CompVis/stable-diffusion-v1-4")

# Download pipeline, but overwrite scheduler
from diffusers import LMSDiscreteScheduler

scheduler = LMSDiscreteScheduler(beta_start=0.00085, beta_end=0.012, beta_schedule="scaled_linear")
pipeline = DiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", 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;CompVis/stable-diffusion-v1-4&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Download pipeline, but overwrite 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(beta_start=<span class="hljs-number">0.00085</span>, beta_end=<span class="hljs-number">0.012</span>, beta_schedule=<span class="hljs-string">&quot;scaled_linear&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>, scheduler=scheduler)`}}),{c(){p=o("p"),v=r("Examples:"),c=d(),D(u.$$.fragment)},l(l){p=n(l,"P",{});var g=s(p);v=a(g,"Examples:"),g.forEach(i),c=f(l),E(u.$$.fragment,l)},m(l,g){b(l,p,g),e(p,v),b(l,c,g),k(u,l,g),$=!0},p:bo,i(l){$||(x(u.$$.fragment,l),$=!0)},o(l){I(u.$$.fragment,l),$=!1},d(l){l&&i(p),l&&i(c),j(u,l)}}}function So(L){let p,v,c,u,$;return u=new $o({props:{code:`from diffusers import (
    StableDiffusionPipeline,
    StableDiffusionImg2ImgPipeline,
    StableDiffusionInpaintPipeline,
)

img2text = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4")
img2img = StableDiffusionImg2ImgPipeline(**img2text.components)
inpaint = StableDiffusionInpaintPipeline(**img2text.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>img2text = StableDiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;CompVis/stable-diffusion-v1-4&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>img2img = StableDiffusionImg2ImgPipeline(**img2text.components)
<span class="hljs-meta">&gt;&gt;&gt; </span>inpaint = StableDiffusionInpaintPipeline(**img2text.components)`}}),{c(){p=o("p"),v=r("Examples:"),c=d(),D(u.$$.fragment)},l(l){p=n(l,"P",{});var g=s(p);v=a(g,"Examples:"),g.forEach(i),c=f(l),E(u.$$.fragment,l)},m(l,g){b(l,p,g),e(p,v),b(l,c,g),k(u,l,g),$=!0},p:bo,i(l){$||(x(u.$$.fragment,l),$=!0)},o(l){I(u.$$.fragment,l),$=!1},d(l){l&&i(p),l&&i(c),j(u,l)}}}function Co(L){let p,v,c,u,$,l,g,q,M,B,A,N,O,Y,C,X,ye,we,oe,F,ot,P,yt,Pe,wt,Pt,Ce,Dt,Et,De,kt,xt,Ae,It,jt,Te,St,Ct,Le,At,Tt,nt,G,Lt,Ee,qt,Ot,st,U,R,qe,ne,Xt,Oe,Vt,rt,_,se,Mt,Xe,Nt,Yt,ke,xe,Ut,zt,Wt,re,Ve,Ht,Bt,Me,Ft,Gt,Ne,Rt,Jt,Ye,J,Ue,Kt,Qt,ze,Zt,ei,ti,w,ae,ii,We,oi,ni,le,si,He,ri,ai,li,pe,pi,Be,di,fi,ci,de,ui,Fe,mi,hi,gi,K,_i,Q,vi,Z,bi,ee,fe,$i,ce,yi,Ge,wi,Pi,Di,Ie,ue,Ei,je,me,ki,V,he,xi,ge,Ii,Re,ji,Si,Ci,te,at,z,ie,Je,_e,Ai,Ke,Ti,lt,W,ve,Li,Qe,qi,pt;return l=new Vi({}),F=new Xi({props:{$$slots:{default:[ko]},$$scope:{ctx:L}}}),ne=new Vi({}),se=new $e({props:{name:"class diffusers.DiffusionPipeline",anchor:"diffusers.DiffusionPipeline",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_944/src/diffusers/pipeline_utils.py#L96"}}),ae=new $e({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/pr_944/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/main/en/using-diffusers/custom_pipelines" rel="nofollow">Loading and
Creating 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.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.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/vr_944/src/diffusers/pipeline_utils.py#L215"}}),K=new Xi({props:{$$slots:{default:[xo]},$$scope:{ctx:L}}}),Q=new Xi({props:{$$slots:{default:[Io]},$$scope:{ctx:L}}}),Z=new vo({props:{anchor:"diffusers.DiffusionPipeline.from_pretrained.example",$$slots:{default:[jo]},$$scope:{ctx:L}}}),fe=new $e({props:{name:"save_pretrained",anchor:"diffusers.DiffusionPipeline.save_pretrained",parameters:[{name:"save_directory",val:": typing.Union[str, os.PathLike]"}],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"}],source:"https://github.com/huggingface/diffusers/blob/vr_944/src/diffusers/pipeline_utils.py#L146"}}),ue=new $e({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/vr_944/src/diffusers/pipeline_utils.py#L183"}}),me=new $e({props:{name:"device",anchor:"diffusers.DiffusionPipeline.device",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_944/src/diffusers/pipeline_utils.py#L202",returnDescription:`
<p>The torch device on which the pipeline is located.</p>
`,returnType:`
<p><code>torch.device</code></p>
`}}),he=new $e({props:{name:"components",anchor:"diffusers.DiffusionPipeline.components",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_944/src/diffusers/pipeline_utils.py#L569",returnDescription:`
<p>A dictionaly containing all the modules needed to initialize the pipleline.</p>
`}}),te=new vo({props:{anchor:"diffusers.DiffusionPipeline.components.example",$$slots:{default:[So]},$$scope:{ctx:L}}}),_e=new Vi({}),ve=new $e({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/vr_944/src/diffusers/pipeline_utils.py#L83"}}),{c(){p=o("meta"),v=d(),c=o("h1"),u=o("a"),$=o("span"),D(l.$$.fragment),g=d(),q=o("span"),M=r("Pipelines"),B=d(),A=o("p"),N=r("The "),O=o("a"),Y=r("DiffusionPipeline"),C=r(" is the easiest way to load any pretrained diffusion pipeline from the "),X=o("a"),ye=r("Hub"),we=r(" and to use it in inference."),oe=d(),D(F.$$.fragment),ot=d(),P=o("p"),yt=r("Any diffusion pipeline that is loaded with "),Pe=o("a"),wt=r("from_pretrained()"),Pt=r(` will automatically
detect the pipeline type, `),Ce=o("em"),Dt=r("e.g."),Et=d(),De=o("a"),kt=r("StableDiffusionPipeline"),xt=r(` and consequently load each component of the
pipeline and pass them into the `),Ae=o("code"),It=r("__init__"),jt=r(" function of the pipeline, "),Te=o("em"),St=r("e.g."),Ct=d(),Le=o("code"),At=r("__init__()"),Tt=r("."),nt=d(),G=o("p"),Lt=r("Any pipeline object can be saved locally with "),Ee=o("a"),qt=r("save_pretrained()"),Ot=r("."),st=d(),U=o("h2"),R=o("a"),qe=o("span"),D(ne.$$.fragment),Xt=d(),Oe=o("span"),Vt=r("DiffusionPipeline"),rt=d(),_=o("div"),D(se.$$.fragment),Mt=d(),Xe=o("p"),Nt=r("Base class for all models."),Yt=d(),ke=o("p"),xe=o("a"),Ut=r("DiffusionPipeline"),zt=r(` 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:`),Wt=d(),re=o("ul"),Ve=o("li"),Ht=r("move all PyTorch modules to the device of your choice"),Bt=d(),Me=o("li"),Ft=r("enabling/disabling the progress bar for the denoising iteration"),Gt=d(),Ne=o("p"),Rt=r("Class attributes:"),Jt=d(),Ye=o("ul"),J=o("li"),Ue=o("strong"),Kt=r("config_name"),Qt=r(" ("),ze=o("code"),Zt=r("str"),ei=r(`) \u2014 name of the config file that will store the class and module names of all
components of the diffusion pipeline.`),ti=d(),w=o("div"),D(ae.$$.fragment),ii=d(),We=o("p"),oi=r("Instantiate a PyTorch diffusion pipeline from pre-trained pipeline weights."),ni=d(),le=o("p"),si=r("The pipeline is set in evaluation mode by default using "),He=o("code"),ri=r("model.eval()"),ai=r(" (Dropout modules are deactivated)."),li=d(),pe=o("p"),pi=r("The warning "),Be=o("em"),di=r("Weights from XXX not initialized from pretrained model"),fi=r(` 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.`),ci=d(),de=o("p"),ui=r("The warning "),Fe=o("em"),mi=r("Weights from XXX not used in YYY"),hi=r(` means that the layer XXX is not used by YYY, therefore those
weights are discarded.`),gi=d(),D(K.$$.fragment),_i=d(),D(Q.$$.fragment),vi=d(),D(Z.$$.fragment),bi=d(),ee=o("div"),D(fe.$$.fragment),$i=d(),ce=o("p"),yi=r(`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 `),Ge=o("code"),wi=r("[from_pretrained()](/docs/diffusers/pr_944/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained)"),Pi=r(" class method."),Di=d(),Ie=o("div"),D(ue.$$.fragment),Ei=d(),je=o("div"),D(me.$$.fragment),ki=d(),V=o("div"),D(he.$$.fragment),xi=d(),ge=o("p"),Ii=r("The "),Re=o("code"),ji=r("self.compenents"),Si=r(` property can be useful to run different pipelines with the same weights and
configurations to not have to re-allocate memory.`),Ci=d(),D(te.$$.fragment),at=d(),z=o("h2"),ie=o("a"),Je=o("span"),D(_e.$$.fragment),Ai=d(),Ke=o("span"),Ti=r("ImagePipelineOutput"),lt=r(`

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

By default diffusion pipelines return an object of class
`),W=n(t,"DIV",{class:!0});var $t=s(W);E(ve.$$.fragment,$t),Li=f($t),Qe=n($t,"P",{});var _o=s(Qe);qi=a(_o,"Output class for image pipelines."),_o.forEach(i),$t.forEach(i),this.h()},h(){h(p,"name","hf:doc:metadata"),h(p,"content",JSON.stringify(Ao)),h(u,"id","pipelines"),h(u,"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(u,"href","#pipelines"),h(c,"class","relative group"),h(O,"href","/docs/diffusers/pr_944/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),h(X,"href","https://huggingface.co/models?library=diffusers"),h(X,"rel","nofollow"),h(Pe,"href","/docs/diffusers/pr_944/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained"),h(De,"href","/docs/diffusers/pr_944/en/api/pipelines/stable_diffusion#diffusers.StableDiffusionPipeline"),h(Ee,"href","/docs/diffusers/pr_944/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(U,"class","relative group"),h(xe,"href","/docs/diffusers/pr_944/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(ee,"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,"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(V,"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(z,"class","relative group"),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")},m(t,m){e(document.head,p),b(t,v,m),b(t,c,m),e(c,u),e(u,$),k(l,$,null),e(c,g),e(c,q),e(q,M),b(t,B,m),b(t,A,m),e(A,N),e(A,O),e(O,Y),e(A,C),e(A,X),e(X,ye),e(A,we),b(t,oe,m),k(F,t,m),b(t,ot,m),b(t,P,m),e(P,yt),e(P,Pe),e(Pe,wt),e(P,Pt),e(P,Ce),e(Ce,Dt),e(P,Et),e(P,De),e(De,kt),e(P,xt),e(P,Ae),e(Ae,It),e(P,jt),e(P,Te),e(Te,St),e(P,Ct),e(P,Le),e(Le,At),e(P,Tt),b(t,nt,m),b(t,G,m),e(G,Lt),e(G,Ee),e(Ee,qt),e(G,Ot),b(t,st,m),b(t,U,m),e(U,R),e(R,qe),k(ne,qe,null),e(U,Xt),e(U,Oe),e(Oe,Vt),b(t,rt,m),b(t,_,m),k(se,_,null),e(_,Mt),e(_,Xe),e(Xe,Nt),e(_,Yt),e(_,ke),e(ke,xe),e(xe,Ut),e(ke,zt),e(_,Wt),e(_,re),e(re,Ve),e(Ve,Ht),e(re,Bt),e(re,Me),e(Me,Ft),e(_,Gt),e(_,Ne),e(Ne,Rt),e(_,Jt),e(_,Ye),e(Ye,J),e(J,Ue),e(Ue,Kt),e(J,Qt),e(J,ze),e(ze,Zt),e(J,ei),e(_,ti),e(_,w),k(ae,w,null),e(w,ii),e(w,We),e(We,oi),e(w,ni),e(w,le),e(le,si),e(le,He),e(He,ri),e(le,ai),e(w,li),e(w,pe),e(pe,pi),e(pe,Be),e(Be,di),e(pe,fi),e(w,ci),e(w,de),e(de,ui),e(de,Fe),e(Fe,mi),e(de,hi),e(w,gi),k(K,w,null),e(w,_i),k(Q,w,null),e(w,vi),k(Z,w,null),e(_,bi),e(_,ee),k(fe,ee,null),e(ee,$i),e(ee,ce),e(ce,yi),e(ce,Ge),e(Ge,wi),e(ce,Pi),e(_,Di),e(_,Ie),k(ue,Ie,null),e(_,Ei),e(_,je),k(me,je,null),e(_,ki),e(_,V),k(he,V,null),e(V,xi),e(V,ge),e(ge,Ii),e(ge,Re),e(Re,ji),e(ge,Si),e(V,Ci),k(te,V,null),b(t,at,m),b(t,z,m),e(z,ie),e(ie,Je),k(_e,Je,null),e(z,Ai),e(z,Ke),e(Ke,Ti),b(t,lt,m),b(t,W,m),k(ve,W,null),e(W,Li),e(W,Qe),e(Qe,qi),pt=!0},p(t,[m]){const be={};m&2&&(be.$$scope={dirty:m,ctx:t}),F.$set(be);const Ze={};m&2&&(Ze.$$scope={dirty:m,ctx:t}),K.$set(Ze);const et={};m&2&&(et.$$scope={dirty:m,ctx:t}),Q.$set(et);const tt={};m&2&&(tt.$$scope={dirty:m,ctx:t}),Z.$set(tt);const H={};m&2&&(H.$$scope={dirty:m,ctx:t}),te.$set(H)},i(t){pt||(x(l.$$.fragment,t),x(F.$$.fragment,t),x(ne.$$.fragment,t),x(se.$$.fragment,t),x(ae.$$.fragment,t),x(K.$$.fragment,t),x(Q.$$.fragment,t),x(Z.$$.fragment,t),x(fe.$$.fragment,t),x(ue.$$.fragment,t),x(me.$$.fragment,t),x(he.$$.fragment,t),x(te.$$.fragment,t),x(_e.$$.fragment,t),x(ve.$$.fragment,t),pt=!0)},o(t){I(l.$$.fragment,t),I(F.$$.fragment,t),I(ne.$$.fragment,t),I(se.$$.fragment,t),I(ae.$$.fragment,t),I(K.$$.fragment,t),I(Q.$$.fragment,t),I(Z.$$.fragment,t),I(fe.$$.fragment,t),I(ue.$$.fragment,t),I(me.$$.fragment,t),I(he.$$.fragment,t),I(te.$$.fragment,t),I(_e.$$.fragment,t),I(ve.$$.fragment,t),pt=!1},d(t){i(p),t&&i(v),t&&i(c),j(l),t&&i(B),t&&i(A),t&&i(oe),j(F,t),t&&i(ot),t&&i(P),t&&i(nt),t&&i(G),t&&i(st),t&&i(U),j(ne),t&&i(rt),t&&i(_),j(se),j(ae),j(K),j(Q),j(Z),j(fe),j(ue),j(me),j(he),j(te),t&&i(at),t&&i(z),j(_e),t&&i(lt),t&&i(W),j(ve)}}}const Ao={local:"pipelines",sections:[{local:"diffusers.DiffusionPipeline",title:"DiffusionPipeline"},{local:"diffusers.pipeline_utils.ImagePipelineOutput",title:"ImagePipelineOutput"}],title:"Pipelines"};function To(L){return Eo(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class No extends yo{constructor(p){super();wo(this,p,To,Co,Po,{})}}export{No as default,Ao as metadata};
