import{S as zt,i as Jt,s as Rt,e as i,k as l,w as B,t as p,M as Ft,c as a,d as t,m as d,a as n,x as V,h as f,b as o,G as r,g as h,y as Y,L as Wt,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 Bt(ft){let u,ue,m,P,Z,A,Ne,ee,Oe,me,v,y,te,T,Le,re,qe,ve,x,I,Ce,He,ge,H,Ge,_e,G,Ue,be,w,ze,k,Je,Re,De,g,$,ie,S,Fe,ae,We,Pe,E,ne,_,oe,je,Be,se,Ve,Ye,U,Ke,Qe,le,b,de,N,Xe,Ze,pe,fe,et,tt,z,rt,ye,D,M,he,O,it,ce,at,we,c,L,nt,q,ot,J,st,lt,dt,R,C,$e;return A=new Se({}),T=new Se({}),S=new Se({}),O=new Se({}),L=new Ut({props:{name:"class diffusers.DDPMPipeline",anchor:"diffusers.DDPMPipeline",parameters:[{name:"unet",val:""},{name:"scheduler",val:""}],parametersDescription:[{anchor:"diffusers.DDPMPipeline.unet",description:'<strong>unet</strong> (<a href="/docs/diffusers/pr_9/en/api/models#diffusers.UNet2DModel">UNet2DModel</a>) &#x2014; U-Net architecture to denoise the encoded image.',name:"unet"},{anchor:"diffusers.DDPMPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/pr_9/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_9/en/api/schedulers#diffusers.DDPMScheduler">DDPMScheduler</a>, or <a href="/docs/diffusers/pr_9/en/api/schedulers#diffusers.DDIMScheduler">DDIMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/vr_9/src/diffusers/pipelines/ddpm/pipeline_ddpm.py#L24"}}),C=new Ut({props:{name:"__call__",anchor:"diffusers.DDPMPipeline.__call__",parameters:[{name:"batch_size",val:": int = 1"},{name:"generator",val:": typing.Optional[torch._C.Generator] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.DDPMPipeline.__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.DDPMPipeline.__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.DDPMPipeline.__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.DDPMPipeline.__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_9/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_9/src/diffusers/pipelines/ddpm/pipeline_ddpm.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_9/en/api/diffusion_pipeline#diffusers.pipeline_utils.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),{c(){u=i("meta"),ue=l(),m=i("h1"),P=i("a"),Z=i("span"),B(A.$$.fragment),Ne=l(),ee=i("span"),Oe=p("DDPM"),me=l(),v=i("h2"),y=i("a"),te=i("span"),B(T.$$.fragment),Le=l(),re=i("span"),qe=p("Overview"),ve=l(),x=i("p"),I=i("a"),Ce=p("Denoising Diffusion Probabilistic Models"),He=p(`
(DDPM) by Jonathan Ho, Ajay Jain and Pieter Abbeel proposes the diffusion based model of the same name, but in the context of the \u{1F917} Diffusers library, DDPM refers to the discrete denoising scheduler from the paper as well as the pipeline.`),ge=l(),H=i("p"),Ge=p("The abstract of the paper is the following:"),_e=l(),G=i("p"),Ue=p("We present high quality image synthesis results using diffusion probabilistic models, a class of latent variable models inspired by considerations from nonequilibrium thermodynamics. Our best results are obtained by training on a weighted variational bound designed according to a novel connection between diffusion probabilistic models and denoising score matching with Langevin dynamics, and our models naturally admit a progressive lossy decompression scheme that can be interpreted as a generalization of autoregressive decoding. On the unconditional CIFAR10 dataset, we obtain an Inception score of 9.46 and a state-of-the-art FID score of 3.17. On 256x256 LSUN, we obtain sample quality similar to ProgressiveGAN."),be=l(),w=i("p"),ze=p("The original codebase of this paper can be found "),k=i("a"),Je=p("here"),Re=p("."),De=l(),g=i("h2"),$=i("a"),ie=i("span"),B(S.$$.fragment),Fe=l(),ae=i("span"),We=p("Available Pipelines:"),Pe=l(),E=i("table"),ne=i("thead"),_=i("tr"),oe=i("th"),je=p("Pipeline"),Be=l(),se=i("th"),Ve=p("Tasks"),Ye=l(),U=i("th"),Ke=p("Colab"),Qe=l(),le=i("tbody"),b=i("tr"),de=i("td"),N=i("a"),Xe=p("pipeline_ddpm.py"),Ze=l(),pe=i("td"),fe=i("em"),et=p("Unconditional Image Generation"),tt=l(),z=i("td"),rt=p("-"),ye=l(),D=i("h1"),M=i("a"),he=i("span"),B(O.$$.fragment),it=l(),ce=i("span"),at=p("DDPMPipeline"),we=l(),c=i("div"),B(L.$$.fragment),nt=l(),q=i("p"),ot=p("This model inherits from "),J=i("a"),st=p("DiffusionPipeline"),lt=p(`. 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.)`),dt=l(),R=i("div"),B(C.$$.fragment),this.h()},l(e){const s=Ft('[data-svelte="svelte-1phssyn"]',document.head);u=a(s,"META",{name:!0,content:!0}),s.forEach(t),ue=d(e),m=a(e,"H1",{class:!0});var Ee=n(m);P=a(Ee,"A",{id:!0,class:!0,href:!0});var ht=n(P);Z=a(ht,"SPAN",{});var ct=n(Z);V(A.$$.fragment,ct),ct.forEach(t),ht.forEach(t),Ne=d(Ee),ee=a(Ee,"SPAN",{});var ut=n(ee);Oe=f(ut,"DDPM"),ut.forEach(t),Ee.forEach(t),me=d(e),v=a(e,"H2",{class:!0});var Me=n(v);y=a(Me,"A",{id:!0,class:!0,href:!0});var mt=n(y);te=a(mt,"SPAN",{});var vt=n(te);V(T.$$.fragment,vt),vt.forEach(t),mt.forEach(t),Le=d(Me),re=a(Me,"SPAN",{});var gt=n(re);qe=f(gt,"Overview"),gt.forEach(t),Me.forEach(t),ve=d(e),x=a(e,"P",{});var pt=n(x);I=a(pt,"A",{href:!0,rel:!0});var _t=n(I);Ce=f(_t,"Denoising Diffusion Probabilistic Models"),_t.forEach(t),He=f(pt,`
(DDPM) by Jonathan Ho, Ajay Jain and Pieter Abbeel proposes the diffusion based model of the same name, but in the context of the \u{1F917} Diffusers library, DDPM refers to the discrete denoising scheduler from the paper as well as the pipeline.`),pt.forEach(t),ge=d(e),H=a(e,"P",{});var bt=n(H);Ge=f(bt,"The abstract of the paper is the following:"),bt.forEach(t),_e=d(e),G=a(e,"P",{});var Dt=n(G);Ue=f(Dt,"We present high quality image synthesis results using diffusion probabilistic models, a class of latent variable models inspired by considerations from nonequilibrium thermodynamics. Our best results are obtained by training on a weighted variational bound designed according to a novel connection between diffusion probabilistic models and denoising score matching with Langevin dynamics, and our models naturally admit a progressive lossy decompression scheme that can be interpreted as a generalization of autoregressive decoding. On the unconditional CIFAR10 dataset, we obtain an Inception score of 9.46 and a state-of-the-art FID score of 3.17. On 256x256 LSUN, we obtain sample quality similar to ProgressiveGAN."),Dt.forEach(t),be=d(e),w=a(e,"P",{});var Ae=n(w);ze=f(Ae,"The original codebase of this paper can be found "),k=a(Ae,"A",{href:!0,rel:!0});var Pt=n(k);Je=f(Pt,"here"),Pt.forEach(t),Re=f(Ae,"."),Ae.forEach(t),De=d(e),g=a(e,"H2",{class:!0});var Te=n(g);$=a(Te,"A",{id:!0,class:!0,href:!0});var yt=n($);ie=a(yt,"SPAN",{});var wt=n(ie);V(S.$$.fragment,wt),wt.forEach(t),yt.forEach(t),Fe=d(Te),ae=a(Te,"SPAN",{});var $t=n(ae);We=f($t,"Available Pipelines:"),$t.forEach(t),Te.forEach(t),Pe=d(e),E=a(e,"TABLE",{});var xe=n(E);ne=a(xe,"THEAD",{});var Et=n(ne);_=a(Et,"TR",{});var F=n(_);oe=a(F,"TH",{});var Mt=n(oe);je=f(Mt,"Pipeline"),Mt.forEach(t),Be=d(F),se=a(F,"TH",{});var At=n(se);Ve=f(At,"Tasks"),At.forEach(t),Ye=d(F),U=a(F,"TH",{align:!0});var Tt=n(U);Ke=f(Tt,"Colab"),Tt.forEach(t),F.forEach(t),Et.forEach(t),Qe=d(xe),le=a(xe,"TBODY",{});var xt=n(le);b=a(xt,"TR",{});var W=n(b);de=a(W,"TD",{});var It=n(de);N=a(It,"A",{href:!0,rel:!0});var kt=n(N);Xe=f(kt,"pipeline_ddpm.py"),kt.forEach(t),It.forEach(t),Ze=d(W),pe=a(W,"TD",{});var St=n(pe);fe=a(St,"EM",{});var Nt=n(fe);et=f(Nt,"Unconditional Image Generation"),Nt.forEach(t),St.forEach(t),tt=d(W),z=a(W,"TD",{align:!0});var Ot=n(z);rt=f(Ot,"-"),Ot.forEach(t),W.forEach(t),xt.forEach(t),xe.forEach(t),ye=d(e),D=a(e,"H1",{class:!0});var Ie=n(D);M=a(Ie,"A",{id:!0,class:!0,href:!0});var Lt=n(M);he=a(Lt,"SPAN",{});var qt=n(he);V(O.$$.fragment,qt),qt.forEach(t),Lt.forEach(t),it=d(Ie),ce=a(Ie,"SPAN",{});var Ct=n(ce);at=f(Ct,"DDPMPipeline"),Ct.forEach(t),Ie.forEach(t),we=d(e),c=a(e,"DIV",{class:!0});var j=n(c);V(L.$$.fragment,j),nt=d(j),q=a(j,"P",{});var ke=n(q);ot=f(ke,"This model inherits from "),J=a(ke,"A",{href:!0});var Ht=n(J);st=f(Ht,"DiffusionPipeline"),Ht.forEach(t),lt=f(ke,`. 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.)`),ke.forEach(t),dt=d(j),R=a(j,"DIV",{class:!0});var Gt=n(R);V(C.$$.fragment,Gt),Gt.forEach(t),j.forEach(t),this.h()},h(){o(u,"name","hf:doc:metadata"),o(u,"content",JSON.stringify(Vt)),o(P,"id","ddpm"),o(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"),o(P,"href","#ddpm"),o(m,"class","relative group"),o(y,"id","overview"),o(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"),o(y,"href","#overview"),o(v,"class","relative group"),o(I,"href","https://arxiv.org/abs/2006.11239"),o(I,"rel","nofollow"),o(k,"href","https://github.com/hojonathanho/diffusion"),o(k,"rel","nofollow"),o($,"id","available-pipelines"),o($,"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"),o($,"href","#available-pipelines"),o(g,"class","relative group"),o(U,"align","center"),o(N,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/ddpm/pipeline_ddpm.py"),o(N,"rel","nofollow"),o(z,"align","center"),o(M,"id","diffusers.DDPMPipeline"),o(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"),o(M,"href","#diffusers.DDPMPipeline"),o(D,"class","relative group"),o(J,"href","/docs/diffusers/pr_9/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),o(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),o(c,"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){r(document.head,u),h(e,ue,s),h(e,m,s),r(m,P),r(P,Z),Y(A,Z,null),r(m,Ne),r(m,ee),r(ee,Oe),h(e,me,s),h(e,v,s),r(v,y),r(y,te),Y(T,te,null),r(v,Le),r(v,re),r(re,qe),h(e,ve,s),h(e,x,s),r(x,I),r(I,Ce),r(x,He),h(e,ge,s),h(e,H,s),r(H,Ge),h(e,_e,s),h(e,G,s),r(G,Ue),h(e,be,s),h(e,w,s),r(w,ze),r(w,k),r(k,Je),r(w,Re),h(e,De,s),h(e,g,s),r(g,$),r($,ie),Y(S,ie,null),r(g,Fe),r(g,ae),r(ae,We),h(e,Pe,s),h(e,E,s),r(E,ne),r(ne,_),r(_,oe),r(oe,je),r(_,Be),r(_,se),r(se,Ve),r(_,Ye),r(_,U),r(U,Ke),r(E,Qe),r(E,le),r(le,b),r(b,de),r(de,N),r(N,Xe),r(b,Ze),r(b,pe),r(pe,fe),r(fe,et),r(b,tt),r(b,z),r(z,rt),h(e,ye,s),h(e,D,s),r(D,M),r(M,he),Y(O,he,null),r(D,it),r(D,ce),r(ce,at),h(e,we,s),h(e,c,s),Y(L,c,null),r(c,nt),r(c,q),r(q,ot),r(q,J),r(J,st),r(q,lt),r(c,dt),r(c,R),Y(C,R,null),$e=!0},p:Wt,i(e){$e||(K(A.$$.fragment,e),K(T.$$.fragment,e),K(S.$$.fragment,e),K(O.$$.fragment,e),K(L.$$.fragment,e),K(C.$$.fragment,e),$e=!0)},o(e){Q(A.$$.fragment,e),Q(T.$$.fragment,e),Q(S.$$.fragment,e),Q(O.$$.fragment,e),Q(L.$$.fragment,e),Q(C.$$.fragment,e),$e=!1},d(e){t(u),e&&t(ue),e&&t(m),X(A),e&&t(me),e&&t(v),X(T),e&&t(ve),e&&t(x),e&&t(ge),e&&t(H),e&&t(_e),e&&t(G),e&&t(be),e&&t(w),e&&t(De),e&&t(g),X(S),e&&t(Pe),e&&t(E),e&&t(ye),e&&t(D),X(O),e&&t(we),e&&t(c),X(L),X(C)}}}const Vt={local:"diffusers.DDPMPipeline",title:"DDPMPipeline"};function Yt(ft){return jt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Zt extends zt{constructor(u){super();Jt(this,u,Yt,Bt,Rt,{})}}export{Zt as default,Vt as metadata};
