import{S as Ze,i as et,s as tt,e as r,k as c,w as G,t as f,M as at,c as s,d as t,m as d,a as i,x as C,h,b as o,G as a,g as p,y as U,q as z,o as F,B,v as rt}from"../../../chunks/vendor-hf-doc-builder.js";import{T as st}from"../../../chunks/Tip-hf-doc-builder.js";import{D as Oe}from"../../../chunks/Docstring-hf-doc-builder.js";import{I as Ne}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function it(se){let l,T,u,_,b,m,K,P;return{c(){l=r("p"),T=f("Make sure to check out the Schedulers "),u=r("a"),_=f("guide"),b=f(" to learn how to explore the tradeoff between scheduler speed and quality, and see the "),m=r("a"),K=f("reuse components across pipelines"),P=f(" section to learn how to efficiently load the same components into multiple pipelines."),this.h()},l(E){l=s(E,"P",{});var g=i(l);T=h(g,"Make sure to check out the Schedulers "),u=s(g,"A",{href:!0});var y=i(u);_=h(y,"guide"),y.forEach(t),b=h(g," to learn how to explore the tradeoff between scheduler speed and quality, and see the "),m=s(g,"A",{href:!0});var $=i(m);K=h($,"reuse components across pipelines"),$.forEach(t),P=h(g," section to learn how to efficiently load the same components into multiple pipelines."),g.forEach(t),this.h()},h(){o(u,"href","/using-diffusers/schedulers"),o(m,"href","/using-diffusers/loading#reuse-components-across-pipelines")},m(E,g){p(E,l,g),a(l,T),a(l,u),a(u,_),a(l,b),a(l,m),a(m,K),a(l,P)},d(E){E&&t(l)}}}function nt(se){let l,T,u,_,b,m,K,P,E,g,y,$,ge,_e,ie,H,ve,ne,R,j,ye,oe,V,le,k,S,Q,D,$e,X,we,pe,v,O,be,Y,Pe,Ee,w,N,ke,Z,Ie,xe,ee,Te,ce,I,A,te,L,Ve,ae,Se,de,x,M,Ae,re,Ke,ue;return m=new Ne({}),V=new st({props:{$$slots:{default:[it]},$$scope:{ctx:se}}}),D=new Ne({}),O=new Oe({props:{name:"class diffusers.KarrasVePipeline",anchor:"diffusers.KarrasVePipeline",parameters:[{name:"unet",val:": UNet2DModel"},{name:"scheduler",val:": KarrasVeScheduler"}],parametersDescription:[{anchor:"diffusers.KarrasVePipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/v0.21.0/en/api/models/unet2d#diffusers.UNet2DModel">UNet2DModel</a>) &#x2014;
A <code>UNet2DModel</code> to denoise the encoded image.`,name:"unet"},{anchor:"diffusers.KarrasVePipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.21.0/en/api/schedulers/stochastic_karras_ve#diffusers.KarrasVeScheduler">KarrasVeScheduler</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to denoise the encoded image.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/stochastic_karras_ve/pipeline_stochastic_karras_ve.py#L25"}}),N=new Oe({props:{name:"__call__",anchor:"diffusers.KarrasVePipeline.__call__",parameters:[{name:"batch_size",val:": int = 1"},{name:"num_inference_steps",val:": int = 50"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.KarrasVePipeline.__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.KarrasVePipeline.__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"><code>torch.Generator</code></a> to make
generation deterministic.`,name:"generator"},{anchor:"diffusers.KarrasVePipeline.__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.KarrasVePipeline.__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 generated image. Choose between <code>PIL.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.KarrasVePipeline.__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.21.0/en/api/pipelines/latent_diffusion_uncond#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.21.0/src/diffusers/pipelines/stochastic_karras_ve/pipeline_stochastic_karras_ve.py#L44",returnDescription:`
<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/v0.21.0/en/api/pipelines/latent_diffusion_uncond#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:`
<p><a
  href="/docs/diffusers/v0.21.0/en/api/pipelines/latent_diffusion_uncond#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),L=new Ne({}),M=new Oe({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>) &#x2014;
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.21.0/src/diffusers/pipelines/pipeline_utils.py#L112"}}),{c(){l=r("meta"),T=c(),u=r("h1"),_=r("a"),b=r("span"),G(m.$$.fragment),K=c(),P=r("span"),E=f("Stochastic Karras VE"),g=c(),y=r("p"),$=r("a"),ge=f("Elucidating the Design Space of Diffusion-Based Generative Models"),_e=f(" is by Tero Karras, Miika Aittala, Timo Aila and Samuli Laine. This pipeline implements the stochastic sampling tailored to variance expanding (VE) models."),ie=c(),H=r("p"),ve=f("The abstract from the paper:"),ne=c(),R=r("p"),j=r("em"),ye=f("We argue that the theory and practice of diffusion-based generative models are currently unnecessarily convoluted and seek to remedy the situation by presenting a design space that clearly separates the concrete design choices. This lets us identify several changes to both the sampling and training processes, as well as preconditioning of the score networks. Together, our improvements yield new state-of-the-art FID of 1.79 for CIFAR-10 in a class-conditional setting and 1.97 in an unconditional setting, with much faster sampling (35 network evaluations per image) than prior designs. To further demonstrate their modular nature, we show that our design changes dramatically improve both the efficiency and quality obtainable with pre-trained score networks from previous work, including improving the FID of an existing ImageNet-64 model from 2.07 to near-SOTA 1.55."),oe=c(),G(V.$$.fragment),le=c(),k=r("h2"),S=r("a"),Q=r("span"),G(D.$$.fragment),$e=c(),X=r("span"),we=f("KarrasVePipeline"),pe=c(),v=r("div"),G(O.$$.fragment),be=c(),Y=r("p"),Pe=f("Pipeline for unconditional image generation."),Ee=c(),w=r("div"),G(N.$$.fragment),ke=c(),Z=r("p"),Ie=f("The call function to the pipeline for generation."),xe=c(),ee=r("p"),Te=f("Example:"),ce=c(),I=r("h2"),A=r("a"),te=r("span"),G(L.$$.fragment),Ve=c(),ae=r("span"),Se=f("ImagePipelineOutput"),de=c(),x=r("div"),G(M.$$.fragment),Ae=c(),re=r("p"),Ke=f("Output class for image pipelines."),this.h()},l(e){const n=at('[data-svelte="svelte-1phssyn"]',document.head);l=s(n,"META",{name:!0,content:!0}),n.forEach(t),T=d(e),u=s(e,"H1",{class:!0});var q=i(u);_=s(q,"A",{id:!0,class:!0,href:!0});var Le=i(_);b=s(Le,"SPAN",{});var Me=i(b);C(m.$$.fragment,Me),Me.forEach(t),Le.forEach(t),K=d(q),P=s(q,"SPAN",{});var qe=i(P);E=h(qe,"Stochastic Karras VE"),qe.forEach(t),q.forEach(t),g=d(e),y=s(e,"P",{});var De=i(y);$=s(De,"A",{href:!0,rel:!0});var Ge=i($);ge=h(Ge,"Elucidating the Design Space of Diffusion-Based Generative Models"),Ge.forEach(t),_e=h(De," is by Tero Karras, Miika Aittala, Timo Aila and Samuli Laine. This pipeline implements the stochastic sampling tailored to variance expanding (VE) models."),De.forEach(t),ie=d(e),H=s(e,"P",{});var Ce=i(H);ve=h(Ce,"The abstract from the paper:"),Ce.forEach(t),ne=d(e),R=s(e,"P",{});var Ue=i(R);j=s(Ue,"EM",{});var ze=i(j);ye=h(ze,"We argue that the theory and practice of diffusion-based generative models are currently unnecessarily convoluted and seek to remedy the situation by presenting a design space that clearly separates the concrete design choices. This lets us identify several changes to both the sampling and training processes, as well as preconditioning of the score networks. Together, our improvements yield new state-of-the-art FID of 1.79 for CIFAR-10 in a class-conditional setting and 1.97 in an unconditional setting, with much faster sampling (35 network evaluations per image) than prior designs. To further demonstrate their modular nature, we show that our design changes dramatically improve both the efficiency and quality obtainable with pre-trained score networks from previous work, including improving the FID of an existing ImageNet-64 model from 2.07 to near-SOTA 1.55."),ze.forEach(t),Ue.forEach(t),oe=d(e),C(V.$$.fragment,e),le=d(e),k=s(e,"H2",{class:!0});var fe=i(k);S=s(fe,"A",{id:!0,class:!0,href:!0});var Fe=i(S);Q=s(Fe,"SPAN",{});var Be=i(Q);C(D.$$.fragment,Be),Be.forEach(t),Fe.forEach(t),$e=d(fe),X=s(fe,"SPAN",{});var He=i(X);we=h(He,"KarrasVePipeline"),He.forEach(t),fe.forEach(t),pe=d(e),v=s(e,"DIV",{class:!0});var W=i(v);C(O.$$.fragment,W),be=d(W),Y=s(W,"P",{});var Re=i(Y);Pe=h(Re,"Pipeline for unconditional image generation."),Re.forEach(t),Ee=d(W),w=s(W,"DIV",{class:!0});var J=i(w);C(N.$$.fragment,J),ke=d(J),Z=s(J,"P",{});var We=i(Z);Ie=h(We,"The call function to the pipeline for generation."),We.forEach(t),xe=d(J),ee=s(J,"P",{});var Je=i(ee);Te=h(Je,"Example:"),Je.forEach(t),J.forEach(t),W.forEach(t),ce=d(e),I=s(e,"H2",{class:!0});var he=i(I);A=s(he,"A",{id:!0,class:!0,href:!0});var je=i(A);te=s(je,"SPAN",{});var Qe=i(te);C(L.$$.fragment,Qe),Qe.forEach(t),je.forEach(t),Ve=d(he),ae=s(he,"SPAN",{});var Xe=i(ae);Se=h(Xe,"ImagePipelineOutput"),Xe.forEach(t),he.forEach(t),de=d(e),x=s(e,"DIV",{class:!0});var me=i(x);C(M.$$.fragment,me),Ae=d(me),re=s(me,"P",{});var Ye=i(re);Ke=h(Ye,"Output class for image pipelines."),Ye.forEach(t),me.forEach(t),this.h()},h(){o(l,"name","hf:doc:metadata"),o(l,"content",JSON.stringify(ot)),o(_,"id","stochastic-karras-ve"),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","#stochastic-karras-ve"),o(u,"class","relative group"),o($,"href","https://huggingface.co/papers/2206.00364"),o($,"rel","nofollow"),o(S,"id","diffusers.KarrasVePipeline"),o(S,"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(S,"href","#diffusers.KarrasVePipeline"),o(k,"class","relative group"),o(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),o(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),o(A,"id","diffusers.ImagePipelineOutput"),o(A,"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(A,"href","#diffusers.ImagePipelineOutput"),o(I,"class","relative group"),o(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,n){a(document.head,l),p(e,T,n),p(e,u,n),a(u,_),a(_,b),U(m,b,null),a(u,K),a(u,P),a(P,E),p(e,g,n),p(e,y,n),a(y,$),a($,ge),a(y,_e),p(e,ie,n),p(e,H,n),a(H,ve),p(e,ne,n),p(e,R,n),a(R,j),a(j,ye),p(e,oe,n),U(V,e,n),p(e,le,n),p(e,k,n),a(k,S),a(S,Q),U(D,Q,null),a(k,$e),a(k,X),a(X,we),p(e,pe,n),p(e,v,n),U(O,v,null),a(v,be),a(v,Y),a(Y,Pe),a(v,Ee),a(v,w),U(N,w,null),a(w,ke),a(w,Z),a(Z,Ie),a(w,xe),a(w,ee),a(ee,Te),p(e,ce,n),p(e,I,n),a(I,A),a(A,te),U(L,te,null),a(I,Ve),a(I,ae),a(ae,Se),p(e,de,n),p(e,x,n),U(M,x,null),a(x,Ae),a(x,re),a(re,Ke),ue=!0},p(e,[n]){const q={};n&2&&(q.$$scope={dirty:n,ctx:e}),V.$set(q)},i(e){ue||(z(m.$$.fragment,e),z(V.$$.fragment,e),z(D.$$.fragment,e),z(O.$$.fragment,e),z(N.$$.fragment,e),z(L.$$.fragment,e),z(M.$$.fragment,e),ue=!0)},o(e){F(m.$$.fragment,e),F(V.$$.fragment,e),F(D.$$.fragment,e),F(O.$$.fragment,e),F(N.$$.fragment,e),F(L.$$.fragment,e),F(M.$$.fragment,e),ue=!1},d(e){t(l),e&&t(T),e&&t(u),B(m),e&&t(g),e&&t(y),e&&t(ie),e&&t(H),e&&t(ne),e&&t(R),e&&t(oe),B(V,e),e&&t(le),e&&t(k),B(D),e&&t(pe),e&&t(v),B(O),B(N),e&&t(ce),e&&t(I),B(L),e&&t(de),e&&t(x),B(M)}}}const ot={local:"stochastic-karras-ve",sections:[{local:"diffusers.KarrasVePipeline",title:"KarrasVePipeline"},{local:"diffusers.ImagePipelineOutput",title:"ImagePipelineOutput"}],title:"Stochastic Karras VE"};function lt(se){return rt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ft extends Ze{constructor(l){super();et(this,l,lt,nt,tt,{})}}export{ft as default,ot as metadata};
