import{S as Wt,i as zt,s as Bt,e as r,k as l,w as V,t as d,M as Jt,c as a,d as t,m as p,a as o,x as F,h as c,b as n,G as i,g as f,y as Y,L as Rt,q as K,o as Q,B as X,v as jt}from"../../../chunks/vendor-hf-doc-builder.js";import{D as Ut}from"../../../chunks/Docstring-hf-doc-builder.js";import{I as Se}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function Vt(ct){let u,ue,m,w,Z,E,Ne,ee,qe,me,_,y,te,T,Oe,ie,Ce,_e,k,x,He,Le,ve,L,Ge,ge,G,Ue,De,M,We,A,ze,Be,be,v,P,re,S,Je,ae,Re,we,I,oe,g,ne,je,Ve,se,Fe,Ye,U,Ke,Qe,le,D,pe,N,Xe,Ze,de,ce,et,tt,W,it,ye,b,$,fe,q,rt,he,at,Me,h,O,ot,C,nt,z,st,lt,pt,B,H,Pe;return E=new Se({}),T=new Se({}),S=new Se({}),q=new Se({}),O=new Ut({props:{name:"class diffusers.DDIMPipeline",anchor:"diffusers.DDIMPipeline",parameters:[{name:"unet",val:""},{name:"scheduler",val:""}],parametersDescription:[{anchor:"diffusers.DDIMPipeline.unet",description:'<strong>unet</strong> (<a href="/docs/diffusers/pr_1190/en/api/models#diffusers.UNet2DModel">UNet2DModel</a>) &#x2014; U-Net architecture to denoise the encoded image.',name:"unet"},{anchor:"diffusers.DDIMPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/pr_1190/en/api/schedulers#diffusers.SchedulerMixin">SchedulerMixin</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to denoise the encoded image. Can be one of
<a href="/docs/diffusers/pr_1190/en/api/schedulers#diffusers.DDPMScheduler">DDPMScheduler</a>, or <a href="/docs/diffusers/pr_1190/en/api/schedulers#diffusers.DDIMScheduler">DDIMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/vr_1190/src/diffusers/pipelines/ddim/pipeline_ddim.py#L24"}}),H=new Ut({props:{name:"__call__",anchor:"diffusers.DDIMPipeline.__call__",parameters:[{name:"batch_size",val:": int = 1"},{name:"generator",val:": typing.Optional[torch._C.Generator] = None"},{name:"eta",val:": float = 0.0"},{name:"num_inference_steps",val:": int = 50"},{name:"use_clipped_model_output",val:": typing.Optional[bool] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.DDIMPipeline.__call__.batch_size",description:`<strong>batch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate.`,name:"batch_size"},{anchor:"diffusers.DDIMPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator</a> to make generation
deterministic.`,name:"generator"},{anchor:"diffusers.DDIMPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The eta parameter which controls the scale of the variance (0 is DDIM and 1 is one type of DDPM).`,name:"eta"},{anchor:"diffusers.DDIMPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.DDIMPipeline.__call__.use_clipped_model_output",description:`<strong>use_clipped_model_output</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
if <code>True</code> or <code>False</code>, see documentation for <code>DDIMScheduler.step</code>. If <code>None</code>, nothing is passed
downstream to the scheduler. So use <code>None</code> for schedulers which don&#x2019;t support this argument.`,name:"use_clipped_model_output"},{anchor:"diffusers.DDIMPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.DDIMPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/pr_1190/en/api/diffusion_pipeline#diffusers.pipeline_utils.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_1190/src/diffusers/pipelines/ddim/pipeline_ddim.py#L40",returnDescription:`
<p><code>~pipelines.utils.ImagePipelineOutput</code> if
<code>return_dict</code> is True, otherwise a \`tuple. When returning a tuple, the first element is a list with the
generated images.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/pr_1190/en/api/diffusion_pipeline#diffusers.pipeline_utils.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),{c(){u=r("meta"),ue=l(),m=r("h1"),w=r("a"),Z=r("span"),V(E.$$.fragment),Ne=l(),ee=r("span"),qe=d("DDIM"),me=l(),_=r("h2"),y=r("a"),te=r("span"),V(T.$$.fragment),Oe=l(),ie=r("span"),Ce=d("Overview"),_e=l(),k=r("p"),x=r("a"),He=d("Denoising Diffusion Implicit Models"),Le=d(" (DDIM) by Jiaming Song, Chenlin Meng and Stefano Ermon."),ve=l(),L=r("p"),Ge=d("The abstract of the paper is the following:"),ge=l(),G=r("p"),Ue=d("Denoising diffusion probabilistic models (DDPMs) have achieved high quality image generation without adversarial training, yet they require simulating a Markov chain for many steps to produce a sample. To accelerate sampling, we present denoising diffusion implicit models (DDIMs), a more efficient class of iterative implicit probabilistic models with the same training procedure as DDPMs. In DDPMs, the generative process is defined as the reverse of a Markovian diffusion process. We construct a class of non-Markovian diffusion processes that lead to the same training objective, but whose reverse process can be much faster to sample from. We empirically demonstrate that DDIMs can produce high quality samples 10\xD7 to 50\xD7 faster in terms of wall-clock time compared to DDPMs, allow us to trade off computation for sample quality, and can perform semantically meaningful image interpolation directly in the latent space."),De=l(),M=r("p"),We=d("The original codebase of this paper can be found "),A=r("a"),ze=d("here"),Be=d("."),be=l(),v=r("h2"),P=r("a"),re=r("span"),V(S.$$.fragment),Je=l(),ae=r("span"),Re=d("Available Pipelines:"),we=l(),I=r("table"),oe=r("thead"),g=r("tr"),ne=r("th"),je=d("Pipeline"),Ve=l(),se=r("th"),Fe=d("Tasks"),Ye=l(),U=r("th"),Ke=d("Colab"),Qe=l(),le=r("tbody"),D=r("tr"),pe=r("td"),N=r("a"),Xe=d("pipeline_ddim.py"),Ze=l(),de=r("td"),ce=r("em"),et=d("Unconditional Image Generation"),tt=l(),W=r("td"),it=d("-"),ye=l(),b=r("h2"),$=r("a"),fe=r("span"),V(q.$$.fragment),rt=l(),he=r("span"),at=d("DDIMPipeline"),Me=l(),h=r("div"),V(O.$$.fragment),ot=l(),C=r("p"),nt=d("This model inherits from "),z=r("a"),st=d("DiffusionPipeline"),lt=d(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),pt=l(),B=r("div"),V(H.$$.fragment),this.h()},l(e){const s=Jt('[data-svelte="svelte-1phssyn"]',document.head);u=a(s,"META",{name:!0,content:!0}),s.forEach(t),ue=p(e),m=a(e,"H1",{class:!0});var Ie=o(m);w=a(Ie,"A",{id:!0,class:!0,href:!0});var ft=o(w);Z=a(ft,"SPAN",{});var ht=o(Z);F(E.$$.fragment,ht),ht.forEach(t),ft.forEach(t),Ne=p(Ie),ee=a(Ie,"SPAN",{});var ut=o(ee);qe=c(ut,"DDIM"),ut.forEach(t),Ie.forEach(t),me=p(e),_=a(e,"H2",{class:!0});var $e=o(_);y=a($e,"A",{id:!0,class:!0,href:!0});var mt=o(y);te=a(mt,"SPAN",{});var _t=o(te);F(T.$$.fragment,_t),_t.forEach(t),mt.forEach(t),Oe=p($e),ie=a($e,"SPAN",{});var vt=o(ie);Ce=c(vt,"Overview"),vt.forEach(t),$e.forEach(t),_e=p(e),k=a(e,"P",{});var dt=o(k);x=a(dt,"A",{href:!0,rel:!0});var gt=o(x);He=c(gt,"Denoising Diffusion Implicit Models"),gt.forEach(t),Le=c(dt," (DDIM) by Jiaming Song, Chenlin Meng and Stefano Ermon."),dt.forEach(t),ve=p(e),L=a(e,"P",{});var Dt=o(L);Ge=c(Dt,"The abstract of the paper is the following:"),Dt.forEach(t),ge=p(e),G=a(e,"P",{});var bt=o(G);Ue=c(bt,"Denoising diffusion probabilistic models (DDPMs) have achieved high quality image generation without adversarial training, yet they require simulating a Markov chain for many steps to produce a sample. To accelerate sampling, we present denoising diffusion implicit models (DDIMs), a more efficient class of iterative implicit probabilistic models with the same training procedure as DDPMs. In DDPMs, the generative process is defined as the reverse of a Markovian diffusion process. We construct a class of non-Markovian diffusion processes that lead to the same training objective, but whose reverse process can be much faster to sample from. We empirically demonstrate that DDIMs can produce high quality samples 10\xD7 to 50\xD7 faster in terms of wall-clock time compared to DDPMs, allow us to trade off computation for sample quality, and can perform semantically meaningful image interpolation directly in the latent space."),bt.forEach(t),De=p(e),M=a(e,"P",{});var Ee=o(M);We=c(Ee,"The original codebase of this paper can be found "),A=a(Ee,"A",{href:!0,rel:!0});var wt=o(A);ze=c(wt,"here"),wt.forEach(t),Be=c(Ee,"."),Ee.forEach(t),be=p(e),v=a(e,"H2",{class:!0});var Te=o(v);P=a(Te,"A",{id:!0,class:!0,href:!0});var yt=o(P);re=a(yt,"SPAN",{});var Mt=o(re);F(S.$$.fragment,Mt),Mt.forEach(t),yt.forEach(t),Je=p(Te),ae=a(Te,"SPAN",{});var Pt=o(ae);Re=c(Pt,"Available Pipelines:"),Pt.forEach(t),Te.forEach(t),we=p(e),I=a(e,"TABLE",{});var ke=o(I);oe=a(ke,"THEAD",{});var It=o(oe);g=a(It,"TR",{});var J=o(g);ne=a(J,"TH",{});var $t=o(ne);je=c($t,"Pipeline"),$t.forEach(t),Ve=p(J),se=a(J,"TH",{});var Et=o(se);Fe=c(Et,"Tasks"),Et.forEach(t),Ye=p(J),U=a(J,"TH",{align:!0});var Tt=o(U);Ke=c(Tt,"Colab"),Tt.forEach(t),J.forEach(t),It.forEach(t),Qe=p(ke),le=a(ke,"TBODY",{});var kt=o(le);D=a(kt,"TR",{});var R=o(D);pe=a(R,"TD",{});var xt=o(pe);N=a(xt,"A",{href:!0,rel:!0});var At=o(N);Xe=c(At,"pipeline_ddim.py"),At.forEach(t),xt.forEach(t),Ze=p(R),de=a(R,"TD",{});var St=o(de);ce=a(St,"EM",{});var Nt=o(ce);et=c(Nt,"Unconditional Image Generation"),Nt.forEach(t),St.forEach(t),tt=p(R),W=a(R,"TD",{align:!0});var qt=o(W);it=c(qt,"-"),qt.forEach(t),R.forEach(t),kt.forEach(t),ke.forEach(t),ye=p(e),b=a(e,"H2",{class:!0});var xe=o(b);$=a(xe,"A",{id:!0,class:!0,href:!0});var Ot=o($);fe=a(Ot,"SPAN",{});var Ct=o(fe);F(q.$$.fragment,Ct),Ct.forEach(t),Ot.forEach(t),rt=p(xe),he=a(xe,"SPAN",{});var Ht=o(he);at=c(Ht,"DDIMPipeline"),Ht.forEach(t),xe.forEach(t),Me=p(e),h=a(e,"DIV",{class:!0});var j=o(h);F(O.$$.fragment,j),ot=p(j),C=a(j,"P",{});var Ae=o(C);nt=c(Ae,"This model inherits from "),z=a(Ae,"A",{href:!0});var Lt=o(z);st=c(Lt,"DiffusionPipeline"),Lt.forEach(t),lt=c(Ae,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Ae.forEach(t),pt=p(j),B=a(j,"DIV",{class:!0});var Gt=o(B);F(H.$$.fragment,Gt),Gt.forEach(t),j.forEach(t),this.h()},h(){n(u,"name","hf:doc:metadata"),n(u,"content",JSON.stringify(Ft)),n(w,"id","ddim"),n(w,"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"),n(w,"href","#ddim"),n(m,"class","relative group"),n(y,"id","overview"),n(y,"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"),n(y,"href","#overview"),n(_,"class","relative group"),n(x,"href","https://arxiv.org/abs/2010.02502"),n(x,"rel","nofollow"),n(A,"href","https://github.com/ermongroup/ddim"),n(A,"rel","nofollow"),n(P,"id","available-pipelines"),n(P,"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"),n(P,"href","#available-pipelines"),n(v,"class","relative group"),n(U,"align","center"),n(N,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ddim/pipeline_ddim.py"),n(N,"rel","nofollow"),n(W,"align","center"),n($,"id","diffusers.DDIMPipeline"),n($,"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"),n($,"href","#diffusers.DDIMPipeline"),n(b,"class","relative group"),n(z,"href","/docs/diffusers/pr_1190/en/using-diffusers/loading#diffusers.DiffusionPipeline"),n(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),n(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(e,s){i(document.head,u),f(e,ue,s),f(e,m,s),i(m,w),i(w,Z),Y(E,Z,null),i(m,Ne),i(m,ee),i(ee,qe),f(e,me,s),f(e,_,s),i(_,y),i(y,te),Y(T,te,null),i(_,Oe),i(_,ie),i(ie,Ce),f(e,_e,s),f(e,k,s),i(k,x),i(x,He),i(k,Le),f(e,ve,s),f(e,L,s),i(L,Ge),f(e,ge,s),f(e,G,s),i(G,Ue),f(e,De,s),f(e,M,s),i(M,We),i(M,A),i(A,ze),i(M,Be),f(e,be,s),f(e,v,s),i(v,P),i(P,re),Y(S,re,null),i(v,Je),i(v,ae),i(ae,Re),f(e,we,s),f(e,I,s),i(I,oe),i(oe,g),i(g,ne),i(ne,je),i(g,Ve),i(g,se),i(se,Fe),i(g,Ye),i(g,U),i(U,Ke),i(I,Qe),i(I,le),i(le,D),i(D,pe),i(pe,N),i(N,Xe),i(D,Ze),i(D,de),i(de,ce),i(ce,et),i(D,tt),i(D,W),i(W,it),f(e,ye,s),f(e,b,s),i(b,$),i($,fe),Y(q,fe,null),i(b,rt),i(b,he),i(he,at),f(e,Me,s),f(e,h,s),Y(O,h,null),i(h,ot),i(h,C),i(C,nt),i(C,z),i(z,st),i(C,lt),i(h,pt),i(h,B),Y(H,B,null),Pe=!0},p:Rt,i(e){Pe||(K(E.$$.fragment,e),K(T.$$.fragment,e),K(S.$$.fragment,e),K(q.$$.fragment,e),K(O.$$.fragment,e),K(H.$$.fragment,e),Pe=!0)},o(e){Q(E.$$.fragment,e),Q(T.$$.fragment,e),Q(S.$$.fragment,e),Q(q.$$.fragment,e),Q(O.$$.fragment,e),Q(H.$$.fragment,e),Pe=!1},d(e){t(u),e&&t(ue),e&&t(m),X(E),e&&t(me),e&&t(_),X(T),e&&t(_e),e&&t(k),e&&t(ve),e&&t(L),e&&t(ge),e&&t(G),e&&t(De),e&&t(M),e&&t(be),e&&t(v),X(S),e&&t(we),e&&t(I),e&&t(ye),e&&t(b),X(q),e&&t(Me),e&&t(h),X(O),X(H)}}}const Ft={local:"ddim",sections:[{local:"overview",title:"Overview"},{local:"available-pipelines",title:"Available Pipelines:"},{local:"diffusers.DDIMPipeline",title:"DDIMPipeline"}],title:"DDIM"};function Yt(ct){return jt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Zt extends Wt{constructor(u){super();zt(this,u,Yt,Vt,Bt,{})}}export{Zt as default,Ft as metadata};
