import{S as $t,i as yt,s as wt,e as s,k as l,w as T,t as i,M as xt,c as n,d as r,m as d,a,x as O,h as c,b as o,G as e,g as f,y as k,L as Tt,q as P,o as C,B as F,v as Ot}from"../../../chunks/vendor-hf-doc-builder.js";import{D as ie}from"../../../chunks/Docstring-hf-doc-builder.js";import{I as nt}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function kt(at){let g,ce,_,A,j,N,$e,Q,ye,le,m,we,I,xe,Te,L,Oe,ke,de,v,D,X,M,Pe,Z,Ce,ue,u,q,Fe,ee,Ne,Ie,b,Le,B,Me,qe,J,Ve,Ue,Ge,$,V,He,U,ze,te,Ke,Re,Be,y,G,Je,re,We,Ye,w,H,je,se,Qe,he,E,x,ne,z,Xe,ae,Ze,pe,S,K,et,R,tt,oe,rt,st,fe;return N=new nt({}),M=new nt({}),q=new ie({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'"},{name:"timestep_spacing",val:": str = 'linspace'"},{name:"steps_offset",val:": int = 0"}],parametersDescription:[{anchor:"diffusers.EulerAncestralDiscreteScheduler.num_train_timesteps",description:`<strong>num_train_timesteps</strong> (<code>int</code>, defaults to 1000) &#x2014;
The number of diffusion steps to train the model.`,name:"num_train_timesteps"},{anchor:"diffusers.EulerAncestralDiscreteScheduler.beta_start",description:`<strong>beta_start</strong> (<code>float</code>, defaults to 0.0001) &#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>, defaults to 0.02) &#x2014;
The final <code>beta</code> value.`,name:"beta_end"},{anchor:"diffusers.EulerAncestralDiscreteScheduler.beta_schedule",description:`<strong>beta_schedule</strong> (<code>str</code>, defaults to <code>&quot;linear&quot;</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>, <em>optional</em>) &#x2014;
Pass an array of betas directly to the constructor to bypass <code>beta_start</code> and <code>beta_end</code>.`,name:"trained_betas"},{anchor:"diffusers.EulerAncestralDiscreteScheduler.prediction_type",description:`<strong>prediction_type</strong> (<code>str</code>, defaults to <code>epsilon</code>, <em>optional</em>) &#x2014;
Prediction type of the scheduler function; can be <code>epsilon</code> (predicts the noise of the diffusion process),
<code>sample</code> (directly predicts the noisy sample<code>) or </code>v_prediction\` (see section 2.4 of <a href="https://imagen.research.google/video/paper.pdf" rel="nofollow">Imagen
Video</a> paper).`,name:"prediction_type"},{anchor:"diffusers.EulerAncestralDiscreteScheduler.timestep_spacing",description:`<strong>timestep_spacing</strong> (<code>str</code>, defaults to <code>&quot;linspace&quot;</code>) &#x2014;
The way the timesteps should be scaled. Refer to Table 2 of the <a href="https://huggingface.co/papers/2305.08891" rel="nofollow">Common Diffusion Noise Schedules and
Sample Steps are Flawed</a> for more information.`,name:"timestep_spacing"},{anchor:"diffusers.EulerAncestralDiscreteScheduler.steps_offset",description:`<strong>steps_offset</strong> (<code>int</code>, defaults to 0) &#x2014;
An offset added to the inference steps. You can use a combination of <code>offset=1</code> and
<code>set_alpha_to_one=False</code> to make the last step use step 0 for the previous alpha product like in Stable
Diffusion.`,name:"steps_offset"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py#L94"}}),V=new ie({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;
The input sample.`,name:"sample"},{anchor:"diffusers.EulerAncestralDiscreteScheduler.scale_model_input.timestep",description:`<strong>timestep</strong> (<code>int</code>, <em>optional</em>) &#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#L177",returnDescription:`
<p>A scaled input sample.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),G=new ie({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>, <em>optional</em>) &#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#L202"}}),H=new ie({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;
The direct output from learned diffusion model.`,name:"model_output"},{anchor:"diffusers.EulerAncestralDiscreteScheduler.step.timestep",description:`<strong>timestep</strong> (<code>float</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.EulerAncestralDiscreteScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
A current instance of a sample created by the diffusion process.`,name:"sample"},{anchor:"diffusers.EulerAncestralDiscreteScheduler.step.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
A random number generator.`,name:"generator"},{anchor:"diffusers.EulerAncestralDiscreteScheduler.step.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>) &#x2014;
Whether or not to return a
<a href="/docs/diffusers/main/en/api/schedulers/euler_ancestral#diffusers.schedulers.scheduling_euler_ancestral_discrete.EulerAncestralDiscreteSchedulerOutput">EulerAncestralDiscreteSchedulerOutput</a> or tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py#L246",returnDescription:`
<p>If return_dict is <code>True</code>,
<a
  href="/docs/diffusers/main/en/api/schedulers/euler_ancestral#diffusers.schedulers.scheduling_euler_ancestral_discrete.EulerAncestralDiscreteSchedulerOutput"
>EulerAncestralDiscreteSchedulerOutput</a> is returned,
otherwise a tuple is returned where the first element is the sample tensor.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/main/en/api/schedulers/euler_ancestral#diffusers.schedulers.scheduling_euler_ancestral_discrete.EulerAncestralDiscreteSchedulerOutput"
>EulerAncestralDiscreteSchedulerOutput</a> or <code>tuple</code></p>
`}}),z=new nt({}),K=new ie({props:{name:"class diffusers.schedulers.scheduling_euler_ancestral_discrete.EulerAncestralDiscreteSchedulerOutput",anchor:"diffusers.schedulers.scheduling_euler_ancestral_discrete.EulerAncestralDiscreteSchedulerOutput",parameters:[{name:"prev_sample",val:": FloatTensor"},{name:"pred_original_sample",val:": typing.Optional[torch.FloatTensor] = None"}],parametersDescription:[{anchor:"diffusers.schedulers.scheduling_euler_ancestral_discrete.EulerAncestralDiscreteSchedulerOutput.prev_sample",description:`<strong>prev_sample</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code> for images) &#x2014;
Computed sample <code>(x_{t-1})</code> of previous timestep. <code>prev_sample</code> should be used as next model input in the
denoising loop.`,name:"prev_sample"},{anchor:"diffusers.schedulers.scheduling_euler_ancestral_discrete.EulerAncestralDiscreteSchedulerOutput.pred_original_sample",description:`<strong>pred_original_sample</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code> for images) &#x2014;
The predicted denoised sample <code>(x_{0})</code> based on the model output from the current timestep.
<code>pred_original_sample</code> can be used to preview progress or for guidance.`,name:"pred_original_sample"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py#L32"}}),{c(){g=s("meta"),ce=l(),_=s("h1"),A=s("a"),j=s("span"),T(N.$$.fragment),$e=l(),Q=s("span"),ye=i("EulerAncestralDiscreteScheduler"),le=l(),m=s("p"),we=i("A scheduler that uses ancestral sampling with Euler method steps. This is a fast scheduler which can often generate good outputs in 20-30 steps. The scheduler is based on the original "),I=s("a"),xe=i("k-diffusion"),Te=i(" implementation by "),L=s("a"),Oe=i("Katherine Crowson"),ke=i("."),de=l(),v=s("h2"),D=s("a"),X=s("span"),T(M.$$.fragment),Pe=l(),Z=s("span"),Ce=i("EulerAncestralDiscreteScheduler"),ue=l(),u=s("div"),T(q.$$.fragment),Fe=l(),ee=s("p"),Ne=i("Ancestral sampling with Euler method steps."),Ie=l(),b=s("p"),Le=i("This model inherits from "),B=s("a"),Me=i("SchedulerMixin"),qe=i(" and "),J=s("a"),Ve=i("ConfigMixin"),Ue=i(`. Check the superclass documentation for the generic
methods the library implements for all schedulers such as loading and saving.`),Ge=l(),$=s("div"),T(V.$$.fragment),He=l(),U=s("p"),ze=i(`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep. Scales the denoising model input by `),te=s("code"),Ke=i("(sigma**2 + 1) ** 0.5"),Re=i(" to match the Euler algorithm."),Be=l(),y=s("div"),T(G.$$.fragment),Je=l(),re=s("p"),We=i("Sets the discrete timesteps used for the diffusion chain (to be run before inference)."),Ye=l(),w=s("div"),T(H.$$.fragment),je=l(),se=s("p"),Qe=i(`Predict the sample from the previous timestep by reversing the SDE. This function propagates the diffusion
process from the learned model outputs (most often the predicted noise).`),he=l(),E=s("h2"),x=s("a"),ne=s("span"),T(z.$$.fragment),Xe=l(),ae=s("span"),Ze=i("EulerAncestralDiscreteSchedulerOutput"),pe=l(),S=s("div"),T(K.$$.fragment),et=l(),R=s("p"),tt=i("Output class for the scheduler\u2019s "),oe=s("code"),rt=i("step"),st=i(" function output."),this.h()},l(t){const h=xt('[data-svelte="svelte-1phssyn"]',document.head);g=n(h,"META",{name:!0,content:!0}),h.forEach(r),ce=d(t),_=n(t,"H1",{class:!0});var me=a(_);A=n(me,"A",{id:!0,class:!0,href:!0});var ot=a(A);j=n(ot,"SPAN",{});var it=a(j);O(N.$$.fragment,it),it.forEach(r),ot.forEach(r),$e=d(me),Q=n(me,"SPAN",{});var ct=a(Q);ye=c(ct,"EulerAncestralDiscreteScheduler"),ct.forEach(r),me.forEach(r),le=d(t),m=n(t,"P",{});var W=a(m);we=c(W,"A scheduler that uses ancestral sampling with Euler method steps. This is a fast scheduler which can often generate good outputs in 20-30 steps. The scheduler is based on the original "),I=n(W,"A",{href:!0,rel:!0});var lt=a(I);xe=c(lt,"k-diffusion"),lt.forEach(r),Te=c(W," implementation by "),L=n(W,"A",{href:!0,rel:!0});var dt=a(L);Oe=c(dt,"Katherine Crowson"),dt.forEach(r),ke=c(W,"."),W.forEach(r),de=d(t),v=n(t,"H2",{class:!0});var ge=a(v);D=n(ge,"A",{id:!0,class:!0,href:!0});var ut=a(D);X=n(ut,"SPAN",{});var ht=a(X);O(M.$$.fragment,ht),ht.forEach(r),ut.forEach(r),Pe=d(ge),Z=n(ge,"SPAN",{});var pt=a(Z);Ce=c(pt,"EulerAncestralDiscreteScheduler"),pt.forEach(r),ge.forEach(r),ue=d(t),u=n(t,"DIV",{class:!0});var p=a(u);O(q.$$.fragment,p),Fe=d(p),ee=n(p,"P",{});var ft=a(ee);Ne=c(ft,"Ancestral sampling with Euler method steps."),ft.forEach(r),Ie=d(p),b=n(p,"P",{});var Y=a(b);Le=c(Y,"This model inherits from "),B=n(Y,"A",{href:!0});var mt=a(B);Me=c(mt,"SchedulerMixin"),mt.forEach(r),qe=c(Y," and "),J=n(Y,"A",{href:!0});var gt=a(J);Ve=c(gt,"ConfigMixin"),gt.forEach(r),Ue=c(Y,`. Check the superclass documentation for the generic
methods the library implements for all schedulers such as loading and saving.`),Y.forEach(r),Ge=d(p),$=n(p,"DIV",{class:!0});var _e=a($);O(V.$$.fragment,_e),He=d(_e),U=n(_e,"P",{});var ve=a(U);ze=c(ve,`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep. Scales the denoising model input by `),te=n(ve,"CODE",{});var _t=a(te);Ke=c(_t,"(sigma**2 + 1) ** 0.5"),_t.forEach(r),Re=c(ve," to match the Euler algorithm."),ve.forEach(r),_e.forEach(r),Be=d(p),y=n(p,"DIV",{class:!0});var be=a(y);O(G.$$.fragment,be),Je=d(be),re=n(be,"P",{});var vt=a(re);We=c(vt,"Sets the discrete timesteps used for the diffusion chain (to be run before inference)."),vt.forEach(r),be.forEach(r),Ye=d(p),w=n(p,"DIV",{class:!0});var Ee=a(w);O(H.$$.fragment,Ee),je=d(Ee),se=n(Ee,"P",{});var bt=a(se);Qe=c(bt,`Predict the sample from the previous timestep by reversing the SDE. This function propagates the diffusion
process from the learned model outputs (most often the predicted noise).`),bt.forEach(r),Ee.forEach(r),p.forEach(r),he=d(t),E=n(t,"H2",{class:!0});var Se=a(E);x=n(Se,"A",{id:!0,class:!0,href:!0});var Et=a(x);ne=n(Et,"SPAN",{});var St=a(ne);O(z.$$.fragment,St),St.forEach(r),Et.forEach(r),Xe=d(Se),ae=n(Se,"SPAN",{});var At=a(ae);Ze=c(At,"EulerAncestralDiscreteSchedulerOutput"),At.forEach(r),Se.forEach(r),pe=d(t),S=n(t,"DIV",{class:!0});var Ae=a(S);O(K.$$.fragment,Ae),et=d(Ae),R=n(Ae,"P",{});var De=a(R);tt=c(De,"Output class for the scheduler\u2019s "),oe=n(De,"CODE",{});var Dt=a(oe);rt=c(Dt,"step"),Dt.forEach(r),st=c(De," function output."),De.forEach(r),Ae.forEach(r),this.h()},h(){o(g,"name","hf:doc:metadata"),o(g,"content",JSON.stringify(Pt)),o(A,"id","eulerancestraldiscretescheduler"),o(A,"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"),o(A,"href","#eulerancestraldiscretescheduler"),o(_,"class","relative group"),o(I,"href","https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L72"),o(I,"rel","nofollow"),o(L,"href","https://github.com/crowsonkb/"),o(L,"rel","nofollow"),o(D,"id","diffusers.EulerAncestralDiscreteScheduler"),o(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"),o(D,"href","#diffusers.EulerAncestralDiscreteScheduler"),o(v,"class","relative group"),o(B,"href","/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin"),o(J,"href","/docs/diffusers/main/en/api/configuration#diffusers.ConfigMixin"),o($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),o(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),o(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),o(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),o(x,"id","diffusers.schedulers.scheduling_euler_ancestral_discrete.EulerAncestralDiscreteSchedulerOutput"),o(x,"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"),o(x,"href","#diffusers.schedulers.scheduling_euler_ancestral_discrete.EulerAncestralDiscreteSchedulerOutput"),o(E,"class","relative group"),o(S,"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),f(t,ce,h),f(t,_,h),e(_,A),e(A,j),k(N,j,null),e(_,$e),e(_,Q),e(Q,ye),f(t,le,h),f(t,m,h),e(m,we),e(m,I),e(I,xe),e(m,Te),e(m,L),e(L,Oe),e(m,ke),f(t,de,h),f(t,v,h),e(v,D),e(D,X),k(M,X,null),e(v,Pe),e(v,Z),e(Z,Ce),f(t,ue,h),f(t,u,h),k(q,u,null),e(u,Fe),e(u,ee),e(ee,Ne),e(u,Ie),e(u,b),e(b,Le),e(b,B),e(B,Me),e(b,qe),e(b,J),e(J,Ve),e(b,Ue),e(u,Ge),e(u,$),k(V,$,null),e($,He),e($,U),e(U,ze),e(U,te),e(te,Ke),e(U,Re),e(u,Be),e(u,y),k(G,y,null),e(y,Je),e(y,re),e(re,We),e(u,Ye),e(u,w),k(H,w,null),e(w,je),e(w,se),e(se,Qe),f(t,he,h),f(t,E,h),e(E,x),e(x,ne),k(z,ne,null),e(E,Xe),e(E,ae),e(ae,Ze),f(t,pe,h),f(t,S,h),k(K,S,null),e(S,et),e(S,R),e(R,tt),e(R,oe),e(oe,rt),e(R,st),fe=!0},p:Tt,i(t){fe||(P(N.$$.fragment,t),P(M.$$.fragment,t),P(q.$$.fragment,t),P(V.$$.fragment,t),P(G.$$.fragment,t),P(H.$$.fragment,t),P(z.$$.fragment,t),P(K.$$.fragment,t),fe=!0)},o(t){C(N.$$.fragment,t),C(M.$$.fragment,t),C(q.$$.fragment,t),C(V.$$.fragment,t),C(G.$$.fragment,t),C(H.$$.fragment,t),C(z.$$.fragment,t),C(K.$$.fragment,t),fe=!1},d(t){r(g),t&&r(ce),t&&r(_),F(N),t&&r(le),t&&r(m),t&&r(de),t&&r(v),F(M),t&&r(ue),t&&r(u),F(q),F(V),F(G),F(H),t&&r(he),t&&r(E),F(z),t&&r(pe),t&&r(S),F(K)}}}const Pt={local:"eulerancestraldiscretescheduler",sections:[{local:"diffusers.EulerAncestralDiscreteScheduler",title:"EulerAncestralDiscreteScheduler"},{local:"diffusers.schedulers.scheduling_euler_ancestral_discrete.EulerAncestralDiscreteSchedulerOutput",title:"EulerAncestralDiscreteSchedulerOutput"}],title:"EulerAncestralDiscreteScheduler"};function Ct(at){return Ot(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Lt extends $t{constructor(g){super();yt(this,g,Ct,kt,wt,{})}}export{Lt as default,Pt as metadata};
