import{s as Oe,n as He,o as Ie}from"../chunks/scheduler.8c3d61f6.js";import{S as Ve,i as Ae,g as a,s as o,r as h,A as Ke,h as d,f as t,c as i,j as M,u as f,x as u,k as S,y as r,a as c,v as g,d as _,t as v,w as E}from"../chunks/index.589a98e8.js";import{D as q}from"../chunks/Docstring.27406313.js";import{H as ke,E as ze}from"../chunks/EditOnGithub.e5a8d9cb.js";function Ge(xe){let p,F,R,J,T,Q,w,$e='The Karras formulation of the Euler scheduler (Algorithm 2) from the <a href="https://huggingface.co/papers/2206.00364" rel="nofollow">Elucidating the Design Space of Diffusion-Based Generative Models</a> paper by Karras et al. 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#L51" rel="nofollow">k-diffusion</a> implementation by <a href="https://github.com/crowsonkb/" rel="nofollow">Katherine Crowson</a>.',X,y,Y,s,C,le,A,De="Implements the Euler scheduler in EDM formulation as presented in Karras et al. 2022 [1].",ce,K,Me=`[1] Karras, Tero, et al. “Elucidating the Design Space of Diffusion-Based Generative Models.”
<a href="https://arxiv.org/abs/2206.00364" rel="nofollow">https://arxiv.org/abs/2206.00364</a>`,ue,z,Se=`This model inherits from <a href="/docs/diffusers/pr_8423/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a> and <a href="/docs/diffusers/pr_8423/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.`,pe,b,L,me,G,Te=`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.`,he,x,P,fe,N,we="Sets the begin index for the scheduler. This function should be run from pipeline before the inference.",ge,$,k,_e,U,ye="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",ve,D,O,Ee,B,Ce=`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).`,Z,H,Le="## EDMEulerSchedulerOutput[[diffusers.schedulers.scheduling_edm_euler.EDMEulerSchedulerOutput]]",ee,m,I,be,j,Pe="Output class for the scheduler’s <code>step</code> function output.",te,V,re,W,se;return T=new ke({props:{title:"EDMEulerScheduler",local:"edmeulerscheduler",headingTag:"h1"}}),y=new ke({props:{title:"EDMEulerScheduler",local:"diffusers.EDMEulerScheduler",headingTag:"h2"}}),C=new q({props:{name:"class diffusers.EDMEulerScheduler",anchor:"diffusers.EDMEulerScheduler",parameters:[{name:"sigma_min",val:": float = 0.002"},{name:"sigma_max",val:": float = 80.0"},{name:"sigma_data",val:": float = 0.5"},{name:"sigma_schedule",val:": str = 'karras'"},{name:"num_train_timesteps",val:": int = 1000"},{name:"prediction_type",val:": str = 'epsilon'"},{name:"rho",val:": float = 7.0"}],parametersDescription:[{anchor:"diffusers.EDMEulerScheduler.sigma_min",description:`<strong>sigma_min</strong> (<code>float</code>, <em>optional</em>, defaults to 0.002) &#x2014;
Minimum noise magnitude in the sigma schedule. This was set to 0.002 in the EDM paper [1]; a reasonable
range is [0, 10].`,name:"sigma_min"},{anchor:"diffusers.EDMEulerScheduler.sigma_max",description:`<strong>sigma_max</strong> (<code>float</code>, <em>optional</em>, defaults to 80.0) &#x2014;
Maximum noise magnitude in the sigma schedule. This was set to 80.0 in the EDM paper [1]; a reasonable
range is [0.2, 80.0].`,name:"sigma_max"},{anchor:"diffusers.EDMEulerScheduler.sigma_data",description:`<strong>sigma_data</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
The standard deviation of the data distribution. This is set to 0.5 in the EDM paper [1].`,name:"sigma_data"},{anchor:"diffusers.EDMEulerScheduler.sigma_schedule",description:`<strong>sigma_schedule</strong> (<code>str</code>, <em>optional</em>, defaults to <code>karras</code>) &#x2014;
Sigma schedule to compute the <code>sigmas</code>. By default, we the schedule introduced in the EDM paper
(<a href="https://arxiv.org/abs/2206.00364" rel="nofollow">https://arxiv.org/abs/2206.00364</a>). Other acceptable value is &#x201C;exponential&#x201D;. The exponential schedule was
incorporated in this model: <a href="https://huggingface.co/stabilityai/cosxl" rel="nofollow">https://huggingface.co/stabilityai/cosxl</a>.`,name:"sigma_schedule"},{anchor:"diffusers.EDMEulerScheduler.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.EDMEulerScheduler.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.EDMEulerScheduler.rho",description:`<strong>rho</strong> (<code>float</code>, <em>optional</em>, defaults to 7.0) &#x2014;
The rho parameter used for calculating the Karras sigma schedule, which is set to 7.0 in the EDM paper [1].`,name:"rho"}],source:"https://github.com/huggingface/diffusers/blob/vr_8423/src/diffusers/schedulers/scheduling_edm_euler.py#L49"}}),L=new q({props:{name:"scale_model_input",anchor:"diffusers.EDMEulerScheduler.scale_model_input",parameters:[{name:"sample",val:": Tensor"},{name:"timestep",val:": Union"}],parametersDescription:[{anchor:"diffusers.EDMEulerScheduler.scale_model_input.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
The input sample.`,name:"sample"},{anchor:"diffusers.EDMEulerScheduler.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/vr_8423/src/diffusers/schedulers/scheduling_edm_euler.py#L176",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.Tensor</code></p>
`}}),P=new q({props:{name:"set_begin_index",anchor:"diffusers.EDMEulerScheduler.set_begin_index",parameters:[{name:"begin_index",val:": int = 0"}],parametersDescription:[{anchor:"diffusers.EDMEulerScheduler.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/vr_8423/src/diffusers/schedulers/scheduling_edm_euler.py#L138"}}),k=new q({props:{name:"set_timesteps",anchor:"diffusers.EDMEulerScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": Union = None"}],parametersDescription:[{anchor:"diffusers.EDMEulerScheduler.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.EDMEulerScheduler.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/vr_8423/src/diffusers/schedulers/scheduling_edm_euler.py#L200"}}),O=new q({props:{name:"step",anchor:"diffusers.EDMEulerScheduler.step",parameters:[{name:"model_output",val:": Tensor"},{name:"timestep",val:": Union"},{name:"sample",val:": Tensor"},{name:"s_churn",val:": float = 0.0"},{name:"s_tmin",val:": float = 0.0"},{name:"s_tmax",val:": float = inf"},{name:"s_noise",val:": float = 1.0"},{name:"generator",val:": Optional = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.EDMEulerScheduler.step.model_output",description:`<strong>model_output</strong> (<code>torch.Tensor</code>) &#x2014;
The direct output from learned diffusion model.`,name:"model_output"},{anchor:"diffusers.EDMEulerScheduler.step.timestep",description:`<strong>timestep</strong> (<code>float</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.EDMEulerScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
A current instance of a sample created by the diffusion process.`,name:"sample"},{anchor:"diffusers.EDMEulerScheduler.step.s_churn",description:"<strong>s_churn</strong> (<code>float</code>) &#x2014;",name:"s_churn"},{anchor:"diffusers.EDMEulerScheduler.step.s_tmin",description:"<strong>s_tmin</strong>  (<code>float</code>) &#x2014;",name:"s_tmin"},{anchor:"diffusers.EDMEulerScheduler.step.s_tmax",description:"<strong>s_tmax</strong>  (<code>float</code>) &#x2014;",name:"s_tmax"},{anchor:"diffusers.EDMEulerScheduler.step.s_noise",description:`<strong>s_noise</strong> (<code>float</code>, defaults to 1.0) &#x2014;
Scaling factor for noise added to the sample.`,name:"s_noise"},{anchor:"diffusers.EDMEulerScheduler.step.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
A random number generator.`,name:"generator"},{anchor:"diffusers.EDMEulerScheduler.step.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>) &#x2014;
Whether or not to return a <code>~schedulers.scheduling_euler_discrete.EDMEulerSchedulerOutput</code> or tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_8423/src/diffusers/schedulers/scheduling_edm_euler.py#L272",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If return_dict is <code>True</code>, <code>~schedulers.scheduling_euler_discrete.EDMEulerSchedulerOutput</code> 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><code>~schedulers.scheduling_euler_discrete.EDMEulerSchedulerOutput</code> or <code>tuple</code></p>
`}}),I=new q({props:{name:"class diffusers.schedulers.scheduling_edm_euler.EDMEulerSchedulerOutput",anchor:"diffusers.schedulers.scheduling_edm_euler.EDMEulerSchedulerOutput",parameters:[{name:"prev_sample",val:": Tensor"},{name:"pred_original_sample",val:": Optional = None"}],parametersDescription:[{anchor:"diffusers.schedulers.scheduling_edm_euler.EDMEulerSchedulerOutput.prev_sample",description:`<strong>prev_sample</strong> (<code>torch.Tensor</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_edm_euler.EDMEulerSchedulerOutput.pred_original_sample",description:`<strong>pred_original_sample</strong> (<code>torch.Tensor</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/vr_8423/src/diffusers/schedulers/scheduling_edm_euler.py#L30"}}),V=new ze({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/schedulers/edm_euler.md"}}),{c(){p=a("meta"),F=o(),R=a("p"),J=o(),h(T.$$.fragment),Q=o(),w=a("p"),w.innerHTML=$e,X=o(),h(y.$$.fragment),Y=o(),s=a("div"),h(C.$$.fragment),le=o(),A=a("p"),A.textContent=De,ce=o(),K=a("p"),K.innerHTML=Me,ue=o(),z=a("p"),z.innerHTML=Se,pe=o(),b=a("div"),h(L.$$.fragment),me=o(),G=a("p"),G.innerHTML=Te,he=o(),x=a("div"),h(P.$$.fragment),fe=o(),N=a("p"),N.textContent=we,ge=o(),$=a("div"),h(k.$$.fragment),_e=o(),U=a("p"),U.textContent=ye,ve=o(),D=a("div"),h(O.$$.fragment),Ee=o(),B=a("p"),B.textContent=Ce,Z=o(),H=a("p"),H.textContent=Le,ee=o(),m=a("div"),h(I.$$.fragment),be=o(),j=a("p"),j.innerHTML=Pe,te=o(),h(V.$$.fragment),re=o(),W=a("p"),this.h()},l(e){const n=Ke("svelte-u9bgzb",document.head);p=d(n,"META",{name:!0,content:!0}),n.forEach(t),F=i(e),R=d(e,"P",{}),M(R).forEach(t),J=i(e),f(T.$$.fragment,e),Q=i(e),w=d(e,"P",{"data-svelte-h":!0}),u(w)!=="svelte-1lpsdat"&&(w.innerHTML=$e),X=i(e),f(y.$$.fragment,e),Y=i(e),s=d(e,"DIV",{class:!0});var l=M(s);f(C.$$.fragment,l),le=i(l),A=d(l,"P",{"data-svelte-h":!0}),u(A)!=="svelte-1jyik6k"&&(A.textContent=De),ce=i(l),K=d(l,"P",{"data-svelte-h":!0}),u(K)!=="svelte-72xw7v"&&(K.innerHTML=Me),ue=i(l),z=d(l,"P",{"data-svelte-h":!0}),u(z)!=="svelte-vrvlx1"&&(z.innerHTML=Se),pe=i(l),b=d(l,"DIV",{class:!0});var ne=M(b);f(L.$$.fragment,ne),me=i(ne),G=d(ne,"P",{"data-svelte-h":!0}),u(G)!=="svelte-1hew89w"&&(G.innerHTML=Te),ne.forEach(t),he=i(l),x=d(l,"DIV",{class:!0});var oe=M(x);f(P.$$.fragment,oe),fe=i(oe),N=d(oe,"P",{"data-svelte-h":!0}),u(N)!=="svelte-1k141rk"&&(N.textContent=we),oe.forEach(t),ge=i(l),$=d(l,"DIV",{class:!0});var ie=M($);f(k.$$.fragment,ie),_e=i(ie),U=d(ie,"P",{"data-svelte-h":!0}),u(U)!=="svelte-1vzm9q"&&(U.textContent=ye),ie.forEach(t),ve=i(l),D=d(l,"DIV",{class:!0});var ae=M(D);f(O.$$.fragment,ae),Ee=i(ae),B=d(ae,"P",{"data-svelte-h":!0}),u(B)!=="svelte-hi84tp"&&(B.textContent=Ce),ae.forEach(t),l.forEach(t),Z=i(e),H=d(e,"P",{"data-svelte-h":!0}),u(H)!=="svelte-3vt8ba"&&(H.textContent=Le),ee=i(e),m=d(e,"DIV",{class:!0});var de=M(m);f(I.$$.fragment,de),be=i(de),j=d(de,"P",{"data-svelte-h":!0}),u(j)!=="svelte-id9kic"&&(j.innerHTML=Pe),de.forEach(t),te=i(e),f(V.$$.fragment,e),re=i(e),W=d(e,"P",{}),M(W).forEach(t),this.h()},h(){S(p,"name","hf:doc:metadata"),S(p,"content",Ne),S(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(s,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(m,"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,p),c(e,F,n),c(e,R,n),c(e,J,n),g(T,e,n),c(e,Q,n),c(e,w,n),c(e,X,n),g(y,e,n),c(e,Y,n),c(e,s,n),g(C,s,null),r(s,le),r(s,A),r(s,ce),r(s,K),r(s,ue),r(s,z),r(s,pe),r(s,b),g(L,b,null),r(b,me),r(b,G),r(s,he),r(s,x),g(P,x,null),r(x,fe),r(x,N),r(s,ge),r(s,$),g(k,$,null),r($,_e),r($,U),r(s,ve),r(s,D),g(O,D,null),r(D,Ee),r(D,B),c(e,Z,n),c(e,H,n),c(e,ee,n),c(e,m,n),g(I,m,null),r(m,be),r(m,j),c(e,te,n),g(V,e,n),c(e,re,n),c(e,W,n),se=!0},p:He,i(e){se||(_(T.$$.fragment,e),_(y.$$.fragment,e),_(C.$$.fragment,e),_(L.$$.fragment,e),_(P.$$.fragment,e),_(k.$$.fragment,e),_(O.$$.fragment,e),_(I.$$.fragment,e),_(V.$$.fragment,e),se=!0)},o(e){v(T.$$.fragment,e),v(y.$$.fragment,e),v(C.$$.fragment,e),v(L.$$.fragment,e),v(P.$$.fragment,e),v(k.$$.fragment,e),v(O.$$.fragment,e),v(I.$$.fragment,e),v(V.$$.fragment,e),se=!1},d(e){e&&(t(F),t(R),t(J),t(Q),t(w),t(X),t(Y),t(s),t(Z),t(H),t(ee),t(m),t(te),t(re),t(W)),t(p),E(T,e),E(y,e),E(C),E(L),E(P),E(k),E(O),E(I),E(V,e)}}}const Ne='{"title":"EDMEulerScheduler","local":"edmeulerscheduler","sections":[{"title":"EDMEulerScheduler","local":"diffusers.EDMEulerScheduler","sections":[],"depth":2}],"depth":1}';function Ue(xe){return Ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class We extends Ve{constructor(p){super(),Ae(this,p,Ue,Ge,Oe,{})}}export{We as component};
