import{S as Mt,i as At,s as Tt,e as s,k as u,w as L,t as i,M as Ct,c as o,d as r,m as h,a as n,x as U,h as l,b as a,G as e,g as v,y as q,L as Ot,q as V,o as B,B as H,v as Nt}from"../../../chunks/vendor-hf-doc-builder.js";import{D as Se}from"../../../chunks/Docstring-hf-doc-builder.js";import{I as ot}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function It(nt){let _,le,S,D,Y,P,be,Z,ye,de,b,E,ee,k,De,te,Ee,ce,g,we,x,$e,Pe,M,ke,xe,pe,A,Me,T,Ae,fe,y,w,re,C,Te,se,Ce,ue,c,O,Oe,z,Ne,N,Ie,Ke,d,G,Fe,Le,oe,Ue,qe,ne,Ve,Be,ae,He,ze,J,Ge,Je,R,Re,We,W,je,Qe,Xe,j,I,Ye,$,K,Ze,ie,et,tt,Q,F,he;return P=new ot({}),k=new ot({}),C=new ot({}),O=new Se({props:{name:"class diffusers.DPMSolverSDEScheduler",anchor:"diffusers.DPMSolverSDEScheduler",parameters:[{name:"num_train_timesteps",val:": int = 1000"},{name:"beta_start",val:": float = 0.00085"},{name:"beta_end",val:": float = 0.012"},{name:"beta_schedule",val:": str = 'linear'"},{name:"trained_betas",val:": typing.Union[numpy.ndarray, typing.List[float], NoneType] = None"},{name:"prediction_type",val:": str = 'epsilon'"},{name:"use_karras_sigmas",val:": typing.Optional[bool] = False"},{name:"noise_sampler_seed",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"diffusers.DPMSolverSDEScheduler.num_train_timesteps",description:"<strong>num_train_timesteps</strong> (<code>int</code>) &#x2014; number of diffusion steps used to train the model. beta_start (<code>float</code>): the",name:"num_train_timesteps"},{anchor:"diffusers.DPMSolverSDEScheduler.starting",description:`<strong>starting</strong> <code>beta</code> value of inference. beta_end (<code>float</code>) &#x2014; the final <code>beta</code> value. beta_schedule (<code>str</code>):
the beta schedule, a mapping from a beta range to a sequence of betas for stepping the model. Choose from
<code>linear</code> or <code>scaled_linear</code>.`,name:"starting"},{anchor:"diffusers.DPMSolverSDEScheduler.trained_betas",description:`<strong>trained_betas</strong> (<code>np.ndarray</code>, optional) &#x2014;
option to pass an array of betas directly to the constructor to bypass <code>beta_start</code>, <code>beta_end</code> etc.`,name:"trained_betas"},{anchor:"diffusers.DPMSolverSDEScheduler.prediction_type",description:`<strong>prediction_type</strong> (<code>str</code>, default <code>epsilon</code>, optional) &#x2014;
prediction type of the scheduler function, one of <code>epsilon</code> (predicting the noise of the diffusion
process), <code>sample</code> (directly predicting the noisy sample<code>) or </code>v_prediction\` (see section 2.4
<a href="https://imagen.research.google/video/paper.pdf" rel="nofollow">https://imagen.research.google/video/paper.pdf</a>)`,name:"prediction_type"},{anchor:"diffusers.DPMSolverSDEScheduler.use_karras_sigmas",description:`<strong>use_karras_sigmas</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
This parameter controls whether to use Karras sigmas (Karras et al. (2022) scheme) for step sizes in the
noise schedule during the sampling process. If True, the sigmas will be determined according to a sequence
of noise levels {&#x3C3;i} as defined in Equation (5) of the paper <a href="https://arxiv.org/pdf/2206.00364.pdf" rel="nofollow">https://arxiv.org/pdf/2206.00364.pdf</a>.`,name:"use_karras_sigmas"},{anchor:"diffusers.DPMSolverSDEScheduler.noise_sampler_seed",description:`<strong>noise_sampler_seed</strong> (<code>int</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The random seed to use for the noise sampler. If <code>None</code>, a random seed will be generated.`,name:"noise_sampler_seed"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/schedulers/scheduling_dpmsolver_sde.py#L108"}}),I=new Se({props:{name:"scale_model_input",anchor:"diffusers.DPMSolverSDEScheduler.scale_model_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"timestep",val:": typing.Union[float, torch.FloatTensor]"}],parametersDescription:[{anchor:"diffusers.DPMSolverSDEScheduler.scale_model_input.Ensures",description:"<strong>Ensures</strong> interchangeability with schedulers that need to scale the denoising model input depending on the &#x2014;",name:"Ensures"},{anchor:"diffusers.DPMSolverSDEScheduler.scale_model_input.current",description:`<strong>current</strong> timestep. &#x2014;
sample (<code>torch.FloatTensor</code>): input sample timestep (<code>int</code>, optional): current timestep`,name:"current"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/schedulers/scheduling_dpmsolver_sde.py#L190",returnDescription:`
<p>scaled input sample</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),K=new Se({props:{name:"set_timesteps",anchor:"diffusers.DPMSolverSDEScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": typing.Union[str, torch.device] = None"},{name:"num_train_timesteps",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"diffusers.DPMSolverSDEScheduler.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.DPMSolverSDEScheduler.set_timesteps.device",description:`<strong>device</strong> (<code>str</code> or <code>torch.device</code>, optional) &#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/v0.17.0/src/diffusers/schedulers/scheduling_dpmsolver_sde.py#L210"}}),F=new Se({props:{name:"step",anchor:"diffusers.DPMSolverSDEScheduler.step",parameters:[{name:"model_output",val:": typing.Union[torch.FloatTensor, numpy.ndarray]"},{name:"timestep",val:": typing.Union[float, torch.FloatTensor]"},{name:"sample",val:": typing.Union[torch.FloatTensor, numpy.ndarray]"},{name:"return_dict",val:": bool = True"},{name:"s_noise",val:": float = 1.0"}],parametersDescription:[{anchor:"diffusers.DPMSolverSDEScheduler.step.Predict",description:"<strong>Predict</strong> the sample at the previous timestep by reversing the SDE. Core function to propagate the diffusion &#x2014;",name:"Predict"},{anchor:"diffusers.DPMSolverSDEScheduler.step.process",description:"<strong>process</strong> from the learned model outputs (most often the predicted noise). &#x2014;",name:"process"},{anchor:"diffusers.DPMSolverSDEScheduler.step.model_output",description:"<strong>model_output</strong> (Union[torch.FloatTensor, np.ndarray]) &#x2014; Direct output from learned diffusion model.",name:"model_output"},{anchor:"diffusers.DPMSolverSDEScheduler.step.timestep",description:"<strong>timestep</strong> (Union[float, torch.FloatTensor]) &#x2014; Current discrete timestep in the diffusion chain.",name:"timestep"},{anchor:"diffusers.DPMSolverSDEScheduler.step.sample",description:"<strong>sample</strong> (Union[torch.FloatTensor, np.ndarray]) &#x2014; Current instance of sample being created by diffusion process.",name:"sample"},{anchor:"diffusers.DPMSolverSDEScheduler.step.return_dict",description:"<strong>return_dict</strong> (bool, optional) &#x2014; Option for returning tuple rather than SchedulerOutput class. Defaults to True.",name:"return_dict"},{anchor:"diffusers.DPMSolverSDEScheduler.step.s_noise",description:"<strong>s_noise</strong> (float, optional) &#x2014; Scaling factor for the noise added to the sample. Defaults to 1.0.",name:"s_noise"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/schedulers/scheduling_dpmsolver_sde.py#L320",returnDescription:`
<p><a
  href="/docs/diffusers/v0.17.0/en/api/schedulers/overview#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> if <code>return_dict</code> is True, otherwise a <code>tuple</code>. When
returning a tuple, the first element is the sample tensor.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/v0.17.0/en/api/schedulers/overview#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> or <code>tuple</code></p>
`}}),{c(){_=s("meta"),le=u(),S=s("h1"),D=s("a"),Y=s("span"),L(P.$$.fragment),be=u(),Z=s("span"),ye=i("DPM Stochastic Scheduler inspired by Karras et. al paper"),de=u(),b=s("h2"),E=s("a"),ee=s("span"),L(k.$$.fragment),De=u(),te=s("span"),Ee=i("Overview"),ce=u(),g=s("p"),we=i("Inspired by Stochastic Sampler from "),x=s("a"),$e=i("Karras et. al"),Pe=i(`.
Scheduler ported from @crowsonkb\u2019s `),M=s("a"),ke=i("https://github.com/crowsonkb/k-diffusion"),xe=i(" library:"),pe=u(),A=s("p"),Me=i("All credit for making this scheduler work goes to "),T=s("a"),Ae=i("Katherine Crowson"),fe=u(),y=s("h2"),w=s("a"),re=s("span"),L(C.$$.fragment),Te=u(),se=s("span"),Ce=i("DPMSolverSDEScheduler"),ue=u(),c=s("div"),L(O.$$.fragment),Oe=u(),z=s("p"),Ne=i(`Implements Stochastic Sampler (Algorithm 2) from Karras et al. (2022). Based on the original k-diffusion
implementation by Katherine Crowson:
`),N=s("a"),Ie=i("https://github.com/crowsonkb/k-diffusion/blob/41b4cb6df0506694a7776af31349acf082bf6091/k_diffusion/sampling.py#L543"),Ke=u(),d=s("p"),G=s("a"),Fe=i("~ConfigMixin"),Le=i(" takes care of storing all config attributes that are passed in the scheduler\u2019s "),oe=s("code"),Ue=i("__init__"),qe=i(`
function, such as `),ne=s("code"),Ve=i("num_train_timesteps"),Be=i(". They can be accessed via "),ae=s("code"),He=i("scheduler.config.num_train_timesteps"),ze=i(`.
`),J=s("a"),Ge=i("SchedulerMixin"),Je=i(" provides general loading and saving functionality via the "),R=s("a"),Re=i("SchedulerMixin.save_pretrained()"),We=i(` and
`),W=s("a"),je=i("from_pretrained()"),Qe=i(" functions."),Xe=u(),j=s("div"),L(I.$$.fragment),Ye=u(),$=s("div"),L(K.$$.fragment),Ze=u(),ie=s("p"),et=i("Sets the timesteps used for the diffusion chain. Supporting function to be run before inference."),tt=u(),Q=s("div"),L(F.$$.fragment),this.h()},l(t){const p=Ct('[data-svelte="svelte-1phssyn"]',document.head);_=o(p,"META",{name:!0,content:!0}),p.forEach(r),le=h(t),S=o(t,"H1",{class:!0});var me=n(S);D=o(me,"A",{id:!0,class:!0,href:!0});var at=n(D);Y=o(at,"SPAN",{});var it=n(Y);U(P.$$.fragment,it),it.forEach(r),at.forEach(r),be=h(me),Z=o(me,"SPAN",{});var lt=n(Z);ye=l(lt,"DPM Stochastic Scheduler inspired by Karras et. al paper"),lt.forEach(r),me.forEach(r),de=h(t),b=o(t,"H2",{class:!0});var ve=n(b);E=o(ve,"A",{id:!0,class:!0,href:!0});var dt=n(E);ee=o(dt,"SPAN",{});var ct=n(ee);U(k.$$.fragment,ct),ct.forEach(r),dt.forEach(r),De=h(ve),te=o(ve,"SPAN",{});var pt=n(te);Ee=l(pt,"Overview"),pt.forEach(r),ve.forEach(r),ce=h(t),g=o(t,"P",{});var X=n(g);we=l(X,"Inspired by Stochastic Sampler from "),x=o(X,"A",{href:!0,rel:!0});var ft=n(x);$e=l(ft,"Karras et. al"),ft.forEach(r),Pe=l(X,`.
Scheduler ported from @crowsonkb\u2019s `),M=o(X,"A",{href:!0,rel:!0});var ut=n(M);ke=l(ut,"https://github.com/crowsonkb/k-diffusion"),ut.forEach(r),xe=l(X," library:"),X.forEach(r),pe=h(t),A=o(t,"P",{});var rt=n(A);Me=l(rt,"All credit for making this scheduler work goes to "),T=o(rt,"A",{href:!0,rel:!0});var ht=n(T);Ae=l(ht,"Katherine Crowson"),ht.forEach(r),rt.forEach(r),fe=h(t),y=o(t,"H2",{class:!0});var ge=n(y);w=o(ge,"A",{id:!0,class:!0,href:!0});var mt=n(w);re=o(mt,"SPAN",{});var vt=n(re);U(C.$$.fragment,vt),vt.forEach(r),mt.forEach(r),Te=h(ge),se=o(ge,"SPAN",{});var gt=n(se);Ce=l(gt,"DPMSolverSDEScheduler"),gt.forEach(r),ge.forEach(r),ue=h(t),c=o(t,"DIV",{class:!0});var m=n(c);U(O.$$.fragment,m),Oe=h(m),z=o(m,"P",{});var st=n(z);Ne=l(st,`Implements Stochastic Sampler (Algorithm 2) from Karras et al. (2022). Based on the original k-diffusion
implementation by Katherine Crowson:
`),N=o(st,"A",{href:!0,rel:!0});var _t=n(N);Ie=l(_t,"https://github.com/crowsonkb/k-diffusion/blob/41b4cb6df0506694a7776af31349acf082bf6091/k_diffusion/sampling.py#L543"),_t.forEach(r),st.forEach(r),Ke=h(m),d=o(m,"P",{});var f=n(d);G=o(f,"A",{href:!0});var St=n(G);Fe=l(St,"~ConfigMixin"),St.forEach(r),Le=l(f," takes care of storing all config attributes that are passed in the scheduler\u2019s "),oe=o(f,"CODE",{});var bt=n(oe);Ue=l(bt,"__init__"),bt.forEach(r),qe=l(f,`
function, such as `),ne=o(f,"CODE",{});var yt=n(ne);Ve=l(yt,"num_train_timesteps"),yt.forEach(r),Be=l(f,". They can be accessed via "),ae=o(f,"CODE",{});var Dt=n(ae);He=l(Dt,"scheduler.config.num_train_timesteps"),Dt.forEach(r),ze=l(f,`.
`),J=o(f,"A",{href:!0});var Et=n(J);Ge=l(Et,"SchedulerMixin"),Et.forEach(r),Je=l(f," provides general loading and saving functionality via the "),R=o(f,"A",{href:!0});var wt=n(R);Re=l(wt,"SchedulerMixin.save_pretrained()"),wt.forEach(r),We=l(f,` and
`),W=o(f,"A",{href:!0});var $t=n(W);je=l($t,"from_pretrained()"),$t.forEach(r),Qe=l(f," functions."),f.forEach(r),Xe=h(m),j=o(m,"DIV",{class:!0});var Pt=n(j);U(I.$$.fragment,Pt),Pt.forEach(r),Ye=h(m),$=o(m,"DIV",{class:!0});var _e=n($);U(K.$$.fragment,_e),Ze=h(_e),ie=o(_e,"P",{});var kt=n(ie);et=l(kt,"Sets the timesteps used for the diffusion chain. Supporting function to be run before inference."),kt.forEach(r),_e.forEach(r),tt=h(m),Q=o(m,"DIV",{class:!0});var xt=n(Q);U(F.$$.fragment,xt),xt.forEach(r),m.forEach(r),this.h()},h(){a(_,"name","hf:doc:metadata"),a(_,"content",JSON.stringify(Kt)),a(D,"id","dpm-stochastic-scheduler-inspired-by-karras-et-al-paper"),a(D,"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"),a(D,"href","#dpm-stochastic-scheduler-inspired-by-karras-et-al-paper"),a(S,"class","relative group"),a(E,"id","overview"),a(E,"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"),a(E,"href","#overview"),a(b,"class","relative group"),a(x,"href","https://arxiv.org/abs/2206.00364"),a(x,"rel","nofollow"),a(M,"href","https://github.com/crowsonkb/k-diffusion"),a(M,"rel","nofollow"),a(T,"href","https://github.com/crowsonkb/"),a(T,"rel","nofollow"),a(w,"id","diffusers.DPMSolverSDEScheduler"),a(w,"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"),a(w,"href","#diffusers.DPMSolverSDEScheduler"),a(y,"class","relative group"),a(N,"href","https://github.com/crowsonkb/k-diffusion/blob/41b4cb6df0506694a7776af31349acf082bf6091/k_diffusion/sampling.py#L543"),a(N,"rel","nofollow"),a(G,"href","/docs/diffusers/v0.17.0/en/api/configuration#diffusers.ConfigMixin"),a(J,"href","/docs/diffusers/v0.17.0/en/api/schedulers/overview#diffusers.SchedulerMixin"),a(R,"href","/docs/diffusers/v0.17.0/en/api/schedulers/overview#diffusers.SchedulerMixin.save_pretrained"),a(W,"href","/docs/diffusers/v0.17.0/en/api/schedulers/overview#diffusers.SchedulerMixin.from_pretrained"),a(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),a($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),a(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),a(c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,p){e(document.head,_),v(t,le,p),v(t,S,p),e(S,D),e(D,Y),q(P,Y,null),e(S,be),e(S,Z),e(Z,ye),v(t,de,p),v(t,b,p),e(b,E),e(E,ee),q(k,ee,null),e(b,De),e(b,te),e(te,Ee),v(t,ce,p),v(t,g,p),e(g,we),e(g,x),e(x,$e),e(g,Pe),e(g,M),e(M,ke),e(g,xe),v(t,pe,p),v(t,A,p),e(A,Me),e(A,T),e(T,Ae),v(t,fe,p),v(t,y,p),e(y,w),e(w,re),q(C,re,null),e(y,Te),e(y,se),e(se,Ce),v(t,ue,p),v(t,c,p),q(O,c,null),e(c,Oe),e(c,z),e(z,Ne),e(z,N),e(N,Ie),e(c,Ke),e(c,d),e(d,G),e(G,Fe),e(d,Le),e(d,oe),e(oe,Ue),e(d,qe),e(d,ne),e(ne,Ve),e(d,Be),e(d,ae),e(ae,He),e(d,ze),e(d,J),e(J,Ge),e(d,Je),e(d,R),e(R,Re),e(d,We),e(d,W),e(W,je),e(d,Qe),e(c,Xe),e(c,j),q(I,j,null),e(c,Ye),e(c,$),q(K,$,null),e($,Ze),e($,ie),e(ie,et),e(c,tt),e(c,Q),q(F,Q,null),he=!0},p:Ot,i(t){he||(V(P.$$.fragment,t),V(k.$$.fragment,t),V(C.$$.fragment,t),V(O.$$.fragment,t),V(I.$$.fragment,t),V(K.$$.fragment,t),V(F.$$.fragment,t),he=!0)},o(t){B(P.$$.fragment,t),B(k.$$.fragment,t),B(C.$$.fragment,t),B(O.$$.fragment,t),B(I.$$.fragment,t),B(K.$$.fragment,t),B(F.$$.fragment,t),he=!1},d(t){r(_),t&&r(le),t&&r(S),H(P),t&&r(de),t&&r(b),H(k),t&&r(ce),t&&r(g),t&&r(pe),t&&r(A),t&&r(fe),t&&r(y),H(C),t&&r(ue),t&&r(c),H(O),H(I),H(K),H(F)}}}const Kt={local:"dpm-stochastic-scheduler-inspired-by-karras-et-al-paper",sections:[{local:"overview",title:"Overview"},{local:"diffusers.DPMSolverSDEScheduler",title:"DPMSolverSDEScheduler"}],title:"DPM Stochastic Scheduler inspired by Karras et. al paper"};function Ft(nt){return Nt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Vt extends Mt{constructor(_){super();At(this,_,Ft,It,Tt,{})}}export{Vt as default,Kt as metadata};
