import{S as Bt,i as It,s as Gt,e as s,k as u,w as U,t as a,M as Ut,c as o,d as r,m as f,a as n,x as q,h as i,b as c,G as e,g as _,y as V,L as qt,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,Fe,pe,y,w,re,F,Le,se,Ne,me,d,L,Oe,D,Ke,N,Be,Ie,O,Ge,Ue,l,W,qe,Ve,oe,He,Re,ne,Je,We,ae,je,ze,j,Qe,Xe,z,Ye,Ze,Q,et,tt,rt,x,K,st,B,ot,ie,nt,at,it,k,I,ct,ce,lt,dt,A,G,ut,le,ft,ge;return T=new ht({}),C=new ht({}),F=new ht({}),L=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'"}],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>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"}],source:"https://github.com/huggingface/diffusers/blob/v0.12.0/src/diffusers/schedulers/scheduling_euler_discrete.py#L48"}}),K=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/v0.12.0/src/diffusers/schedulers/scheduling_euler_discrete.py#L116",returnDescription:`
<p>scaled input sample</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),I=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/v0.12.0/src/diffusers/schedulers/scheduling_euler_discrete.py#L137"}}),G=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/v0.12.0/src/diffusers/schedulers/scheduling_euler_discrete.py#L160",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"),U(T.$$.fragment),De=u(),Z=s("span"),xe=a("Euler scheduler"),fe=u(),E=s("h2"),$=s("a"),ee=s("span"),U(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"),Fe=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"),U(F.$$.fragment),Le=u(),se=s("span"),Ne=a("EulerDiscreteScheduler"),me=u(),d=s("div"),U(L.$$.fragment),Oe=u(),D=s("p"),Ke=a("Euler scheduler (Algorithm 2) from Karras et al. (2022) "),N=s("a"),Be=a("https://arxiv.org/abs/2206.00364"),Ie=a(`. . Based on the original
k-diffusion implementation by Katherine Crowson:
`),O=s("a"),Ge=a("https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L51"),Ue=u(),l=s("p"),W=s("a"),qe=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"),U(K.$$.fragment),st=u(),B=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"),U(I.$$.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"),U(G.$$.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=Ut('[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);q(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);q(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),Fe=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);q(F.$$.fragment,wt),wt.forEach(r),$t.forEach(r),Le=f(be),se=o(be,"SPAN",{});var Dt=n(se);Ne=i(Dt,"EulerDiscreteScheduler"),Dt.forEach(r),be.forEach(r),me=f(t),d=o(t,"DIV",{class:!0});var m=n(d);q(L.$$.fragment,m),Oe=f(m),D=o(m,"P",{});var de=n(D);Ke=i(de,"Euler scheduler (Algorithm 2) from Karras et al. (2022) "),N=o(de,"A",{href:!0,rel:!0});var xt=n(N);Be=i(xt,"https://arxiv.org/abs/2206.00364"),xt.forEach(r),Ie=i(de,`. . Based on the original
k-diffusion implementation by Katherine Crowson:
`),O=o(de,"A",{href:!0,rel:!0});var kt=n(O);Ge=i(kt,"https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L51"),kt.forEach(r),de.forEach(r),Ue=f(m),l=o(m,"P",{});var h=n(l);W=o(h,"A",{href:!0});var At=n(W);qe=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 Ft=n(z);Ye=i(Ft,"SchedulerMixin.save_pretrained()"),Ft.forEach(r),Ze=i(h,` and
`),Q=o(h,"A",{href:!0});var Lt=n(Q);et=i(Lt,"from_pretrained()"),Lt.forEach(r),tt=i(h," functions."),h.forEach(r),rt=f(m),x=o(m,"DIV",{class:!0});var Ee=n(x);q(K.$$.fragment,Ee),st=f(Ee),B=o(Ee,"P",{});var ye=n(B);ot=i(ye,"Scales the denoising model input by "),ie=o(ye,"CODE",{});var Nt=n(ie);nt=i(Nt,"(sigma**2 + 1) ** 0.5"),Nt.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);q(I.$$.fragment,Se),ct=f(Se),ce=o(Se,"P",{});var Ot=n(ce);lt=i(Ot,"Sets the timesteps used for the diffusion chain. Supporting function to be run before inference."),Ot.forEach(r),Se.forEach(r),dt=f(m),A=o(m,"DIV",{class:!0});var $e=n(A);q(G.$$.fragment,$e),ut=f($e),le=o($e,"P",{});var Kt=n(le);ft=i(Kt,`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).`),Kt.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(N,"href","https://arxiv.org/abs/2206.00364"),c(N,"rel","nofollow"),c(O,"href","https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L51"),c(O,"rel","nofollow"),c(W,"href","/docs/diffusers/v0.12.0/en/api/configuration#diffusers.ConfigMixin"),c(j,"href","/docs/diffusers/v0.12.0/en/api/schedulers/overview#diffusers.SchedulerMixin"),c(z,"href","/docs/diffusers/v0.12.0/en/api/schedulers/overview#diffusers.SchedulerMixin.save_pretrained"),c(Q,"href","/docs/diffusers/v0.12.0/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,Fe),_(t,pe,p),_(t,y,p),e(y,w),e(w,re),V(F,re,null),e(y,Le),e(y,se),e(se,Ne),_(t,me,p),_(t,d,p),V(L,d,null),e(d,Oe),e(d,D),e(D,Ke),e(D,N),e(N,Be),e(D,Ie),e(D,O),e(O,Ge),e(d,Ue),e(d,l),e(l,W),e(W,qe),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(K,x,null),e(x,st),e(x,B),e(B,ot),e(B,ie),e(ie,nt),e(B,at),e(d,it),e(d,k),V(I,k,null),e(k,ct),e(k,ce),e(ce,lt),e(d,dt),e(d,A),V(G,A,null),e(A,ut),e(A,le),e(le,ft),ge=!0},p:qt,i(t){ge||(H(T.$$.fragment,t),H(C.$$.fragment,t),H(F.$$.fragment,t),H(L.$$.fragment,t),H(K.$$.fragment,t),H(I.$$.fragment,t),H(G.$$.fragment,t),ge=!0)},o(t){R(T.$$.fragment,t),R(C.$$.fragment,t),R(F.$$.fragment,t),R(L.$$.fragment,t),R(K.$$.fragment,t),R(I.$$.fragment,t),R(G.$$.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(F),t&&r(me),t&&r(d),J(L),J(K),J(I),J(G)}}}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 Bt{constructor(v){super();It(this,v,Jt,Ht,Gt,{})}}export{Qt as default,Rt as metadata};
