import{s as ye,n as we,o as Ce}from"../chunks/scheduler.182ea377.js";import{S as Le,i as Oe,g as i,s as a,r as f,A as Pe,h as c,f as t,c as o,j as E,u as h,x as S,k as A,y as r,a as d,v as m,d as g,t as _,w as b}from"../chunks/index.abf12888.js";import{D as R}from"../chunks/Docstring.93f6f462.js";import{H as _e}from"../chunks/Heading.16916d63.js";function Me(be){let u,G,W,K,T,B,y,ve='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>.',J,w,Q,s,C,oe,H,$e="Ancestral sampling with Euler method steps.",ie,z,xe=`This model inherits from <a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a> and <a href="/docs/diffusers/main/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.`,ce,v,L,le,I,De=`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.`,de,$,O,ue,q,Ee="Sets the begin index for the scheduler. This function should be run from pipeline before the inference.",pe,x,P,fe,N,Se="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",he,D,M,me,V,Ae=`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).`,X,F,Y,p,k,ge,U,Te="Output class for the scheduler’s <code>step</code> function output.",Z,j,ee;return T=new _e({props:{title:"EulerAncestralDiscreteScheduler",local:"eulerancestraldiscretescheduler",headingTag:"h1"}}),w=new _e({props:{title:"EulerAncestralDiscreteScheduler",local:"diffusers.EulerAncestralDiscreteScheduler",headingTag:"h2"}}),C=new R({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:": Union = None"},{name:"prediction_type",val:": str = 'epsilon'"},{name:"timestep_spacing",val:": str = 'linspace'"},{name:"steps_offset",val:": int = 0"},{name:"rescale_betas_zero_snr",val:": bool = False"}],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, as required by some model families.`,name:"steps_offset"},{anchor:"diffusers.EulerAncestralDiscreteScheduler.rescale_betas_zero_snr",description:`<strong>rescale_betas_zero_snr</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Whether to rescale the betas to have zero terminal SNR. This enables the model to generate very bright and
dark samples instead of limiting it to samples with medium brightness. Loosely related to
<a href="https://github.com/huggingface/diffusers/blob/74fd735eb073eb1d774b1ab4154a0876eb82f055/examples/dreambooth/train_dreambooth.py#L506" rel="nofollow"><code>--offset_noise</code></a>.`,name:"rescale_betas_zero_snr"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py#L132"}}),L=new R({props:{name:"scale_model_input",anchor:"diffusers.EulerAncestralDiscreteScheduler.scale_model_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"timestep",val:": Union"}],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#L253",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>
`}}),O=new R({props:{name:"set_begin_index",anchor:"diffusers.EulerAncestralDiscreteScheduler.set_begin_index",parameters:[{name:"begin_index",val:": int = 0"}],parametersDescription:[{anchor:"diffusers.EulerAncestralDiscreteScheduler.set_begin_index.begin_index",description:`<strong>begin_index</strong> (<code>int</code>) &#x2014;
The begin index for the scheduler.`,name:"begin_index"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py#L243"}}),P=new R({props:{name:"set_timesteps",anchor:"diffusers.EulerAncestralDiscreteScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": Union = 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#L279"}}),M=new R({props:{name:"step",anchor:"diffusers.EulerAncestralDiscreteScheduler.step",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": Union"},{name:"sample",val:": FloatTensor"},{name:"generator",val:": Optional = 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#L347",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<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:`<script context="module">export const metadata = 'undefined';<\/script>


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