import{s as _e,o as ve,n as be}from"../chunks/scheduler.182ea377.js";import{S as $e,i as Se,g as a,s as o,r as T,A as we,h as d,f as n,c as s,j as N,u as C,x as f,k as U,y as u,a as i,v as V,d as E,t as L,w as k}from"../chunks/index.abf12888.js";import{T as Pe}from"../chunks/Tip.230e2334.js";import{D as ae}from"../chunks/Docstring.93f6f462.js";import{H as de}from"../chunks/Heading.16916d63.js";function ye(G){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=a("p"),r.innerHTML=_},l(c){r=d(c,"P",{"data-svelte-h":!0}),f(r)!=="svelte-1wmc0l4"&&(r.innerHTML=_)},m(c,M){i(c,r,M)},p:be,d(c){c&&n(r)}}}function xe(G){let r,_,c,M,v,W,b,le='<a href="https://huggingface.co/papers/2011.13456" rel="nofollow">Score-Based Generative Modeling through Stochastic Differential Equations</a> (Score SDE) is by Yang Song, Jascha Sohl-Dickstein, Diederik P. Kingma, Abhishek Kumar, Stefano Ermon and Ben Poole. This pipeline implements the variance expanding (VE) variant of the stochastic differential equation method.',j,$,ce="The abstract from the paper is:",B,S,pe="<em>Creating noise from data is easy; creating data from noise is generative modeling. We present a stochastic differential equation (SDE) that smoothly transforms a complex data distribution to a known prior distribution by slowly injecting noise, and a corresponding reverse-time SDE that transforms the prior distribution back into the data distribution by slowly removing the noise. Crucially, the reverse-time SDE depends only on the time-dependent gradient field (\\aka, score) of the perturbed data distribution. By leveraging advances in score-based generative modeling, we can accurately estimate these scores with neural networks, and use numerical SDE solvers to generate samples. We show that this framework encapsulates previous approaches in score-based generative modeling and diffusion probabilistic modeling, allowing for new sampling procedures and new modeling capabilities. In particular, we introduce a predictor-corrector framework to correct errors in the evolution of the discretized reverse-time SDE. We also derive an equivalent neural ODE that samples from the same distribution as the SDE, but additionally enables exact likelihood computation, and improved sampling efficiency. In addition, we provide a new way to solve inverse problems with score-based models, as demonstrated with experiments on class-conditional generation, image inpainting, and colorization. Combined with multiple architectural improvements, we achieve record-breaking performance for unconditional image generation on CIFAR-10 with an Inception score of 9.89 and FID of 2.20, a competitive likelihood of 2.99 bits/dim, and demonstrate high fidelity generation of 1024 x 1024 images for the first time from a score-based generative model.</em>",F,w,ue='The original codebase can be found at <a href="https://github.com/yang-song/score_sde_pytorch" rel="nofollow">yang-song/score_sde_pytorch</a>.',K,h,R,P,J,l,y,ne,O,me="Pipeline for unconditional image generation.",ie,H,fe=`This model inherits from <a href="/docs/diffusers/v0.24.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.).`,re,g,x,oe,q,he="The call function to the pipeline for generation.",Y,I,Q,m,D,se,z,ge="Output class for image pipelines.",X,A,Z;return v=new de({props:{title:"Score SDE VE",local:"score-sde-ve",headingTag:"h1"}}),h=new Pe({props:{$$slots:{default:[ye]},$$scope:{ctx:G}}}),P=new de({props:{title:"ScoreSdeVePipeline",local:"diffusers.ScoreSdeVePipeline",headingTag:"h2"}}),y=new ae({props:{name:"class diffusers.ScoreSdeVePipeline",anchor:"diffusers.ScoreSdeVePipeline",parameters:[{name:"unet",val:": UNet2DModel"},{name:"scheduler",val:": ScoreSdeVeScheduler"}],parametersDescription:[{anchor:"diffusers.ScoreSdeVePipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/v0.24.0/en/api/models/unet2d#diffusers.UNet2DModel">UNet2DModel</a>) &#x2014;
A <code>UNet2DModel</code> to denoise the encoded image.`,name:"unet"},{anchor:"diffusers.ScoreSdeVePipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.24.0/en/api/schedulers/score_sde_ve#diffusers.ScoreSdeVeScheduler">ScoreSdeVeScheduler</a>) &#x2014;
A <code>ScoreSdeVeScheduler</code> to be used in combination with <code>unet</code> to denoise the encoded image.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.24.0/src/diffusers/pipelines/score_sde_ve/pipeline_score_sde_ve.py#L25"}}),x=new ae({props:{name:"__call__",anchor:"diffusers.ScoreSdeVePipeline.__call__",parameters:[{name:"batch_size",val:": int = 1"},{name:"num_inference_steps",val:": int = 2000"},{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.ScoreSdeVePipeline.__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.ScoreSdeVePipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <code>optional</code>) &#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.ScoreSdeVePipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <code>optional</code>, 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.ScoreSdeVePipeline.__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.24.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.24.0/src/diffusers/pipelines/score_sde_ve/pipeline_score_sde_ve.py#L46",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/v0.24.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.24.0/en/api/pipelines/ddim#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),I=new de({props:{title:"ImagePipelineOutput",local:"diffusers.ImagePipelineOutput",headingTag:"h2"}}),D=new ae({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.24.0/src/diffusers/pipelines/pipeline_utils.py#L111"}}),{c(){r=a("meta"),_=o(),c=a("p"),M=o(),T(v.$$.fragment),W=o(),b=a("p"),b.innerHTML=le,j=o(),$=a("p"),$.textContent=ce,B=o(),S=a("p"),S.innerHTML=pe,F=o(),w=a("p"),w.innerHTML=ue,K=o(),T(h.$$.fragment),R=o(),T(P.$$.fragment),J=o(),l=a("div"),T(y.$$.fragment),ne=o(),O=a("p"),O.textContent=me,ie=o(),H=a("p"),H.innerHTML=fe,re=o(),g=a("div"),T(x.$$.fragment),oe=o(),q=a("p"),q.textContent=he,Y=o(),T(I.$$.fragment),Q=o(),m=a("div"),T(D.$$.fragment),se=o(),z=a("p"),z.textContent=ge,X=o(),A=a("p"),this.h()},l(e){const t=we("svelte-u9bgzb",document.head);r=d(t,"META",{name:!0,content:!0}),t.forEach(n),_=s(e),c=d(e,"P",{}),N(c).forEach(n),M=s(e),C(v.$$.fragment,e),W=s(e),b=d(e,"P",{"data-svelte-h":!0}),f(b)!=="svelte-9dttqv"&&(b.innerHTML=le),j=s(e),$=d(e,"P",{"data-svelte-h":!0}),f($)!=="svelte-1cwsb16"&&($.textContent=ce),B=s(e),S=d(e,"P",{"data-svelte-h":!0}),f(S)!=="svelte-omf9ly"&&(S.innerHTML=pe),F=s(e),w=d(e,"P",{"data-svelte-h":!0}),f(w)!=="svelte-ldw3oh"&&(w.innerHTML=ue),K=s(e),C(h.$$.fragment,e),R=s(e),C(P.$$.fragment,e),J=s(e),l=d(e,"DIV",{class:!0});var p=N(l);C(y.$$.fragment,p),ne=s(p),O=d(p,"P",{"data-svelte-h":!0}),f(O)!=="svelte-1byevm7"&&(O.textContent=me),ie=s(p),H=d(p,"P",{"data-svelte-h":!0}),f(H)!=="svelte-kecqr7"&&(H.innerHTML=fe),re=s(p),g=d(p,"DIV",{class:!0});var ee=N(g);C(x.$$.fragment,ee),oe=s(ee),q=d(ee,"P",{"data-svelte-h":!0}),f(q)!=="svelte-50j04k"&&(q.textContent=he),ee.forEach(n),p.forEach(n),Y=s(e),C(I.$$.fragment,e),Q=s(e),m=d(e,"DIV",{class:!0});var te=N(m);C(D.$$.fragment,te),se=s(te),z=d(te,"P",{"data-svelte-h":!0}),f(z)!=="svelte-19wetgi"&&(z.textContent=ge),te.forEach(n),X=s(e),A=d(e,"P",{}),N(A).forEach(n),this.h()},h(){U(r,"name","hf:doc:metadata"),U(r,"content",Ie),U(g,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(l,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),U(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){u(document.head,r),i(e,_,t),i(e,c,t),i(e,M,t),V(v,e,t),i(e,W,t),i(e,b,t),i(e,j,t),i(e,$,t),i(e,B,t),i(e,S,t),i(e,F,t),i(e,w,t),i(e,K,t),V(h,e,t),i(e,R,t),V(P,e,t),i(e,J,t),i(e,l,t),V(y,l,null),u(l,ne),u(l,O),u(l,ie),u(l,H),u(l,re),u(l,g),V(x,g,null),u(g,oe),u(g,q),i(e,Y,t),V(I,e,t),i(e,Q,t),i(e,m,t),V(D,m,null),u(m,se),u(m,z),i(e,X,t),i(e,A,t),Z=!0},p(e,[t]){const p={};t&2&&(p.$$scope={dirty:t,ctx:e}),h.$set(p)},i(e){Z||(E(v.$$.fragment,e),E(h.$$.fragment,e),E(P.$$.fragment,e),E(y.$$.fragment,e),E(x.$$.fragment,e),E(I.$$.fragment,e),E(D.$$.fragment,e),Z=!0)},o(e){L(v.$$.fragment,e),L(h.$$.fragment,e),L(P.$$.fragment,e),L(y.$$.fragment,e),L(x.$$.fragment,e),L(I.$$.fragment,e),L(D.$$.fragment,e),Z=!1},d(e){e&&(n(_),n(c),n(M),n(W),n(b),n(j),n($),n(B),n(S),n(F),n(w),n(K),n(R),n(J),n(l),n(Y),n(Q),n(m),n(X),n(A)),n(r),k(v,e),k(h,e),k(P,e),k(y),k(x),k(I,e),k(D)}}}const Ie='{"title":"Score SDE VE","local":"score-sde-ve","sections":[{"title":"ScoreSdeVePipeline","local":"diffusers.ScoreSdeVePipeline","sections":[],"depth":2},{"title":"ImagePipelineOutput","local":"diffusers.ImagePipelineOutput","sections":[],"depth":2}],"depth":1}';function De(G){return ve(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ke extends $e{constructor(r){super(),Se(this,r,De,xe,_e,{})}}export{ke as component};
