Buckets:
| import{s as ve,o as De,n as Me}from"../chunks/scheduler.8c3d61f6.js";import{S as ye,i as we,g as p,s as a,r as b,A as xe,h as d,f as n,c as r,j as W,u as P,x as w,k as z,y as f,a as i,v as M,d as v,t as D,w as y}from"../chunks/index.da70eac4.js";import{T as Ie}from"../chunks/Tip.1d9b8c37.js";import{D as me}from"../chunks/Docstring.0b9cc58b.js";import{C as Te}from"../chunks/CodeBlock.a9c4becf.js";import{E as Ce}from"../chunks/ExampleCodeBlock.ba0ba69d.js";import{H as ce,E as Ue}from"../chunks/index.a831177d.js";function je(H){let s,_='Make sure to check out the Schedulers <a href="../../using-diffusers/schedulers">guide</a> to learn how to explore the tradeoff between scheduler speed and quality, and see the <a href="../../using-diffusers/loading#reuse-a-pipeline">reuse components across pipelines</a> section to learn how to efficiently load the same components into multiple pipelines.';return{c(){s=p("p"),s.innerHTML=_},l(l){s=d(l,"P",{"data-svelte-h":!0}),w(s)!=="svelte-1qn15hi"&&(s.innerHTML=_)},m(l,m){i(l,s,m)},p:Me,d(l){l&&n(s)}}}function Se(H){let s,_="Example:",l,m,u;return m=new Te({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEREUE1QaXBlbGluZSUwQSUwQSUyMyUyMGxvYWQlMjBtb2RlbCUyMGFuZCUyMHNjaGVkdWxlciUwQXBpcGUlMjAlM0QlMjBERFBNUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRmRkcG0tY2F0LTI1NiUyMiklMEElMEElMjMlMjBydW4lMjBwaXBlbGluZSUyMGluJTIwaW5mZXJlbmNlJTIwKHNhbXBsZSUyMHJhbmRvbSUyMG5vaXNlJTIwYW5kJTIwZGVub2lzZSklMEFpbWFnZSUyMCUzRCUyMHBpcGUoKS5pbWFnZXMlNUIwJTVEJTBBJTBBJTIzJTIwc2F2ZSUyMGltYWdlJTBBaW1hZ2Uuc2F2ZSglMjJkZHBtX2dlbmVyYXRlZF9pbWFnZS5wbmclMjIp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DDPMPipeline | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># load model and scheduler</span> | |
| <span class="hljs-meta">>>> </span>pipe = DDPMPipeline.from_pretrained(<span class="hljs-string">"google/ddpm-cat-256"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># run pipeline in inference (sample random noise and denoise)</span> | |
| <span class="hljs-meta">>>> </span>image = pipe().images[<span class="hljs-number">0</span>] | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># save image</span> | |
| <span class="hljs-meta">>>> </span>image.save(<span class="hljs-string">"ddpm_generated_image.png"</span>)`,wrap:!1}}),{c(){s=p("p"),s.textContent=_,l=a(),b(m.$$.fragment)},l(o){s=d(o,"P",{"data-svelte-h":!0}),w(s)!=="svelte-11lpom8"&&(s.textContent=_),l=r(o),P(m.$$.fragment,o)},m(o,g){i(o,s,g),i(o,l,g),M(m,o,g),u=!0},p:Me,i(o){u||(v(m.$$.fragment,o),u=!0)},o(o){D(m.$$.fragment,o),u=!1},d(o){o&&(n(s),n(l)),y(m,o)}}}function Le(H){let s,_,l,m,u,o,g,ue='<a href="https://huggingface.co/papers/2006.11239" rel="nofollow">Denoising Diffusion Probabilistic Models</a> (DDPM) by Jonathan Ho, Ajay Jain and Pieter Abbeel proposes a diffusion based model of the same name. In the 🤗 Diffusers library, DDPM refers to the <em>discrete denoising scheduler</em> from the paper as well as the pipeline.',R,U,fe="The abstract from the paper is:",V,j,ge="<em>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.</em>",A,S,he='The original codebase can be found at <a href="https://github.com/hojonathanho/diffusion" rel="nofollow">hohonathanho/diffusion</a>.',X,T,Q,L,Y,c,G,ae,J,_e="Pipeline for image generation.",re,O,$e=`This model inherits from <a href="/docs/diffusers/pr_11477/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a>. Check the superclass documentation for the generic methods | |
| implemented for all pipelines (downloading, saving, running on a particular device, etc.).`,oe,$,E,le,N,be="The call function to the pipeline for generation.",pe,C,K,k,ee,x,Z,de,q,Pe="Output class for image pipelines.",te,B,ne,F,se;return u=new ce({props:{title:"DDPM",local:"ddpm",headingTag:"h1"}}),T=new Ie({props:{$$slots:{default:[je]},$$scope:{ctx:H}}}),L=new ce({props:{title:"DDPMPipeline",local:"diffusers.DDPMPipeline",headingTag:"h1"}}),G=new me({props:{name:"class diffusers.DDPMPipeline",anchor:"diffusers.DDPMPipeline",parameters:[{name:"unet",val:": UNet2DModel"},{name:"scheduler",val:": DDPMScheduler"}],parametersDescription:[{anchor:"diffusers.DDPMPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/pr_11477/en/api/models/unet2d#diffusers.UNet2DModel">UNet2DModel</a>) — | |
| A <code>UNet2DModel</code> to denoise the encoded image latents.`,name:"unet"},{anchor:"diffusers.DDPMPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/pr_11477/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a>) — | |
| 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_11477/en/api/schedulers/ddpm#diffusers.DDPMScheduler">DDPMScheduler</a>, or <a href="/docs/diffusers/pr_11477/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/vr_11477/src/diffusers/pipelines/ddpm/pipeline_ddpm.py#L35"}}),E=new me({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"}],parametersDescription:[{anchor:"diffusers.DDPMPipeline.__call__.batch_size",description:`<strong>batch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1) — | |
| 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>) — | |
| A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></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) — | |
| 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>"pil"</code>) — | |
| The output format of the generated image. Choose between <code>PIL.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>) — | |
| Whether or not to return a <a href="/docs/diffusers/pr_11477/en/api/pipelines/ddim#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_11477/src/diffusers/pipelines/ddpm/pipeline_ddpm.py#L56",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If <code>return_dict</code> is <code>True</code>, <a | |
| href="/docs/diffusers/pr_11477/en/api/pipelines/ddim#diffusers.ImagePipelineOutput" | |
| >ImagePipelineOutput</a> is returned, otherwise a <code>tuple</code> is | |
| returned where the first element is a list with the generated images</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/diffusers/pr_11477/en/api/pipelines/ddim#diffusers.ImagePipelineOutput" | |
| >ImagePipelineOutput</a> or <code>tuple</code></p> | |
| `}}),C=new Ce({props:{anchor:"diffusers.DDPMPipeline.__call__.example",$$slots:{default:[Se]},$$scope:{ctx:H}}}),k=new ce({props:{title:"ImagePipelineOutput",local:"diffusers.ImagePipelineOutput",headingTag:"h2"}}),Z=new me({props:{name:"class diffusers.ImagePipelineOutput",anchor:"diffusers.ImagePipelineOutput",parameters:[{name:"images",val:": typing.Union[typing.List[PIL.Image.Image], numpy.ndarray]"}],parametersDescription:[{anchor:"diffusers.ImagePipelineOutput.images",description:`<strong>images</strong> (<code>List[PIL.Image.Image]</code> or <code>np.ndarray</code>) — | |
| List of denoised PIL images of length <code>batch_size</code> or NumPy array of shape <code>(batch_size, height, width, num_channels)</code>.`,name:"images"}],source:"https://github.com/huggingface/diffusers/blob/vr_11477/src/diffusers/pipelines/pipeline_utils.py#L115"}}),B=new Ue({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/ddpm.md"}}),{c(){s=p("meta"),_=a(),l=p("p"),m=a(),b(u.$$.fragment),o=a(),g=p("p"),g.innerHTML=ue,R=a(),U=p("p"),U.textContent=fe,V=a(),j=p("p"),j.innerHTML=ge,A=a(),S=p("p"),S.innerHTML=he,X=a(),b(T.$$.fragment),Q=a(),b(L.$$.fragment),Y=a(),c=p("div"),b(G.$$.fragment),ae=a(),J=p("p"),J.textContent=_e,re=a(),O=p("p"),O.innerHTML=$e,oe=a(),$=p("div"),b(E.$$.fragment),le=a(),N=p("p"),N.textContent=be,pe=a(),b(C.$$.fragment),K=a(),b(k.$$.fragment),ee=a(),x=p("div"),b(Z.$$.fragment),de=a(),q=p("p"),q.textContent=Pe,te=a(),b(B.$$.fragment),ne=a(),F=p("p"),this.h()},l(e){const t=xe("svelte-u9bgzb",document.head);s=d(t,"META",{name:!0,content:!0}),t.forEach(n),_=r(e),l=d(e,"P",{}),W(l).forEach(n),m=r(e),P(u.$$.fragment,e),o=r(e),g=d(e,"P",{"data-svelte-h":!0}),w(g)!=="svelte-1n7ba1u"&&(g.innerHTML=ue),R=r(e),U=d(e,"P",{"data-svelte-h":!0}),w(U)!=="svelte-1cwsb16"&&(U.textContent=fe),V=r(e),j=d(e,"P",{"data-svelte-h":!0}),w(j)!=="svelte-lc79cq"&&(j.innerHTML=ge),A=r(e),S=d(e,"P",{"data-svelte-h":!0}),w(S)!=="svelte-si8dkt"&&(S.innerHTML=he),X=r(e),P(T.$$.fragment,e),Q=r(e),P(L.$$.fragment,e),Y=r(e),c=d(e,"DIV",{class:!0});var h=W(c);P(G.$$.fragment,h),ae=r(h),J=d(h,"P",{"data-svelte-h":!0}),w(J)!=="svelte-2egq7o"&&(J.textContent=_e),re=r(h),O=d(h,"P",{"data-svelte-h":!0}),w(O)!=="svelte-25rx3g"&&(O.innerHTML=$e),oe=r(h),$=d(h,"DIV",{class:!0});var I=W($);P(E.$$.fragment,I),le=r(I),N=d(I,"P",{"data-svelte-h":!0}),w(N)!=="svelte-50j04k"&&(N.textContent=be),pe=r(I),P(C.$$.fragment,I),I.forEach(n),h.forEach(n),K=r(e),P(k.$$.fragment,e),ee=r(e),x=d(e,"DIV",{class:!0});var ie=W(x);P(Z.$$.fragment,ie),de=r(ie),q=d(ie,"P",{"data-svelte-h":!0}),w(q)!=="svelte-19wetgi"&&(q.textContent=Pe),ie.forEach(n),te=r(e),P(B.$$.fragment,e),ne=r(e),F=d(e,"P",{}),W(F).forEach(n),this.h()},h(){z(s,"name","hf:doc:metadata"),z(s,"content",Ge),z($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),z(c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),z(x,"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,t){f(document.head,s),i(e,_,t),i(e,l,t),i(e,m,t),M(u,e,t),i(e,o,t),i(e,g,t),i(e,R,t),i(e,U,t),i(e,V,t),i(e,j,t),i(e,A,t),i(e,S,t),i(e,X,t),M(T,e,t),i(e,Q,t),M(L,e,t),i(e,Y,t),i(e,c,t),M(G,c,null),f(c,ae),f(c,J),f(c,re),f(c,O),f(c,oe),f(c,$),M(E,$,null),f($,le),f($,N),f($,pe),M(C,$,null),i(e,K,t),M(k,e,t),i(e,ee,t),i(e,x,t),M(Z,x,null),f(x,de),f(x,q),i(e,te,t),M(B,e,t),i(e,ne,t),i(e,F,t),se=!0},p(e,[t]){const h={};t&2&&(h.$$scope={dirty:t,ctx:e}),T.$set(h);const I={};t&2&&(I.$$scope={dirty:t,ctx:e}),C.$set(I)},i(e){se||(v(u.$$.fragment,e),v(T.$$.fragment,e),v(L.$$.fragment,e),v(G.$$.fragment,e),v(E.$$.fragment,e),v(C.$$.fragment,e),v(k.$$.fragment,e),v(Z.$$.fragment,e),v(B.$$.fragment,e),se=!0)},o(e){D(u.$$.fragment,e),D(T.$$.fragment,e),D(L.$$.fragment,e),D(G.$$.fragment,e),D(E.$$.fragment,e),D(C.$$.fragment,e),D(k.$$.fragment,e),D(Z.$$.fragment,e),D(B.$$.fragment,e),se=!1},d(e){e&&(n(_),n(l),n(m),n(o),n(g),n(R),n(U),n(V),n(j),n(A),n(S),n(X),n(Q),n(Y),n(c),n(K),n(ee),n(x),n(te),n(ne),n(F)),n(s),y(u,e),y(T,e),y(L,e),y(G),y(E),y(C),y(k,e),y(Z),y(B,e)}}}const Ge='{"title":"DDPM","local":"ddpm","sections":[],"depth":1}';function Ee(H){return De(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class qe extends ye{constructor(s){super(),we(this,s,Ee,Le,ve,{})}}export{qe as component}; | |
Xet Storage Details
- Size:
- 13 kB
- Xet hash:
- 493e1a1f959c61788147cbf66ee3c069080c3dcedd9cb11f6a65183cf21929c2
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.