Buckets:
| import{s as De,o as xe,n as we}from"../chunks/scheduler.53228c21.js";import{S as Ce,i as Ie,e as l,s as i,c as _,h as Te,a as p,d as n,b as a,f as W,g as $,j as v,k as z,l as u,m as s,n as M,t as P,o as y,p as D}from"../chunks/index.100fac89.js";import{C as Ue}from"../chunks/CopyLLMTxtMenu.1d00620a.js";import{D as ue}from"../chunks/Docstring.b7f7431d.js";import{C as je}from"../chunks/CodeBlock.d30a6509.js";import{E as Le}from"../chunks/ExampleCodeBlock.272eeb83.js";import{H as fe,E as Se}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.24abbec9.js";function ke(R){let o,I="Example:",h,m,c;return m=new je({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(){o=l("p"),o.textContent=I,h=i(),_(m.$$.fragment)},l(r){o=p(r,"P",{"data-svelte-h":!0}),v(o)!=="svelte-11lpom8"&&(o.textContent=I),h=a(r),$(m.$$.fragment,r)},m(r,f){s(r,o,f),s(r,h,f),M(m,r,f),c=!0},p:we,i(r){c||(P(m.$$.fragment,r),c=!0)},o(r){y(m.$$.fragment,r),c=!1},d(r){r&&(n(o),n(h)),D(m,r)}}}function Ee(R){let o,I,h,m,c,r,f,V,T,ge='<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.',A,U,he="The abstract from the paper is:",X,j,be="<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>",Q,L,_e='The original codebase can be found at <a href="https://github.com/hojonathanho/diffusion" rel="nofollow">hohonathanho/diffusion</a>.',Y,w,$e='<p>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.</p>',K,S,ee,d,k,oe,O,ve="Pipeline for image generation.",le,H,Me=`This model inherits from <a href="/docs/diffusers/v0.36.0/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.).`,pe,b,E,de,q,Pe="The call function to the pipeline for generation.",me,C,te,G,ne,x,Z,ce,J,ye="Output class for image pipelines.",se,B,ie,F,ae;return c=new Ue({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),f=new fe({props:{title:"DDPM",local:"ddpm",headingTag:"h1"}}),S=new fe({props:{title:"DDPMPipeline",local:"diffusers.DDPMPipeline",headingTag:"h1"}}),k=new ue({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/v0.36.0/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/v0.36.0/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/v0.36.0/en/api/schedulers/ddpm#diffusers.DDPMScheduler">DDPMScheduler</a>, or <a href="/docs/diffusers/v0.36.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.36.0/src/diffusers/pipelines/ddpm/pipeline_ddpm.py#L35"}}),E=new ue({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/v0.36.0/en/api/pipelines/ddim#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.36.0/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/v0.36.0/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/v0.36.0/en/api/pipelines/ddim#diffusers.ImagePipelineOutput" | |
| >ImagePipelineOutput</a> or <code>tuple</code></p> | |
| `}}),C=new Le({props:{anchor:"diffusers.DDPMPipeline.__call__.example",$$slots:{default:[ke]},$$scope:{ctx:R}}}),G=new fe({props:{title:"ImagePipelineOutput",local:"diffusers.ImagePipelineOutput",headingTag:"h2"}}),Z=new ue({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/v0.36.0/src/diffusers/pipelines/pipeline_utils.py#L118"}}),B=new Se({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/ddpm.md"}}),{c(){o=l("meta"),I=i(),h=l("p"),m=i(),_(c.$$.fragment),r=i(),_(f.$$.fragment),V=i(),T=l("p"),T.innerHTML=ge,A=i(),U=l("p"),U.textContent=he,X=i(),j=l("p"),j.innerHTML=be,Q=i(),L=l("p"),L.innerHTML=_e,Y=i(),w=l("blockquote"),w.innerHTML=$e,K=i(),_(S.$$.fragment),ee=i(),d=l("div"),_(k.$$.fragment),oe=i(),O=l("p"),O.textContent=ve,le=i(),H=l("p"),H.innerHTML=Me,pe=i(),b=l("div"),_(E.$$.fragment),de=i(),q=l("p"),q.textContent=Pe,me=i(),_(C.$$.fragment),te=i(),_(G.$$.fragment),ne=i(),x=l("div"),_(Z.$$.fragment),ce=i(),J=l("p"),J.textContent=ye,se=i(),_(B.$$.fragment),ie=i(),F=l("p"),this.h()},l(e){const t=Te("svelte-u9bgzb",document.head);o=p(t,"META",{name:!0,content:!0}),t.forEach(n),I=a(e),h=p(e,"P",{}),W(h).forEach(n),m=a(e),$(c.$$.fragment,e),r=a(e),$(f.$$.fragment,e),V=a(e),T=p(e,"P",{"data-svelte-h":!0}),v(T)!=="svelte-1n7ba1u"&&(T.innerHTML=ge),A=a(e),U=p(e,"P",{"data-svelte-h":!0}),v(U)!=="svelte-1cwsb16"&&(U.textContent=he),X=a(e),j=p(e,"P",{"data-svelte-h":!0}),v(j)!=="svelte-lc79cq"&&(j.innerHTML=be),Q=a(e),L=p(e,"P",{"data-svelte-h":!0}),v(L)!=="svelte-si8dkt"&&(L.innerHTML=_e),Y=a(e),w=p(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),v(w)!=="svelte-r1jcqf"&&(w.innerHTML=$e),K=a(e),$(S.$$.fragment,e),ee=a(e),d=p(e,"DIV",{class:!0});var g=W(d);$(k.$$.fragment,g),oe=a(g),O=p(g,"P",{"data-svelte-h":!0}),v(O)!=="svelte-2egq7o"&&(O.textContent=ve),le=a(g),H=p(g,"P",{"data-svelte-h":!0}),v(H)!=="svelte-jyztt8"&&(H.innerHTML=Me),pe=a(g),b=p(g,"DIV",{class:!0});var N=W(b);$(E.$$.fragment,N),de=a(N),q=p(N,"P",{"data-svelte-h":!0}),v(q)!=="svelte-50j04k"&&(q.textContent=Pe),me=a(N),$(C.$$.fragment,N),N.forEach(n),g.forEach(n),te=a(e),$(G.$$.fragment,e),ne=a(e),x=p(e,"DIV",{class:!0});var re=W(x);$(Z.$$.fragment,re),ce=a(re),J=p(re,"P",{"data-svelte-h":!0}),v(J)!=="svelte-19wetgi"&&(J.textContent=ye),re.forEach(n),se=a(e),$(B.$$.fragment,e),ie=a(e),F=p(e,"P",{}),W(F).forEach(n),this.h()},h(){z(o,"name","hf:doc:metadata"),z(o,"content",Ge),z(w,"class","tip"),z(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),z(d,"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){u(document.head,o),s(e,I,t),s(e,h,t),s(e,m,t),M(c,e,t),s(e,r,t),M(f,e,t),s(e,V,t),s(e,T,t),s(e,A,t),s(e,U,t),s(e,X,t),s(e,j,t),s(e,Q,t),s(e,L,t),s(e,Y,t),s(e,w,t),s(e,K,t),M(S,e,t),s(e,ee,t),s(e,d,t),M(k,d,null),u(d,oe),u(d,O),u(d,le),u(d,H),u(d,pe),u(d,b),M(E,b,null),u(b,de),u(b,q),u(b,me),M(C,b,null),s(e,te,t),M(G,e,t),s(e,ne,t),s(e,x,t),M(Z,x,null),u(x,ce),u(x,J),s(e,se,t),M(B,e,t),s(e,ie,t),s(e,F,t),ae=!0},p(e,[t]){const g={};t&2&&(g.$$scope={dirty:t,ctx:e}),C.$set(g)},i(e){ae||(P(c.$$.fragment,e),P(f.$$.fragment,e),P(S.$$.fragment,e),P(k.$$.fragment,e),P(E.$$.fragment,e),P(C.$$.fragment,e),P(G.$$.fragment,e),P(Z.$$.fragment,e),P(B.$$.fragment,e),ae=!0)},o(e){y(c.$$.fragment,e),y(f.$$.fragment,e),y(S.$$.fragment,e),y(k.$$.fragment,e),y(E.$$.fragment,e),y(C.$$.fragment,e),y(G.$$.fragment,e),y(Z.$$.fragment,e),y(B.$$.fragment,e),ae=!1},d(e){e&&(n(I),n(h),n(m),n(r),n(V),n(T),n(A),n(U),n(X),n(j),n(Q),n(L),n(Y),n(w),n(K),n(ee),n(d),n(te),n(ne),n(x),n(se),n(ie),n(F)),n(o),D(c,e),D(f,e),D(S,e),D(k),D(E),D(C),D(G,e),D(Z),D(B,e)}}}const Ge='{"title":"DDPM","local":"ddpm","sections":[],"depth":1}';function Ze(R){return xe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Fe extends Ce{constructor(o){super(),Ie(this,o,Ze,Ee,De,{})}}export{Fe as component}; | |
Xet Storage Details
- Size:
- 13.1 kB
- Xet hash:
- 91f8131f97ef0997464fe6300d2bdec1fbe1ba09d31908bfff33e7d18d9ec55d
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.