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