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 n,d as t,m as d,a,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,ne,We,Pe,E,ae,_,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,nt,we,c,L,at,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/v0.12.0/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/v0.12.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.12.0/en/api/schedulers/ddpm#diffusers.DDPMScheduler">DDPMScheduler</a>, or <a href="/docs/diffusers/v0.12.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.12.0/src/diffusers/pipelines/ddpm/pipeline_ddpm.py#L25"}}),C=new Ut({props:{name:"__call__",anchor:"diffusers.DDPMPipeline.__call__",parameters:[{name:"batch_size",val:": int = 1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"num_inference_steps",val:": int = 1000"},{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;
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.DDPMPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1000) &#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.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/v0.12.0/en/api/diffusion_pipeline#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.12.0/src/diffusers/pipelines/ddpm/pipeline_ddpm.py#L41",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.12.0/en/api/diffusion_pipeline#diffusers.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(),ne=i("span"),We=p("Available Pipelines:"),Pe=l(),E=i("table"),ae=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"),nt=p("DDPMPipeline"),we=l(),c=i("div"),B(L.$$.fragment),at=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=n(s,"META",{name:!0,content:!0}),s.forEach(t),ue=d(e),m=n(e,"H1",{class:!0});var Ee=a(m);P=n(Ee,"A",{id:!0,class:!0,href:!0});var ht=a(P);Z=n(ht,"SPAN",{});var ct=a(Z);V(A.$$.fragment,ct),ct.forEach(t),ht.forEach(t),Ne=d(Ee),ee=n(Ee,"SPAN",{});var ut=a(ee);Oe=f(ut,"DDPM"),ut.forEach(t),Ee.forEach(t),me=d(e),v=n(e,"H2",{class:!0});var Me=a(v);y=n(Me,"A",{id:!0,class:!0,href:!0});var mt=a(y);te=n(mt,"SPAN",{});var vt=a(te);V(T.$$.fragment,vt),vt.forEach(t),mt.forEach(t),Le=d(Me),re=n(Me,"SPAN",{});var gt=a(re);qe=f(gt,"Overview"),gt.forEach(t),Me.forEach(t),ve=d(e),x=n(e,"P",{});var pt=a(x);I=n(pt,"A",{href:!0,rel:!0});var _t=a(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=n(e,"P",{});var bt=a(H);Ge=f(bt,"The abstract of the paper is the following:"),bt.forEach(t),_e=d(e),G=n(e,"P",{});var Dt=a(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=n(e,"P",{});var Ae=a(w);ze=f(Ae,"The original codebase of this paper can be found "),k=n(Ae,"A",{href:!0,rel:!0});var Pt=a(k);Je=f(Pt,"here"),Pt.forEach(t),Re=f(Ae,"."),Ae.forEach(t),De=d(e),g=n(e,"H2",{class:!0});var Te=a(g);$=n(Te,"A",{id:!0,class:!0,href:!0});var yt=a($);ie=n(yt,"SPAN",{});var wt=a(ie);V(S.$$.fragment,wt),wt.forEach(t),yt.forEach(t),Fe=d(Te),ne=n(Te,"SPAN",{});var $t=a(ne);We=f($t,"Available Pipelines:"),$t.forEach(t),Te.forEach(t),Pe=d(e),E=n(e,"TABLE",{});var xe=a(E);ae=n(xe,"THEAD",{});var Et=a(ae);_=n(Et,"TR",{});var F=a(_);oe=n(F,"TH",{});var Mt=a(oe);je=f(Mt,"Pipeline"),Mt.forEach(t),Be=d(F),se=n(F,"TH",{});var At=a(se);Ve=f(At,"Tasks"),At.forEach(t),Ye=d(F),U=n(F,"TH",{align:!0});var Tt=a(U);Ke=f(Tt,"Colab"),Tt.forEach(t),F.forEach(t),Et.forEach(t),Qe=d(xe),le=n(xe,"TBODY",{});var xt=a(le);b=n(xt,"TR",{});var W=a(b);de=n(W,"TD",{});var It=a(de);N=n(It,"A",{href:!0,rel:!0});var kt=a(N);Xe=f(kt,"pipeline_ddpm.py"),kt.forEach(t),It.forEach(t),Ze=d(W),pe=n(W,"TD",{});var St=a(pe);fe=n(St,"EM",{});var Nt=a(fe);et=f(Nt,"Unconditional Image Generation"),Nt.forEach(t),St.forEach(t),tt=d(W),z=n(W,"TD",{align:!0});var Ot=a(z);rt=f(Ot,"-"),Ot.forEach(t),W.forEach(t),xt.forEach(t),xe.forEach(t),ye=d(e),D=n(e,"H1",{class:!0});var Ie=a(D);M=n(Ie,"A",{id:!0,class:!0,href:!0});var Lt=a(M);he=n(Lt,"SPAN",{});var qt=a(he);V(O.$$.fragment,qt),qt.forEach(t),Lt.forEach(t),it=d(Ie),ce=n(Ie,"SPAN",{});var Ct=a(ce);nt=f(Ct,"DDPMPipeline"),Ct.forEach(t),Ie.forEach(t),we=d(e),c=n(e,"DIV",{class:!0});var j=a(c);V(L.$$.fragment,j),at=d(j),q=n(j,"P",{});var ke=a(q);ot=f(ke,"This model inherits from "),J=n(ke,"A",{href:!0});var Ht=a(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=n(j,"DIV",{class:!0});var Gt=a(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/v0.12.0/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,ne),r(ne,We),h(e,Pe,s),h(e,E,s),r(E,ae),r(ae,_),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,nt),h(e,we,s),h(e,c,s),Y(L,c,null),r(c,at),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};
