import{s as $e,n as De,o as xe}from"../chunks/scheduler.182ea377.js";import{S as Ee,i as Se,g as i,s as o,r as g,A as Ae,h as c,f as t,c as a,j as L,u as _,x as P,k as F,y as s,a as l,v,d as b,t as $,w as D}from"../chunks/index.abf12888.js";import{D as U}from"../chunks/Docstring.93f6f462.js";import{H as ue}from"../chunks/Heading.16916d63.js";function ye(pe){let u,G,V,R,x,j,E,fe='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 <a href="https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L72" rel="nofollow">k-diffusion</a> implementation by <a href="https://github.com/crowsonkb/" rel="nofollow">Katherine Crowson</a>.',K,S,W,n,A,re,M,he="Ancestral sampling with Euler method steps.",se,k,me=`This model inherits from <a href="/docs/diffusers/v0.22.1/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a> and <a href="/docs/diffusers/v0.22.1/en/api/configuration#diffusers.ConfigMixin">ConfigMixin</a>. Check the superclass documentation for the generic
methods the library implements for all schedulers such as loading and saving.`,ne,f,y,oe,H,ge=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep. Scales the denoising model input by <code>(sigma**2 + 1) ** 0.5</code> to match the Euler algorithm.`,ae,h,T,ie,I,_e="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",ce,m,w,le,q,ve=`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).`,Y,C,B,p,O,de,N,be="Output class for the scheduler’s <code>step</code> function output.",J,z,Q;return x=new ue({props:{title:"EulerAncestralDiscreteScheduler",local:"eulerancestraldiscretescheduler",headingTag:"h1"}}),S=new ue({props:{title:"EulerAncestralDiscreteScheduler",local:"diffusers.EulerAncestralDiscreteScheduler",headingTag:"h2"}}),A=new U({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/v0.22.1/src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py#L95"}}),y=new U({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/v0.22.1/src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py#L187",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A scaled input sample.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.FloatTensor</code></p>
`}}),T=new U({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/v0.22.1/src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py#L213"}}),w=new U({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/v0.22.1/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/v0.22.1/src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py#L273",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If return_dict is <code>True</code>,
<a
  href="/docs/diffusers/v0.22.1/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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/diffusers/v0.22.1/en/api/schedulers/euler_ancestral#diffusers.schedulers.scheduling_euler_ancestral_discrete.EulerAncestralDiscreteSchedulerOutput"
>EulerAncestralDiscreteSchedulerOutput</a> or <code>tuple</code></p>
`}}),C=new ue({props:{title:"EulerAncestralDiscreteSchedulerOutput",local:"diffusers.schedulers.scheduling_euler_ancestral_discrete.EulerAncestralDiscreteSchedulerOutput",headingTag:"h2"}}),O=new U({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/v0.22.1/src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py#L33"}}),{c(){u=i("meta"),G=o(),V=i("p"),R=o(),g(x.$$.fragment),j=o(),E=i("p"),E.innerHTML=fe,K=o(),g(S.$$.fragment),W=o(),n=i("div"),g(A.$$.fragment),re=o(),M=i("p"),M.textContent=he,se=o(),k=i("p"),k.innerHTML=me,ne=o(),f=i("div"),g(y.$$.fragment),oe=o(),H=i("p"),H.innerHTML=ge,ae=o(),h=i("div"),g(T.$$.fragment),ie=o(),I=i("p"),I.textContent=_e,ce=o(),m=i("div"),g(w.$$.fragment),le=o(),q=i("p"),q.textContent=ve,Y=o(),g(C.$$.fragment),B=o(),p=i("div"),g(O.$$.fragment),de=o(),N=i("p"),N.innerHTML=be,J=o(),z=i("p"),this.h()},l(e){const r=Ae("svelte-u9bgzb",document.head);u=c(r,"META",{name:!0,content:!0}),r.forEach(t),G=a(e),V=c(e,"P",{}),L(V).forEach(t),R=a(e),_(x.$$.fragment,e),j=a(e),E=c(e,"P",{"data-svelte-h":!0}),P(E)!=="svelte-mxywa3"&&(E.innerHTML=fe),K=a(e),_(S.$$.fragment,e),W=a(e),n=c(e,"DIV",{class:!0});var d=L(n);_(A.$$.fragment,d),re=a(d),M=c(d,"P",{"data-svelte-h":!0}),P(M)!=="svelte-15vtfhh"&&(M.textContent=he),se=a(d),k=c(d,"P",{"data-svelte-h":!0}),P(k)!=="svelte-12yzxt5"&&(k.innerHTML=me),ne=a(d),f=c(d,"DIV",{class:!0});var X=L(f);_(y.$$.fragment,X),oe=a(X),H=c(X,"P",{"data-svelte-h":!0}),P(H)!=="svelte-1hew89w"&&(H.innerHTML=ge),X.forEach(t),ae=a(d),h=c(d,"DIV",{class:!0});var Z=L(h);_(T.$$.fragment,Z),ie=a(Z),I=c(Z,"P",{"data-svelte-h":!0}),P(I)!=="svelte-1vzm9q"&&(I.textContent=_e),Z.forEach(t),ce=a(d),m=c(d,"DIV",{class:!0});var ee=L(m);_(w.$$.fragment,ee),le=a(ee),q=c(ee,"P",{"data-svelte-h":!0}),P(q)!=="svelte-hi84tp"&&(q.textContent=ve),ee.forEach(t),d.forEach(t),Y=a(e),_(C.$$.fragment,e),B=a(e),p=c(e,"DIV",{class:!0});var te=L(p);_(O.$$.fragment,te),de=a(te),N=c(te,"P",{"data-svelte-h":!0}),P(N)!=="svelte-id9kic"&&(N.innerHTML=be),te.forEach(t),J=a(e),z=c(e,"P",{}),L(z).forEach(t),this.h()},h(){F(u,"name","hf:doc:metadata"),F(u,"content",Te),F(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),F(h,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),F(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),F(n,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),F(p,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,r){s(document.head,u),l(e,G,r),l(e,V,r),l(e,R,r),v(x,e,r),l(e,j,r),l(e,E,r),l(e,K,r),v(S,e,r),l(e,W,r),l(e,n,r),v(A,n,null),s(n,re),s(n,M),s(n,se),s(n,k),s(n,ne),s(n,f),v(y,f,null),s(f,oe),s(f,H),s(n,ae),s(n,h),v(T,h,null),s(h,ie),s(h,I),s(n,ce),s(n,m),v(w,m,null),s(m,le),s(m,q),l(e,Y,r),v(C,e,r),l(e,B,r),l(e,p,r),v(O,p,null),s(p,de),s(p,N),l(e,J,r),l(e,z,r),Q=!0},p:De,i(e){Q||(b(x.$$.fragment,e),b(S.$$.fragment,e),b(A.$$.fragment,e),b(y.$$.fragment,e),b(T.$$.fragment,e),b(w.$$.fragment,e),b(C.$$.fragment,e),b(O.$$.fragment,e),Q=!0)},o(e){$(x.$$.fragment,e),$(S.$$.fragment,e),$(A.$$.fragment,e),$(y.$$.fragment,e),$(T.$$.fragment,e),$(w.$$.fragment,e),$(C.$$.fragment,e),$(O.$$.fragment,e),Q=!1},d(e){e&&(t(G),t(V),t(R),t(j),t(E),t(K),t(W),t(n),t(Y),t(B),t(p),t(J),t(z)),t(u),D(x,e),D(S,e),D(A),D(y),D(T),D(w),D(C,e),D(O)}}}const Te='{"title":"EulerAncestralDiscreteScheduler","local":"eulerancestraldiscretescheduler","sections":[{"title":"EulerAncestralDiscreteScheduler","local":"diffusers.EulerAncestralDiscreteScheduler","sections":[],"depth":2},{"title":"EulerAncestralDiscreteSchedulerOutput","local":"diffusers.schedulers.scheduling_euler_ancestral_discrete.EulerAncestralDiscreteSchedulerOutput","sections":[],"depth":2}],"depth":1}';function we(pe){return xe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Fe extends Ee{constructor(u){super(),Se(this,u,we,ye,$e,{})}}export{Fe as component};
