import{s as me,o as he,n as ge}from"../chunks/scheduler.182ea377.js";import{S as _e,i as ve,g as o,s,r as C,A as $e,h as l,f as n,c as i,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 se}from"../chunks/Docstring.93f6f462.js";import{H as ie}from"../chunks/Heading.16916d63.js";function Pe(U){let r,_='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(){r=o("p"),r.innerHTML=_},l(p){r=l(p,"P",{"data-svelte-h":!0}),g(r)!=="svelte-1wmc0l4"&&(r.innerHTML=_)},m(p,M){a(p,r,M)},p:ge,d(p){p&&n(r)}}}function ye(U){let r,_,p,M,v,G,$,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,f,T,re,A,fe="Output class for image pipelines.",X,N,Y;return v=new ie({props:{title:"Stochastic Karras VE",local:"stochastic-karras-ve",headingTag:"h1"}}),h=new be({props:{$$slots:{default:[Pe]},$$scope:{ctx:U}}}),y=new ie({props:{title:"KarrasVePipeline",local:"diffusers.KarrasVePipeline",headingTag:"h2"}}),x=new se({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.22.3/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.22.3/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.22.3/src/diffusers/pipelines/stochastic_karras_ve/pipeline_stochastic_karras_ve.py#L25"}}),w=new se({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.22.3/en/api/pipelines/ddim#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.22.3/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/v0.22.3/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.22.3/en/api/pipelines/ddim#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),I=new ie({props:{title:"ImagePipelineOutput",local:"diffusers.ImagePipelineOutput",headingTag:"h2"}}),T=new se({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.22.3/src/diffusers/pipelines/pipeline_utils.py#L110"}}),{c(){r=o("meta"),_=s(),p=o("p"),M=s(),C(v.$$.fragment),G=s(),$=o("p"),$.innerHTML=oe,j=s(),b=o("p"),b.textContent=le,F=s(),P=o("p"),P.innerHTML=pe,R=s(),C(h.$$.fragment),W=s(),C(y.$$.fragment),B=s(),d=o("div"),C(x.$$.fragment),ee=s(),O=o("p"),O.textContent=de,te=s(),u=o("div"),C(w.$$.fragment),ne=s(),E=o("p"),E.textContent=ce,ae=s(),S=o("p"),S.textContent=ue,J=s(),C(I.$$.fragment),Q=s(),f=o("div"),C(T.$$.fragment),re=s(),A=o("p"),A.textContent=fe,X=s(),N=o("p"),this.h()},l(e){const t=$e("svelte-u9bgzb",document.head);r=l(t,"META",{name:!0,content:!0}),t.forEach(n),_=i(e),p=l(e,"P",{}),q(p).forEach(n),M=i(e),V(v.$$.fragment,e),G=i(e),$=l(e,"P",{"data-svelte-h":!0}),g($)!=="svelte-1a5vxii"&&($.innerHTML=oe),j=i(e),b=l(e,"P",{"data-svelte-h":!0}),g(b)!=="svelte-jqf0eu"&&(b.textContent=le),F=i(e),P=l(e,"P",{"data-svelte-h":!0}),g(P)!=="svelte-1f7fbd0"&&(P.innerHTML=pe),R=i(e),V(h.$$.fragment,e),W=i(e),V(y.$$.fragment,e),B=i(e),d=l(e,"DIV",{class:!0});var m=q(d);V(x.$$.fragment,m),ee=i(m),O=l(m,"P",{"data-svelte-h":!0}),g(O)!=="svelte-1byevm7"&&(O.textContent=de),te=i(m),u=l(m,"DIV",{class:!0});var H=q(u);V(w.$$.fragment,H),ne=i(H),E=l(H,"P",{"data-svelte-h":!0}),g(E)!=="svelte-50j04k"&&(E.textContent=ce),ae=i(H),S=l(H,"P",{"data-svelte-h":!0}),g(S)!=="svelte-11lpom8"&&(S.textContent=ue),H.forEach(n),m.forEach(n),J=i(e),V(I.$$.fragment,e),Q=i(e),f=l(e,"DIV",{class:!0});var Z=q(f);V(T.$$.fragment,Z),re=i(Z),A=l(Z,"P",{"data-svelte-h":!0}),g(A)!=="svelte-19wetgi"&&(A.textContent=fe),Z.forEach(n),X=i(e),N=l(e,"P",{}),q(N).forEach(n),this.h()},h(){z(r,"name","hf:doc:metadata"),z(r,"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(f,"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,r),a(e,_,t),a(e,p,t),a(e,M,t),K(v,e,t),a(e,G,t),a(e,$,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,f,t),K(T,f,null),c(f,re),c(f,A),a(e,X,t),a(e,N,t),Y=!0},p(e,[t]){const m={};t&2&&(m.$$scope={dirty:t,ctx:e}),h.$set(m)},i(e){Y||(k(v.$$.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(v.$$.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($),n(j),n(b),n(F),n(P),n(R),n(W),n(B),n(d),n(J),n(Q),n(f),n(X),n(N)),n(r),D(v,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(r){super(),ve(this,r,we,ye,me,{})}}export{ke as component};
