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