import{s as fe,o as he,n as ge}from"../chunks/scheduler.182ea377.js";import{S as _e,i as $e,g as o,s as r,r as C,A as ve,h as l,f as n,c as s,j as q,u as V,x as g,k as z,y as c,a,v as K,d as k,t as L,w as D}from"../chunks/index.abf12888.js";import{T as be}from"../chunks/Tip.230e2334.js";import{D as re}from"../chunks/Docstring.93f6f462.js";import{H as se}from"../chunks/Heading.16916d63.js";function Pe(U){let i,_='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-components-across-pipelines">reuse components across pipelines</a> section to learn how to efficiently load the same components into multiple pipelines.';return{c(){i=o("p"),i.innerHTML=_},l(p){i=l(p,"P",{"data-svelte-h":!0}),g(i)!=="svelte-1wmc0l4"&&(i.innerHTML=_)},m(p,M){a(p,i,M)},p:ge,d(p){p&&n(i)}}}function ye(U){let i,_,p,M,$,G,v,oe='<a href="https://huggingface.co/papers/2206.00364" rel="nofollow">Elucidating the Design Space of Diffusion-Based Generative Models</a> is by Tero Karras, Miika Aittala, Timo Aila and Samuli Laine. This pipeline implements the stochastic sampling tailored to variance expanding (VE) models.',j,b,le="The abstract from the paper:",F,P,pe="<em>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.</em>",R,h,W,y,B,d,x,ee,O,de="Pipeline for unconditional image generation.",te,u,w,ne,E,ce="The call function to the pipeline for generation.",ae,S,ue="Example:",J,I,Q,m,T,ie,A,me="Output class for image pipelines.",X,N,Y;return $=new se({props:{title:"Stochastic Karras VE",local:"stochastic-karras-ve",headingTag:"h1"}}),h=new be({props:{$$slots:{default:[Pe]},$$scope:{ctx:U}}}),y=new se({props:{title:"KarrasVePipeline",local:"diffusers.KarrasVePipeline",headingTag:"h2"}}),x=new re({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/main/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/main/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/main/src/diffusers/pipelines/stochastic_karras_ve/pipeline_stochastic_karras_ve.py#L25"}}),w=new re({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/main/en/api/pipelines/ddim#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stochastic_karras_ve/pipeline_stochastic_karras_ve.py#L44",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/main/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/main/en/api/pipelines/ddim#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),I=new se({props:{title:"ImagePipelineOutput",local:"diffusers.ImagePipelineOutput",headingTag:"h2"}}),T=new re({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/main/src/diffusers/pipelines/pipeline_utils.py#L110"}}),{c(){i=o("meta"),_=r(),p=o("p"),M=r(),C($.$$.fragment),G=r(),v=o("p"),v.innerHTML=oe,j=r(),b=o("p"),b.textContent=le,F=r(),P=o("p"),P.innerHTML=pe,R=r(),C(h.$$.fragment),W=r(),C(y.$$.fragment),B=r(),d=o("div"),C(x.$$.fragment),ee=r(),O=o("p"),O.textContent=de,te=r(),u=o("div"),C(w.$$.fragment),ne=r(),E=o("p"),E.textContent=ce,ae=r(),S=o("p"),S.textContent=ue,J=r(),C(I.$$.fragment),Q=r(),m=o("div"),C(T.$$.fragment),ie=r(),A=o("p"),A.textContent=me,X=r(),N=o("p"),this.h()},l(e){const t=ve("svelte-u9bgzb",document.head);i=l(t,"META",{name:!0,content:!0}),t.forEach(n),_=s(e),p=l(e,"P",{}),q(p).forEach(n),M=s(e),V($.$$.fragment,e),G=s(e),v=l(e,"P",{"data-svelte-h":!0}),g(v)!=="svelte-1a5vxii"&&(v.innerHTML=oe),j=s(e),b=l(e,"P",{"data-svelte-h":!0}),g(b)!=="svelte-jqf0eu"&&(b.textContent=le),F=s(e),P=l(e,"P",{"data-svelte-h":!0}),g(P)!=="svelte-1f7fbd0"&&(P.innerHTML=pe),R=s(e),V(h.$$.fragment,e),W=s(e),V(y.$$.fragment,e),B=s(e),d=l(e,"DIV",{class:!0});var f=q(d);V(x.$$.fragment,f),ee=s(f),O=l(f,"P",{"data-svelte-h":!0}),g(O)!=="svelte-1byevm7"&&(O.textContent=de),te=s(f),u=l(f,"DIV",{class:!0});var H=q(u);V(w.$$.fragment,H),ne=s(H),E=l(H,"P",{"data-svelte-h":!0}),g(E)!=="svelte-50j04k"&&(E.textContent=ce),ae=s(H),S=l(H,"P",{"data-svelte-h":!0}),g(S)!=="svelte-11lpom8"&&(S.textContent=ue),H.forEach(n),f.forEach(n),J=s(e),V(I.$$.fragment,e),Q=s(e),m=l(e,"DIV",{class:!0});var Z=q(m);V(T.$$.fragment,Z),ie=s(Z),A=l(Z,"P",{"data-svelte-h":!0}),g(A)!=="svelte-19wetgi"&&(A.textContent=me),Z.forEach(n),X=s(e),N=l(e,"P",{}),q(N).forEach(n),this.h()},h(){z(i,"name","hf:doc:metadata"),z(i,"content",xe),z(u,"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(m,"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){c(document.head,i),a(e,_,t),a(e,p,t),a(e,M,t),K($,e,t),a(e,G,t),a(e,v,t),a(e,j,t),a(e,b,t),a(e,F,t),a(e,P,t),a(e,R,t),K(h,e,t),a(e,W,t),K(y,e,t),a(e,B,t),a(e,d,t),K(x,d,null),c(d,ee),c(d,O),c(d,te),c(d,u),K(w,u,null),c(u,ne),c(u,E),c(u,ae),c(u,S),a(e,J,t),K(I,e,t),a(e,Q,t),a(e,m,t),K(T,m,null),c(m,ie),c(m,A),a(e,X,t),a(e,N,t),Y=!0},p(e,[t]){const f={};t&2&&(f.$$scope={dirty:t,ctx:e}),h.$set(f)},i(e){Y||(k($.$$.fragment,e),k(h.$$.fragment,e),k(y.$$.fragment,e),k(x.$$.fragment,e),k(w.$$.fragment,e),k(I.$$.fragment,e),k(T.$$.fragment,e),Y=!0)},o(e){L($.$$.fragment,e),L(h.$$.fragment,e),L(y.$$.fragment,e),L(x.$$.fragment,e),L(w.$$.fragment,e),L(I.$$.fragment,e),L(T.$$.fragment,e),Y=!1},d(e){e&&(n(_),n(p),n(M),n(G),n(v),n(j),n(b),n(F),n(P),n(R),n(W),n(B),n(d),n(J),n(Q),n(m),n(X),n(N)),n(i),D($,e),D(h,e),D(y,e),D(x),D(w),D(I,e),D(T)}}}const xe='{"title":"Stochastic Karras VE","local":"stochastic-karras-ve","sections":[{"title":"KarrasVePipeline","local":"diffusers.KarrasVePipeline","sections":[],"depth":2},{"title":"ImagePipelineOutput","local":"diffusers.ImagePipelineOutput","sections":[],"depth":2}],"depth":1}';function we(U){return he(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ke extends _e{constructor(i){super(),$e(this,i,we,ye,fe,{})}}export{ke as component};
