import{S as Jt,i as Rt,s as jt,e as o,k as p,w as Y,t as l,M as Vt,c as a,d as i,m as c,a as r,x as K,h as d,b as n,G as t,g as f,y as Q,L as Yt,q as X,o as Z,B as ee,v as Kt}from"../../../chunks/vendor-hf-doc-builder.js";import{D as Ft}from"../../../chunks/Docstring-hf-doc-builder.js";import{I as Ne}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function Qt(ut){let m,ge,g,y,te,E,qe,ie,Oe,ve,v,M,oe,T,Ce,ae,Le,_e,k,x,He,Ge,De,G,Ue,be,U,We,we,u,ze,A,Be,Fe,S,Je,Re,ye,_,P,re,N,je,ne,Ve,Me,I,se,D,le,Ye,Ke,de,Qe,Xe,W,Ze,et,pe,b,ce,q,tt,it,fe,he,ot,at,z,rt,Pe,w,$,ue,O,nt,me,st,Ie,h,C,lt,L,dt,B,pt,ct,ft,F,H,$e;return E=new Ne({}),T=new Ne({}),N=new Ne({}),O=new Ne({}),C=new Ft({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/main/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/main/en/api/schedulers/overview#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/main/en/api/schedulers/ddpm#diffusers.DDPMScheduler">DDPMScheduler</a>, or <a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ddim/pipeline_ddim.py#L24"}}),H=new Ft({props:{name:"__call__",anchor:"diffusers.DDIMPipeline.__call__",parameters:[{name:"batch_size",val:": int = 1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = 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"}],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;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</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/main/en/api/diffusion_pipeline#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ddim/pipeline_ddim.py#L44",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/main/en/api/diffusion_pipeline#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),{c(){m=o("meta"),ge=p(),g=o("h1"),y=o("a"),te=o("span"),Y(E.$$.fragment),qe=p(),ie=o("span"),Oe=l("DDIM"),ve=p(),v=o("h2"),M=o("a"),oe=o("span"),Y(T.$$.fragment),Ce=p(),ae=o("span"),Le=l("Overview"),_e=p(),k=o("p"),x=o("a"),He=l("Denoising Diffusion Implicit Models"),Ge=l(" (DDIM) by Jiaming Song, Chenlin Meng and Stefano Ermon."),De=p(),G=o("p"),Ue=l("The abstract of the paper is the following:"),be=p(),U=o("p"),We=l("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."),we=p(),u=o("p"),ze=l("The original codebase of this paper can be found here: "),A=o("a"),Be=l("ermongroup/ddim"),Fe=l(`.
For questions, feel free to contact the author on `),S=o("a"),Je=l("tsong.me"),Re=l("."),ye=p(),_=o("h2"),P=o("a"),re=o("span"),Y(N.$$.fragment),je=p(),ne=o("span"),Ve=l("Available Pipelines:"),Me=p(),I=o("table"),se=o("thead"),D=o("tr"),le=o("th"),Ye=l("Pipeline"),Ke=p(),de=o("th"),Qe=l("Tasks"),Xe=p(),W=o("th"),Ze=l("Colab"),et=p(),pe=o("tbody"),b=o("tr"),ce=o("td"),q=o("a"),tt=l("pipeline_ddim.py"),it=p(),fe=o("td"),he=o("em"),ot=l("Unconditional Image Generation"),at=p(),z=o("td"),rt=l("-"),Pe=p(),w=o("h2"),$=o("a"),ue=o("span"),Y(O.$$.fragment),nt=p(),me=o("span"),st=l("DDIMPipeline"),Ie=p(),h=o("div"),Y(C.$$.fragment),lt=p(),L=o("p"),dt=l("This model inherits from "),B=o("a"),pt=l("DiffusionPipeline"),ct=l(`. 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.)`),ft=p(),F=o("div"),Y(H.$$.fragment),this.h()},l(e){const s=Vt('[data-svelte="svelte-1phssyn"]',document.head);m=a(s,"META",{name:!0,content:!0}),s.forEach(i),ge=c(e),g=a(e,"H1",{class:!0});var Ee=r(g);y=a(Ee,"A",{id:!0,class:!0,href:!0});var mt=r(y);te=a(mt,"SPAN",{});var gt=r(te);K(E.$$.fragment,gt),gt.forEach(i),mt.forEach(i),qe=c(Ee),ie=a(Ee,"SPAN",{});var vt=r(ie);Oe=d(vt,"DDIM"),vt.forEach(i),Ee.forEach(i),ve=c(e),v=a(e,"H2",{class:!0});var Te=r(v);M=a(Te,"A",{id:!0,class:!0,href:!0});var _t=r(M);oe=a(_t,"SPAN",{});var Dt=r(oe);K(T.$$.fragment,Dt),Dt.forEach(i),_t.forEach(i),Ce=c(Te),ae=a(Te,"SPAN",{});var bt=r(ae);Le=d(bt,"Overview"),bt.forEach(i),Te.forEach(i),_e=c(e),k=a(e,"P",{});var ht=r(k);x=a(ht,"A",{href:!0,rel:!0});var wt=r(x);He=d(wt,"Denoising Diffusion Implicit Models"),wt.forEach(i),Ge=d(ht," (DDIM) by Jiaming Song, Chenlin Meng and Stefano Ermon."),ht.forEach(i),De=c(e),G=a(e,"P",{});var yt=r(G);Ue=d(yt,"The abstract of the paper is the following:"),yt.forEach(i),be=c(e),U=a(e,"P",{});var Mt=r(U);We=d(Mt,"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."),Mt.forEach(i),we=c(e),u=a(e,"P",{});var J=r(u);ze=d(J,"The original codebase of this paper can be found here: "),A=a(J,"A",{href:!0,rel:!0});var Pt=r(A);Be=d(Pt,"ermongroup/ddim"),Pt.forEach(i),Fe=d(J,`.
For questions, feel free to contact the author on `),S=a(J,"A",{href:!0,rel:!0});var It=r(S);Je=d(It,"tsong.me"),It.forEach(i),Re=d(J,"."),J.forEach(i),ye=c(e),_=a(e,"H2",{class:!0});var ke=r(_);P=a(ke,"A",{id:!0,class:!0,href:!0});var $t=r(P);re=a($t,"SPAN",{});var Et=r(re);K(N.$$.fragment,Et),Et.forEach(i),$t.forEach(i),je=c(ke),ne=a(ke,"SPAN",{});var Tt=r(ne);Ve=d(Tt,"Available Pipelines:"),Tt.forEach(i),ke.forEach(i),Me=c(e),I=a(e,"TABLE",{});var xe=r(I);se=a(xe,"THEAD",{});var kt=r(se);D=a(kt,"TR",{});var R=r(D);le=a(R,"TH",{});var xt=r(le);Ye=d(xt,"Pipeline"),xt.forEach(i),Ke=c(R),de=a(R,"TH",{});var At=r(de);Qe=d(At,"Tasks"),At.forEach(i),Xe=c(R),W=a(R,"TH",{align:!0});var St=r(W);Ze=d(St,"Colab"),St.forEach(i),R.forEach(i),kt.forEach(i),et=c(xe),pe=a(xe,"TBODY",{});var Nt=r(pe);b=a(Nt,"TR",{});var j=r(b);ce=a(j,"TD",{});var qt=r(ce);q=a(qt,"A",{href:!0,rel:!0});var Ot=r(q);tt=d(Ot,"pipeline_ddim.py"),Ot.forEach(i),qt.forEach(i),it=c(j),fe=a(j,"TD",{});var Ct=r(fe);he=a(Ct,"EM",{});var Lt=r(he);ot=d(Lt,"Unconditional Image Generation"),Lt.forEach(i),Ct.forEach(i),at=c(j),z=a(j,"TD",{align:!0});var Ht=r(z);rt=d(Ht,"-"),Ht.forEach(i),j.forEach(i),Nt.forEach(i),xe.forEach(i),Pe=c(e),w=a(e,"H2",{class:!0});var Ae=r(w);$=a(Ae,"A",{id:!0,class:!0,href:!0});var Gt=r($);ue=a(Gt,"SPAN",{});var Ut=r(ue);K(O.$$.fragment,Ut),Ut.forEach(i),Gt.forEach(i),nt=c(Ae),me=a(Ae,"SPAN",{});var Wt=r(me);st=d(Wt,"DDIMPipeline"),Wt.forEach(i),Ae.forEach(i),Ie=c(e),h=a(e,"DIV",{class:!0});var V=r(h);K(C.$$.fragment,V),lt=c(V),L=a(V,"P",{});var Se=r(L);dt=d(Se,"This model inherits from "),B=a(Se,"A",{href:!0});var zt=r(B);pt=d(zt,"DiffusionPipeline"),zt.forEach(i),ct=d(Se,`. 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.)`),Se.forEach(i),ft=c(V),F=a(V,"DIV",{class:!0});var Bt=r(F);K(H.$$.fragment,Bt),Bt.forEach(i),V.forEach(i),this.h()},h(){n(m,"name","hf:doc:metadata"),n(m,"content",JSON.stringify(Xt)),n(y,"id","ddim"),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","#ddim"),n(g,"class","relative group"),n(M,"id","overview"),n(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"),n(M,"href","#overview"),n(v,"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(S,"href","https://tsong.me/"),n(S,"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(_,"class","relative group"),n(W,"align","center"),n(q,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ddim/pipeline_ddim.py"),n(q,"rel","nofollow"),n(z,"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(w,"class","relative group"),n(B,"href","/docs/diffusers/main/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),n(F,"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){t(document.head,m),f(e,ge,s),f(e,g,s),t(g,y),t(y,te),Q(E,te,null),t(g,qe),t(g,ie),t(ie,Oe),f(e,ve,s),f(e,v,s),t(v,M),t(M,oe),Q(T,oe,null),t(v,Ce),t(v,ae),t(ae,Le),f(e,_e,s),f(e,k,s),t(k,x),t(x,He),t(k,Ge),f(e,De,s),f(e,G,s),t(G,Ue),f(e,be,s),f(e,U,s),t(U,We),f(e,we,s),f(e,u,s),t(u,ze),t(u,A),t(A,Be),t(u,Fe),t(u,S),t(S,Je),t(u,Re),f(e,ye,s),f(e,_,s),t(_,P),t(P,re),Q(N,re,null),t(_,je),t(_,ne),t(ne,Ve),f(e,Me,s),f(e,I,s),t(I,se),t(se,D),t(D,le),t(le,Ye),t(D,Ke),t(D,de),t(de,Qe),t(D,Xe),t(D,W),t(W,Ze),t(I,et),t(I,pe),t(pe,b),t(b,ce),t(ce,q),t(q,tt),t(b,it),t(b,fe),t(fe,he),t(he,ot),t(b,at),t(b,z),t(z,rt),f(e,Pe,s),f(e,w,s),t(w,$),t($,ue),Q(O,ue,null),t(w,nt),t(w,me),t(me,st),f(e,Ie,s),f(e,h,s),Q(C,h,null),t(h,lt),t(h,L),t(L,dt),t(L,B),t(B,pt),t(L,ct),t(h,ft),t(h,F),Q(H,F,null),$e=!0},p:Yt,i(e){$e||(X(E.$$.fragment,e),X(T.$$.fragment,e),X(N.$$.fragment,e),X(O.$$.fragment,e),X(C.$$.fragment,e),X(H.$$.fragment,e),$e=!0)},o(e){Z(E.$$.fragment,e),Z(T.$$.fragment,e),Z(N.$$.fragment,e),Z(O.$$.fragment,e),Z(C.$$.fragment,e),Z(H.$$.fragment,e),$e=!1},d(e){i(m),e&&i(ge),e&&i(g),ee(E),e&&i(ve),e&&i(v),ee(T),e&&i(_e),e&&i(k),e&&i(De),e&&i(G),e&&i(be),e&&i(U),e&&i(we),e&&i(u),e&&i(ye),e&&i(_),ee(N),e&&i(Me),e&&i(I),e&&i(Pe),e&&i(w),ee(O),e&&i(Ie),e&&i(h),ee(C),ee(H)}}}const Xt={local:"ddim",sections:[{local:"overview",title:"Overview"},{local:"available-pipelines",title:"Available Pipelines:"},{local:"diffusers.DDIMPipeline",title:"DDIMPipeline"}],title:"DDIM"};function Zt(ut){return Kt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class oi extends Jt{constructor(m){super();Rt(this,m,Zt,Qt,jt,{})}}export{oi as default,Xt as metadata};
