import{S as Kt,i as Bt,s as It,e as s,k as u,w as G,t as a,M as Gt,c as o,d as r,m as f,a as n,x as U,h as i,b as c,G as e,g as _,y as V,L as Ut,q as H,o as R,B as J,v as Vt}from"../../../chunks/vendor-hf-doc-builder.js";import{D as we}from"../../../chunks/Docstring-hf-doc-builder.js";import{I as ht}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function Ht(pt){let v,ue,b,S,Y,T,De,Z,xe,fe,E,$,ee,C,ke,te,Ae,he,g,Te,P,Ce,Pe,M,Me,qe,pe,y,w,re,q,Fe,se,Le,me,d,F,Ne,D,Oe,L,Ke,Be,N,Ie,Ge,l,W,Ue,Ve,oe,He,Re,ne,Je,We,ae,je,ze,j,Qe,Xe,z,Ye,Ze,Q,et,tt,rt,x,O,st,K,ot,ie,nt,at,it,k,B,ct,ce,lt,dt,A,I,ut,le,ft,ge;return T=new ht({}),C=new ht({}),q=new ht({}),F=new we({props:{name:"class diffusers.EulerDiscreteScheduler",anchor:"diffusers.EulerDiscreteScheduler",parameters:[{name:"num_train_timesteps",val:": int = 1000"},{name:"beta_start",val:": float = 0.0001"},{name:"beta_end",val:": float = 0.02"},{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:"interpolation_type",val:": str = 'linear'"}],parametersDescription:[{anchor:"diffusers.EulerDiscreteScheduler.num_train_timesteps",description:"<strong>num_train_timesteps</strong> (<code>int</code>) &#x2014; number of diffusion steps used to train the model.",name:"num_train_timesteps"},{anchor:"diffusers.EulerDiscreteScheduler.beta_start",description:"<strong>beta_start</strong> (<code>float</code>) &#x2014; the starting <code>beta</code> value of inference.",name:"beta_start"},{anchor:"diffusers.EulerDiscreteScheduler.beta_end",description:"<strong>beta_end</strong> (<code>float</code>) &#x2014; the final <code>beta</code> value.",name:"beta_end"},{anchor:"diffusers.EulerDiscreteScheduler.beta_schedule",description:`<strong>beta_schedule</strong> (<code>str</code>) &#x2014;
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:"beta_schedule"},{anchor:"diffusers.EulerDiscreteScheduler.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.EulerDiscreteScheduler.prediction_type",description:`<strong>prediction_type</strong> (<code>str</code>, default <code>&quot;epsilon&quot;</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.EulerDiscreteScheduler.interpolation_type",description:`<strong>interpolation_type</strong> (<code>str</code>, default <code>&quot;linear&quot;</code>, optional) &#x2014;
interpolation type to compute intermediate sigmas for the scheduler denoising steps. Should be one of
[<code>&quot;linear&quot;</code>, <code>&quot;log_linear&quot;</code>].`,name:"interpolation_type"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_euler_discrete.py#L79"}}),O=new we({props:{name:"scale_model_input",anchor:"diffusers.EulerDiscreteScheduler.scale_model_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"timestep",val:": typing.Union[float, torch.FloatTensor]"}],parametersDescription:[{anchor:"diffusers.EulerDiscreteScheduler.scale_model_input.sample",description:"<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014; input sample",name:"sample"},{anchor:"diffusers.EulerDiscreteScheduler.scale_model_input.timestep",description:"<strong>timestep</strong> (<code>float</code> or <code>torch.FloatTensor</code>) &#x2014; the current timestep in the diffusion chain",name:"timestep"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_euler_discrete.py#L153",returnDescription:`
<p>scaled input sample</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),B=new we({props:{name:"set_timesteps",anchor:"diffusers.EulerDiscreteScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": typing.Union[str, torch.device] = None"}],parametersDescription:[{anchor:"diffusers.EulerDiscreteScheduler.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.EulerDiscreteScheduler.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/main/src/diffusers/schedulers/scheduling_euler_discrete.py#L176"}}),I=new we({props:{name:"step",anchor:"diffusers.EulerDiscreteScheduler.step",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": typing.Union[float, torch.FloatTensor]"},{name:"sample",val:": FloatTensor"},{name:"s_churn",val:": float = 0.0"},{name:"s_tmin",val:": float = 0.0"},{name:"s_tmax",val:": float = inf"},{name:"s_noise",val:": float = 1.0"},{name:"generator",val:": typing.Optional[torch._C.Generator] = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.EulerDiscreteScheduler.step.model_output",description:"<strong>model_output</strong> (<code>torch.FloatTensor</code>) &#x2014; direct output from learned diffusion model.",name:"model_output"},{anchor:"diffusers.EulerDiscreteScheduler.step.timestep",description:"<strong>timestep</strong> (<code>float</code>) &#x2014; current timestep in the diffusion chain.",name:"timestep"},{anchor:"diffusers.EulerDiscreteScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
current instance of sample being created by diffusion process.`,name:"sample"},{anchor:"diffusers.EulerDiscreteScheduler.step.s_churn",description:"<strong>s_churn</strong> (<code>float</code>) &#x2014;",name:"s_churn"},{anchor:"diffusers.EulerDiscreteScheduler.step.s_tmin",description:"<strong>s_tmin</strong>  (<code>float</code>) &#x2014;",name:"s_tmin"},{anchor:"diffusers.EulerDiscreteScheduler.step.s_tmax",description:"<strong>s_tmax</strong>  (<code>float</code>) &#x2014;",name:"s_tmax"},{anchor:"diffusers.EulerDiscreteScheduler.step.s_noise",description:"<strong>s_noise</strong> (<code>float</code>) &#x2014;",name:"s_noise"},{anchor:"diffusers.EulerDiscreteScheduler.step.generator",description:"<strong>generator</strong> (<code>torch.Generator</code>, optional) &#x2014; Random number generator.",name:"generator"},{anchor:"diffusers.EulerDiscreteScheduler.step.return_dict",description:"<strong>return_dict</strong> (<code>bool</code>) &#x2014; option for returning tuple rather than EulerDiscreteSchedulerOutput class",name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_euler_discrete.py#L209",returnDescription:`
<p><code>~schedulers.scheduling_utils.EulerDiscreteSchedulerOutput</code> 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><code>~schedulers.scheduling_utils.EulerDiscreteSchedulerOutput</code> or <code>tuple</code></p>
`}}),{c(){v=s("meta"),ue=u(),b=s("h1"),S=s("a"),Y=s("span"),G(T.$$.fragment),De=u(),Z=s("span"),xe=a("Euler scheduler"),fe=u(),E=s("h2"),$=s("a"),ee=s("span"),G(C.$$.fragment),ke=u(),te=s("span"),Ae=a("Overview"),he=u(),g=s("p"),Te=a("Euler scheduler (Algorithm 2) from the paper "),P=s("a"),Ce=a("Elucidating the Design Space of Diffusion-Based Generative Models"),Pe=a(" by Karras et al. (2022). Based on the original "),M=s("a"),Me=a("k-diffusion"),qe=a(` implementation by Katherine Crowson.
Fast scheduler which often times generates good outputs with 20-30 steps.`),pe=u(),y=s("h2"),w=s("a"),re=s("span"),G(q.$$.fragment),Fe=u(),se=s("span"),Le=a("EulerDiscreteScheduler"),me=u(),d=s("div"),G(F.$$.fragment),Ne=u(),D=s("p"),Oe=a("Euler scheduler (Algorithm 2) from Karras et al. (2022) "),L=s("a"),Ke=a("https://arxiv.org/abs/2206.00364"),Be=a(`. . Based on the original
k-diffusion implementation by Katherine Crowson:
`),N=s("a"),Ie=a("https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L51"),Ge=u(),l=s("p"),W=s("a"),Ue=a("~ConfigMixin"),Ve=a(" takes care of storing all config attributes that are passed in the scheduler\u2019s "),oe=s("code"),He=a("__init__"),Re=a(`
function, such as `),ne=s("code"),Je=a("num_train_timesteps"),We=a(". They can be accessed via "),ae=s("code"),je=a("scheduler.config.num_train_timesteps"),ze=a(`.
`),j=s("a"),Qe=a("SchedulerMixin"),Xe=a(" provides general loading and saving functionality via the "),z=s("a"),Ye=a("SchedulerMixin.save_pretrained()"),Ze=a(` and
`),Q=s("a"),et=a("from_pretrained()"),tt=a(" functions."),rt=u(),x=s("div"),G(O.$$.fragment),st=u(),K=s("p"),ot=a("Scales the denoising model input by "),ie=s("code"),nt=a("(sigma**2 + 1) ** 0.5"),at=a(" to match the Euler algorithm."),it=u(),k=s("div"),G(B.$$.fragment),ct=u(),ce=s("p"),lt=a("Sets the timesteps used for the diffusion chain. Supporting function to be run before inference."),dt=u(),A=s("div"),G(I.$$.fragment),ut=u(),le=s("p"),ft=a(`Predict the sample at the previous timestep by reversing the SDE. Core function to propagate the diffusion
process from the learned model outputs (most often the predicted noise).`),this.h()},l(t){const p=Gt('[data-svelte="svelte-1phssyn"]',document.head);v=o(p,"META",{name:!0,content:!0}),p.forEach(r),ue=f(t),b=o(t,"H1",{class:!0});var _e=n(b);S=o(_e,"A",{id:!0,class:!0,href:!0});var mt=n(S);Y=o(mt,"SPAN",{});var gt=n(Y);U(T.$$.fragment,gt),gt.forEach(r),mt.forEach(r),De=f(_e),Z=o(_e,"SPAN",{});var _t=n(Z);xe=i(_t,"Euler scheduler"),_t.forEach(r),_e.forEach(r),fe=f(t),E=o(t,"H2",{class:!0});var ve=n(E);$=o(ve,"A",{id:!0,class:!0,href:!0});var vt=n($);ee=o(vt,"SPAN",{});var bt=n(ee);U(C.$$.fragment,bt),bt.forEach(r),vt.forEach(r),ke=f(ve),te=o(ve,"SPAN",{});var Et=n(te);Ae=i(Et,"Overview"),Et.forEach(r),ve.forEach(r),he=f(t),g=o(t,"P",{});var X=n(g);Te=i(X,"Euler scheduler (Algorithm 2) from the paper "),P=o(X,"A",{href:!0,rel:!0});var yt=n(P);Ce=i(yt,"Elucidating the Design Space of Diffusion-Based Generative Models"),yt.forEach(r),Pe=i(X," by Karras et al. (2022). Based on the original "),M=o(X,"A",{href:!0,rel:!0});var St=n(M);Me=i(St,"k-diffusion"),St.forEach(r),qe=i(X,` implementation by Katherine Crowson.
Fast scheduler which often times generates good outputs with 20-30 steps.`),X.forEach(r),pe=f(t),y=o(t,"H2",{class:!0});var be=n(y);w=o(be,"A",{id:!0,class:!0,href:!0});var $t=n(w);re=o($t,"SPAN",{});var wt=n(re);U(q.$$.fragment,wt),wt.forEach(r),$t.forEach(r),Fe=f(be),se=o(be,"SPAN",{});var Dt=n(se);Le=i(Dt,"EulerDiscreteScheduler"),Dt.forEach(r),be.forEach(r),me=f(t),d=o(t,"DIV",{class:!0});var m=n(d);U(F.$$.fragment,m),Ne=f(m),D=o(m,"P",{});var de=n(D);Oe=i(de,"Euler scheduler (Algorithm 2) from Karras et al. (2022) "),L=o(de,"A",{href:!0,rel:!0});var xt=n(L);Ke=i(xt,"https://arxiv.org/abs/2206.00364"),xt.forEach(r),Be=i(de,`. . Based on the original
k-diffusion implementation by Katherine Crowson:
`),N=o(de,"A",{href:!0,rel:!0});var kt=n(N);Ie=i(kt,"https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L51"),kt.forEach(r),de.forEach(r),Ge=f(m),l=o(m,"P",{});var h=n(l);W=o(h,"A",{href:!0});var At=n(W);Ue=i(At,"~ConfigMixin"),At.forEach(r),Ve=i(h," takes care of storing all config attributes that are passed in the scheduler\u2019s "),oe=o(h,"CODE",{});var Tt=n(oe);He=i(Tt,"__init__"),Tt.forEach(r),Re=i(h,`
function, such as `),ne=o(h,"CODE",{});var Ct=n(ne);Je=i(Ct,"num_train_timesteps"),Ct.forEach(r),We=i(h,". They can be accessed via "),ae=o(h,"CODE",{});var Pt=n(ae);je=i(Pt,"scheduler.config.num_train_timesteps"),Pt.forEach(r),ze=i(h,`.
`),j=o(h,"A",{href:!0});var Mt=n(j);Qe=i(Mt,"SchedulerMixin"),Mt.forEach(r),Xe=i(h," provides general loading and saving functionality via the "),z=o(h,"A",{href:!0});var qt=n(z);Ye=i(qt,"SchedulerMixin.save_pretrained()"),qt.forEach(r),Ze=i(h,` and
`),Q=o(h,"A",{href:!0});var Ft=n(Q);et=i(Ft,"from_pretrained()"),Ft.forEach(r),tt=i(h," functions."),h.forEach(r),rt=f(m),x=o(m,"DIV",{class:!0});var Ee=n(x);U(O.$$.fragment,Ee),st=f(Ee),K=o(Ee,"P",{});var ye=n(K);ot=i(ye,"Scales the denoising model input by "),ie=o(ye,"CODE",{});var Lt=n(ie);nt=i(Lt,"(sigma**2 + 1) ** 0.5"),Lt.forEach(r),at=i(ye," to match the Euler algorithm."),ye.forEach(r),Ee.forEach(r),it=f(m),k=o(m,"DIV",{class:!0});var Se=n(k);U(B.$$.fragment,Se),ct=f(Se),ce=o(Se,"P",{});var Nt=n(ce);lt=i(Nt,"Sets the timesteps used for the diffusion chain. Supporting function to be run before inference."),Nt.forEach(r),Se.forEach(r),dt=f(m),A=o(m,"DIV",{class:!0});var $e=n(A);U(I.$$.fragment,$e),ut=f($e),le=o($e,"P",{});var Ot=n(le);ft=i(Ot,`Predict the sample at the previous timestep by reversing the SDE. Core function to propagate the diffusion
process from the learned model outputs (most often the predicted noise).`),Ot.forEach(r),$e.forEach(r),m.forEach(r),this.h()},h(){c(v,"name","hf:doc:metadata"),c(v,"content",JSON.stringify(Rt)),c(S,"id","euler-scheduler"),c(S,"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(S,"href","#euler-scheduler"),c(b,"class","relative group"),c($,"id","overview"),c($,"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($,"href","#overview"),c(E,"class","relative group"),c(P,"href","https://arxiv.org/abs/2206.00364"),c(P,"rel","nofollow"),c(M,"href","https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L51"),c(M,"rel","nofollow"),c(w,"id","diffusers.EulerDiscreteScheduler"),c(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"),c(w,"href","#diffusers.EulerDiscreteScheduler"),c(y,"class","relative group"),c(L,"href","https://arxiv.org/abs/2206.00364"),c(L,"rel","nofollow"),c(N,"href","https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L51"),c(N,"rel","nofollow"),c(W,"href","/docs/diffusers/main/en/api/configuration#diffusers.ConfigMixin"),c(j,"href","/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin"),c(z,"href","/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin.save_pretrained"),c(Q,"href","/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin.from_pretrained"),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(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(d,"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,ue,p),_(t,b,p),e(b,S),e(S,Y),V(T,Y,null),e(b,De),e(b,Z),e(Z,xe),_(t,fe,p),_(t,E,p),e(E,$),e($,ee),V(C,ee,null),e(E,ke),e(E,te),e(te,Ae),_(t,he,p),_(t,g,p),e(g,Te),e(g,P),e(P,Ce),e(g,Pe),e(g,M),e(M,Me),e(g,qe),_(t,pe,p),_(t,y,p),e(y,w),e(w,re),V(q,re,null),e(y,Fe),e(y,se),e(se,Le),_(t,me,p),_(t,d,p),V(F,d,null),e(d,Ne),e(d,D),e(D,Oe),e(D,L),e(L,Ke),e(D,Be),e(D,N),e(N,Ie),e(d,Ge),e(d,l),e(l,W),e(W,Ue),e(l,Ve),e(l,oe),e(oe,He),e(l,Re),e(l,ne),e(ne,Je),e(l,We),e(l,ae),e(ae,je),e(l,ze),e(l,j),e(j,Qe),e(l,Xe),e(l,z),e(z,Ye),e(l,Ze),e(l,Q),e(Q,et),e(l,tt),e(d,rt),e(d,x),V(O,x,null),e(x,st),e(x,K),e(K,ot),e(K,ie),e(ie,nt),e(K,at),e(d,it),e(d,k),V(B,k,null),e(k,ct),e(k,ce),e(ce,lt),e(d,dt),e(d,A),V(I,A,null),e(A,ut),e(A,le),e(le,ft),ge=!0},p:Ut,i(t){ge||(H(T.$$.fragment,t),H(C.$$.fragment,t),H(q.$$.fragment,t),H(F.$$.fragment,t),H(O.$$.fragment,t),H(B.$$.fragment,t),H(I.$$.fragment,t),ge=!0)},o(t){R(T.$$.fragment,t),R(C.$$.fragment,t),R(q.$$.fragment,t),R(F.$$.fragment,t),R(O.$$.fragment,t),R(B.$$.fragment,t),R(I.$$.fragment,t),ge=!1},d(t){r(v),t&&r(ue),t&&r(b),J(T),t&&r(fe),t&&r(E),J(C),t&&r(he),t&&r(g),t&&r(pe),t&&r(y),J(q),t&&r(me),t&&r(d),J(F),J(O),J(B),J(I)}}}const Rt={local:"euler-scheduler",sections:[{local:"overview",title:"Overview"},{local:"diffusers.EulerDiscreteScheduler",title:"EulerDiscreteScheduler"}],title:"Euler scheduler"};function Jt(pt){return Vt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Qt extends Kt{constructor(v){super();Bt(this,v,Jt,Ht,It,{})}}export{Qt as default,Rt as metadata};
