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