import{s as me,o as ue,n as fe}from"../chunks/scheduler.182ea377.js";import{S as he,i as ge,g as d,s as o,r as M,A as ve,h as c,f as r,c as a,j,u as k,x as g,k as z,y as p,a as n,v as L,d as H,t as I,w as q}from"../chunks/index.1ea56653.js";import{H as pe,g as Se}from"../chunks/Heading.71ac6e9f.js";import{T as _e}from"../chunks/Tip.67abc998.js";import{D as se}from"../chunks/Docstring.59aaf0cd.js";function be(B){let s,v="🚧 This scheduler is under construction!";return{c(){s=d("p"),s.textContent=v},l(m){s=c(m,"P",{"data-svelte-h":!0}),g(s)!=="svelte-mvh4c7"&&(s.textContent=v)},m(m,C){n(m,s,C)},p:fe,d(m){m&&r(s)}}}function $e(B){let s,v,m,C,S,G,_,ne='<code>ScoreSdeVpScheduler</code> is a variance preserving stochastic differential equation (SDE) scheduler.  It was introduced in the <a href="https://huggingface.co/papers/2011.13456" rel="nofollow">Score-Based Generative Modeling through Stochastic Differential Equations</a> paper by Yang Song, Jascha Sohl-Dickstein, Diederik P. Kingma, Abhishek Kumar, Stefano Ermon, Ben Poole.',N,b,ie="The abstract from the paper is:",W,$,oe="<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,u,K,x,R,i,w,Q,D,ae="<code>ScoreSdeVpScheduler</code> is a variance preserving stochastic differential equation (SDE) scheduler.",X,T,de=`This model inherits from <a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a> and <a href="/docs/diffusers/main/en/api/configuration#diffusers.ConfigMixin">ConfigMixin</a>. Check the superclass documentation for the generic
methods the library implements for all schedulers such as loading and saving.`,Z,f,y,ee,E,ce="Sets the continuous timesteps used for the diffusion chain (to be run before inference).",te,h,V,re,P,le=`Predict the sample from the previous timestep by reversing the SDE. This function propagates the diffusion
process from the learned model outputs (most often the predicted noise).`,U,A,J;return S=new pe({props:{title:"ScoreSdeVpScheduler",local:"scoresdevpscheduler",headingTag:"h1"}}),u=new _e({props:{warning:!0,$$slots:{default:[be]},$$scope:{ctx:B}}}),x=new pe({props:{title:"ScoreSdeVpScheduler",local:"diffusers.schedulers.ScoreSdeVpScheduler",headingTag:"h2"}}),w=new se({props:{name:"class diffusers.schedulers.ScoreSdeVpScheduler",anchor:"diffusers.schedulers.ScoreSdeVpScheduler",parameters:[{name:"num_train_timesteps",val:" = 2000"},{name:"beta_min",val:" = 0.1"},{name:"beta_max",val:" = 20"},{name:"sampling_eps",val:" = 0.001"}],parametersDescription:[{anchor:"diffusers.schedulers.ScoreSdeVpScheduler.num_train_timesteps",description:`<strong>num_train_timesteps</strong> (<code>int</code>, defaults to 2000) &#x2014;
The number of diffusion steps to train the model.`,name:"num_train_timesteps"},{anchor:"diffusers.schedulers.ScoreSdeVpScheduler.beta_min",description:"<strong>beta_min</strong> (<code>int</code>, defaults to 0.1) &#x2014;",name:"beta_min"},{anchor:"diffusers.schedulers.ScoreSdeVpScheduler.beta_max",description:"<strong>beta_max</strong> (<code>int</code>, defaults to 20) &#x2014;",name:"beta_max"},{anchor:"diffusers.schedulers.ScoreSdeVpScheduler.sampling_eps",description:`<strong>sampling_eps</strong> (<code>int</code>, defaults to 1e-3) &#x2014;
The end value of sampling where timesteps decrease progressively from 1 to epsilon.`,name:"sampling_eps"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_sde_vp.py#L27"}}),y=new se({props:{name:"set_timesteps",anchor:"diffusers.schedulers.ScoreSdeVpScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:""},{name:"device",val:": typing.Union[str, torch.device] = None"}],parametersDescription:[{anchor:"diffusers.schedulers.ScoreSdeVpScheduler.set_timesteps.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>) &#x2014;
The number of diffusion steps used when generating samples with a pre-trained model.`,name:"num_inference_steps"},{anchor:"diffusers.schedulers.ScoreSdeVpScheduler.set_timesteps.device",description:`<strong>device</strong> (<code>str</code> or <code>torch.device</code>, <em>optional</em>) &#x2014;
The device to which the timesteps should be moved to. If <code>None</code>, the timesteps are not moved.`,name:"device"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_sde_vp.py#L51"}}),V=new se({props:{name:"step_pred",anchor:"diffusers.schedulers.ScoreSdeVpScheduler.step_pred",parameters:[{name:"score",val:""},{name:"x",val:""},{name:"t",val:""},{name:"generator",val:" = None"}],parametersDescription:[{anchor:"diffusers.schedulers.ScoreSdeVpScheduler.step_pred.score",description:"<strong>score</strong> () &#x2014;",name:"score"},{anchor:"diffusers.schedulers.ScoreSdeVpScheduler.step_pred.x",description:"<strong>x</strong> () &#x2014;",name:"x"},{anchor:"diffusers.schedulers.ScoreSdeVpScheduler.step_pred.t",description:"<strong>t</strong> () &#x2014;",name:"t"},{anchor:"diffusers.schedulers.ScoreSdeVpScheduler.step_pred.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
A random number generator.`,name:"generator"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_sde_vp.py#L63"}}),{c(){s=d("meta"),v=o(),m=d("p"),C=o(),M(S.$$.fragment),G=o(),_=d("p"),_.innerHTML=ne,N=o(),b=d("p"),b.textContent=ie,W=o(),$=d("p"),$.innerHTML=oe,F=o(),M(u.$$.fragment),K=o(),M(x.$$.fragment),R=o(),i=d("div"),M(w.$$.fragment),Q=o(),D=d("p"),D.innerHTML=ae,X=o(),T=d("p"),T.innerHTML=de,Z=o(),f=d("div"),M(y.$$.fragment),ee=o(),E=d("p"),E.textContent=ce,te=o(),h=d("div"),M(V.$$.fragment),re=o(),P=d("p"),P.textContent=le,U=o(),A=d("p"),this.h()},l(e){const t=ve("svelte-u9bgzb",document.head);s=c(t,"META",{name:!0,content:!0}),t.forEach(r),v=a(e),m=c(e,"P",{}),j(m).forEach(r),C=a(e),k(S.$$.fragment,e),G=a(e),_=c(e,"P",{"data-svelte-h":!0}),g(_)!=="svelte-am1tgf"&&(_.innerHTML=ne),N=a(e),b=c(e,"P",{"data-svelte-h":!0}),g(b)!=="svelte-1cwsb16"&&(b.textContent=ie),W=a(e),$=c(e,"P",{"data-svelte-h":!0}),g($)!=="svelte-omf9ly"&&($.innerHTML=oe),F=a(e),k(u.$$.fragment,e),K=a(e),k(x.$$.fragment,e),R=a(e),i=c(e,"DIV",{class:!0});var l=j(i);k(w.$$.fragment,l),Q=a(l),D=c(l,"P",{"data-svelte-h":!0}),g(D)!=="svelte-ij3gjh"&&(D.innerHTML=ae),X=a(l),T=c(l,"P",{"data-svelte-h":!0}),g(T)!=="svelte-linuuh"&&(T.innerHTML=de),Z=a(l),f=c(l,"DIV",{class:!0});var O=j(f);k(y.$$.fragment,O),ee=a(O),E=c(O,"P",{"data-svelte-h":!0}),g(E)!=="svelte-8cg672"&&(E.textContent=ce),O.forEach(r),te=a(l),h=c(l,"DIV",{class:!0});var Y=j(h);k(V.$$.fragment,Y),re=a(Y),P=c(Y,"P",{"data-svelte-h":!0}),g(P)!=="svelte-hi84tp"&&(P.textContent=le),Y.forEach(r),l.forEach(r),U=a(e),A=c(e,"P",{}),j(A).forEach(r),this.h()},h(){z(s,"name","hf:doc:metadata"),z(s,"content",xe),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"),z(h,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),z(i,"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){p(document.head,s),n(e,v,t),n(e,m,t),n(e,C,t),L(S,e,t),n(e,G,t),n(e,_,t),n(e,N,t),n(e,b,t),n(e,W,t),n(e,$,t),n(e,F,t),L(u,e,t),n(e,K,t),L(x,e,t),n(e,R,t),n(e,i,t),L(w,i,null),p(i,Q),p(i,D),p(i,X),p(i,T),p(i,Z),p(i,f),L(y,f,null),p(f,ee),p(f,E),p(i,te),p(i,h),L(V,h,null),p(h,re),p(h,P),n(e,U,t),n(e,A,t),J=!0},p(e,[t]){const l={};t&2&&(l.$$scope={dirty:t,ctx:e}),u.$set(l)},i(e){J||(H(S.$$.fragment,e),H(u.$$.fragment,e),H(x.$$.fragment,e),H(w.$$.fragment,e),H(y.$$.fragment,e),H(V.$$.fragment,e),J=!0)},o(e){I(S.$$.fragment,e),I(u.$$.fragment,e),I(x.$$.fragment,e),I(w.$$.fragment,e),I(y.$$.fragment,e),I(V.$$.fragment,e),J=!1},d(e){e&&(r(v),r(m),r(C),r(G),r(_),r(N),r(b),r(W),r($),r(F),r(K),r(R),r(i),r(U),r(A)),r(s),q(S,e),q(u,e),q(x,e),q(w),q(y),q(V)}}}const xe='{"title":"ScoreSdeVpScheduler","local":"scoresdevpscheduler","sections":[{"title":"ScoreSdeVpScheduler","local":"diffusers.schedulers.ScoreSdeVpScheduler","sections":[],"depth":2}],"depth":1}';function we(B){return ue(()=>{new URLSearchParams(window.location.search).get("fw"),window.hfDocGoto=Se}),[]}class Ee extends he{constructor(s){super(),ge(this,s,we,$e,me,{})}}export{Ee as component};
