import{S as st,i as ot,s as it,e as s,k as m,w as L,t as a,M as nt,c as o,d as r,m as u,a as i,x as O,h as d,b as c,G as t,g as f,y as z,q as F,o as G,B as K,v as at}from"../../../chunks/vendor-hf-doc-builder.js";import{T as dt}from"../../../chunks/Tip-hf-doc-builder.js";import{D as Oe}from"../../../chunks/Docstring-hf-doc-builder.js";import{I as rt}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function ct(te){let l,w;return{c(){l=s("p"),w=a("\u{1F6A7} This scheduler is under construction!")},l(h){l=o(h,"P",{});var g=i(l);w=d(g,"\u{1F6A7} This scheduler is under construction!"),g.forEach(r)},m(h,g){f(h,l,g),t(l,w)},d(h){h&&r(l)}}}function lt(te){let l,w,h,g,J,D,pe,R,me,re,S,j,ue,fe,k,ge,ve,se,q,Se,oe,V,H,be,_e,ie,$,ne,b,y,U,P,we,Y,$e,ae,p,I,ye,M,Q,Ee,xe,De,_,ke,N,Ve,Pe,B,Ie,Ce,Ae,E,C,Te,X,qe,Me,x,A,Ne,Z,Be,de;return D=new rt({}),$=new dt({props:{warning:!0,$$slots:{default:[ct]},$$scope:{ctx:te}}}),P=new rt({}),I=new Oe({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"}}),C=new Oe({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"}}),A=new Oe({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(){l=s("meta"),w=m(),h=s("h1"),g=s("a"),J=s("span"),L(D.$$.fragment),pe=m(),R=s("span"),me=a("ScoreSdeVpScheduler"),re=m(),S=s("p"),j=s("code"),ue=a("ScoreSdeVpScheduler"),fe=a(" is a variance preserving stochastic differential equation (SDE) scheduler.  It was introduced in the "),k=s("a"),ge=a("Score-Based Generative Modeling through Stochastic Differential Equations"),ve=a(" paper by Yang Song, Jascha Sohl-Dickstein, Diederik P. Kingma, Abhishek Kumar, Stefano Ermon, Ben Poole."),se=m(),q=s("p"),Se=a("The abstract from the paper is:"),oe=m(),V=s("p"),H=s("em"),be=a("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"),_e=a("."),ie=m(),L($.$$.fragment),ne=m(),b=s("h2"),y=s("a"),U=s("span"),L(P.$$.fragment),we=m(),Y=s("span"),$e=a("ScoreSdeVpScheduler"),ae=m(),p=s("div"),L(I.$$.fragment),ye=m(),M=s("p"),Q=s("code"),Ee=a("ScoreSdeVpScheduler"),xe=a(" is a variance preserving stochastic differential equation (SDE) scheduler."),De=m(),_=s("p"),ke=a("This model inherits from "),N=s("a"),Ve=a("SchedulerMixin"),Pe=a(" and "),B=s("a"),Ie=a("ConfigMixin"),Ce=a(`. Check the superclass documentation for the generic
methods the library implements for all schedulers such as loading and saving.`),Ae=m(),E=s("div"),L(C.$$.fragment),Te=m(),X=s("p"),qe=a("Sets the continuous timesteps used for the diffusion chain (to be run before inference)."),Me=m(),x=s("div"),L(A.$$.fragment),Ne=m(),Z=s("p"),Be=a(`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).`),this.h()},l(e){const n=nt('[data-svelte="svelte-1phssyn"]',document.head);l=o(n,"META",{name:!0,content:!0}),n.forEach(r),w=u(e),h=o(e,"H1",{class:!0});var T=i(h);g=o(T,"A",{id:!0,class:!0,href:!0});var ze=i(g);J=o(ze,"SPAN",{});var Fe=i(J);O(D.$$.fragment,Fe),Fe.forEach(r),ze.forEach(r),pe=u(T),R=o(T,"SPAN",{});var Ge=i(R);me=d(Ge,"ScoreSdeVpScheduler"),Ge.forEach(r),T.forEach(r),re=u(e),S=o(e,"P",{});var ee=i(S);j=o(ee,"CODE",{});var Ke=i(j);ue=d(Ke,"ScoreSdeVpScheduler"),Ke.forEach(r),fe=d(ee," is a variance preserving stochastic differential equation (SDE) scheduler.  It was introduced in the "),k=o(ee,"A",{href:!0,rel:!0});var Je=i(k);ge=d(Je,"Score-Based Generative Modeling through Stochastic Differential Equations"),Je.forEach(r),ve=d(ee," paper by Yang Song, Jascha Sohl-Dickstein, Diederik P. Kingma, Abhishek Kumar, Stefano Ermon, Ben Poole."),ee.forEach(r),se=u(e),q=o(e,"P",{});var Re=i(q);Se=d(Re,"The abstract from the paper is:"),Re.forEach(r),oe=u(e),V=o(e,"P",{});var We=i(V);H=o(We,"EM",{});var je=i(H);be=d(je,"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"),je.forEach(r),_e=d(We,"."),We.forEach(r),ie=u(e),O($.$$.fragment,e),ne=u(e),b=o(e,"H2",{class:!0});var ce=i(b);y=o(ce,"A",{id:!0,class:!0,href:!0});var He=i(y);U=o(He,"SPAN",{});var Ue=i(U);O(P.$$.fragment,Ue),Ue.forEach(r),He.forEach(r),we=u(ce),Y=o(ce,"SPAN",{});var Ye=i(Y);$e=d(Ye,"ScoreSdeVpScheduler"),Ye.forEach(r),ce.forEach(r),ae=u(e),p=o(e,"DIV",{class:!0});var v=i(p);O(I.$$.fragment,v),ye=u(v),M=o(v,"P",{});var Le=i(M);Q=o(Le,"CODE",{});var Qe=i(Q);Ee=d(Qe,"ScoreSdeVpScheduler"),Qe.forEach(r),xe=d(Le," is a variance preserving stochastic differential equation (SDE) scheduler."),Le.forEach(r),De=u(v),_=o(v,"P",{});var W=i(_);ke=d(W,"This model inherits from "),N=o(W,"A",{href:!0});var Xe=i(N);Ve=d(Xe,"SchedulerMixin"),Xe.forEach(r),Pe=d(W," and "),B=o(W,"A",{href:!0});var Ze=i(B);Ie=d(Ze,"ConfigMixin"),Ze.forEach(r),Ce=d(W,`. Check the superclass documentation for the generic
methods the library implements for all schedulers such as loading and saving.`),W.forEach(r),Ae=u(v),E=o(v,"DIV",{class:!0});var le=i(E);O(C.$$.fragment,le),Te=u(le),X=o(le,"P",{});var et=i(X);qe=d(et,"Sets the continuous timesteps used for the diffusion chain (to be run before inference)."),et.forEach(r),le.forEach(r),Me=u(v),x=o(v,"DIV",{class:!0});var he=i(x);O(A.$$.fragment,he),Ne=u(he),Z=o(he,"P",{});var tt=i(Z);Be=d(tt,`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).`),tt.forEach(r),he.forEach(r),v.forEach(r),this.h()},h(){c(l,"name","hf:doc:metadata"),c(l,"content",JSON.stringify(ht)),c(g,"id","scoresdevpscheduler"),c(g,"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"),c(g,"href","#scoresdevpscheduler"),c(h,"class","relative group"),c(k,"href","https://huggingface.co/papers/2011.13456"),c(k,"rel","nofollow"),c(y,"id","diffusers.schedulers.ScoreSdeVpScheduler"),c(y,"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"),c(y,"href","#diffusers.schedulers.ScoreSdeVpScheduler"),c(b,"class","relative group"),c(N,"href","/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin"),c(B,"href","/docs/diffusers/main/en/api/configuration#diffusers.ConfigMixin"),c(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(p,"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){t(document.head,l),f(e,w,n),f(e,h,n),t(h,g),t(g,J),z(D,J,null),t(h,pe),t(h,R),t(R,me),f(e,re,n),f(e,S,n),t(S,j),t(j,ue),t(S,fe),t(S,k),t(k,ge),t(S,ve),f(e,se,n),f(e,q,n),t(q,Se),f(e,oe,n),f(e,V,n),t(V,H),t(H,be),t(V,_e),f(e,ie,n),z($,e,n),f(e,ne,n),f(e,b,n),t(b,y),t(y,U),z(P,U,null),t(b,we),t(b,Y),t(Y,$e),f(e,ae,n),f(e,p,n),z(I,p,null),t(p,ye),t(p,M),t(M,Q),t(Q,Ee),t(M,xe),t(p,De),t(p,_),t(_,ke),t(_,N),t(N,Ve),t(_,Pe),t(_,B),t(B,Ie),t(_,Ce),t(p,Ae),t(p,E),z(C,E,null),t(E,Te),t(E,X),t(X,qe),t(p,Me),t(p,x),z(A,x,null),t(x,Ne),t(x,Z),t(Z,Be),de=!0},p(e,[n]){const T={};n&2&&(T.$$scope={dirty:n,ctx:e}),$.$set(T)},i(e){de||(F(D.$$.fragment,e),F($.$$.fragment,e),F(P.$$.fragment,e),F(I.$$.fragment,e),F(C.$$.fragment,e),F(A.$$.fragment,e),de=!0)},o(e){G(D.$$.fragment,e),G($.$$.fragment,e),G(P.$$.fragment,e),G(I.$$.fragment,e),G(C.$$.fragment,e),G(A.$$.fragment,e),de=!1},d(e){r(l),e&&r(w),e&&r(h),K(D),e&&r(re),e&&r(S),e&&r(se),e&&r(q),e&&r(oe),e&&r(V),e&&r(ie),K($,e),e&&r(ne),e&&r(b),K(P),e&&r(ae),e&&r(p),K(I),K(C),K(A)}}}const ht={local:"scoresdevpscheduler",sections:[{local:"diffusers.schedulers.ScoreSdeVpScheduler",title:"ScoreSdeVpScheduler"}],title:"ScoreSdeVpScheduler"};function pt(te){return at(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class vt extends st{constructor(l){super();ot(this,l,pt,lt,it,{})}}export{vt as default,ht as metadata};
