import{s as Oe,n as ke,o as He}from"../chunks/scheduler.8c3d61f6.js";import{S as Ie,i as Ve,g as a,s as o,r as u,A as Ae,h as d,f as r,c as i,j as M,u as p,x as v,k as S,y as t,a as c,v as m,d as h,t as f,w as g}from"../chunks/index.da70eac4.js";import{D as q}from"../chunks/Docstring.6b390b9a.js";import{H as xe,E as Ke}from"../chunks/EditOnGithub.1e64e623.js";function ze($e){let _,F,R,J,T,Q,w,De='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,Me="Implements the Euler scheduler in EDM formulation as presented in Karras et al. 2022 [1].",ce,K,Se=`[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,Te=`This model inherits from <a href="/docs/diffusers/pr_7018/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a> and <a href="/docs/diffusers/pr_7018/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,we=`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,ye="Sets the begin index for the scheduler. This function should be run from pipeline before the inference.",ge,$,O,_e,U,Ce="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",Ee,D,k,ve,B,Le=`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,ee,E,I,be,j,Pe="Output class for the scheduler’s <code>step</code> function output.",te,V,re,W,se;return T=new xe({props:{title:"EDMEulerScheduler",local:"edmeulerscheduler",headingTag:"h1"}}),y=new xe({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_7018/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_7018/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_7018/src/diffusers/schedulers/scheduling_edm_euler.py#L138"}}),O=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_7018/src/diffusers/schedulers/scheduling_edm_euler.py#L200"}}),k=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_7018/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>
`}}),H=new xe({props:{title:"EDMEulerSchedulerOutput",local:"diffusers.schedulers.scheduling_edm_euler.EDMEulerSchedulerOutput",headingTag:"h2"}}),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_7018/src/diffusers/schedulers/scheduling_edm_euler.py#L30"}}),V=new Ke({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/schedulers/edm_euler.md"}}),{c(){_=a("meta"),F=o(),R=a("p"),J=o(),u(T.$$.fragment),Q=o(),w=a("p"),w.innerHTML=De,X=o(),u(y.$$.fragment),Y=o(),s=a("div"),u(C.$$.fragment),le=o(),A=a("p"),A.textContent=Me,ce=o(),K=a("p"),K.innerHTML=Se,ue=o(),z=a("p"),z.innerHTML=Te,pe=o(),b=a("div"),u(L.$$.fragment),me=o(),G=a("p"),G.innerHTML=we,he=o(),x=a("div"),u(P.$$.fragment),fe=o(),N=a("p"),N.textContent=ye,ge=o(),$=a("div"),u(O.$$.fragment),_e=o(),U=a("p"),U.textContent=Ce,Ee=o(),D=a("div"),u(k.$$.fragment),ve=o(),B=a("p"),B.textContent=Le,Z=o(),u(H.$$.fragment),ee=o(),E=a("div"),u(I.$$.fragment),be=o(),j=a("p"),j.innerHTML=Pe,te=o(),u(V.$$.fragment),re=o(),W=a("p"),this.h()},l(e){const n=Ae("svelte-u9bgzb",document.head);_=d(n,"META",{name:!0,content:!0}),n.forEach(r),F=i(e),R=d(e,"P",{}),M(R).forEach(r),J=i(e),p(T.$$.fragment,e),Q=i(e),w=d(e,"P",{"data-svelte-h":!0}),v(w)!=="svelte-1lpsdat"&&(w.innerHTML=De),X=i(e),p(y.$$.fragment,e),Y=i(e),s=d(e,"DIV",{class:!0});var l=M(s);p(C.$$.fragment,l),le=i(l),A=d(l,"P",{"data-svelte-h":!0}),v(A)!=="svelte-1jyik6k"&&(A.textContent=Me),ce=i(l),K=d(l,"P",{"data-svelte-h":!0}),v(K)!=="svelte-72xw7v"&&(K.innerHTML=Se),ue=i(l),z=d(l,"P",{"data-svelte-h":!0}),v(z)!=="svelte-160978p"&&(z.innerHTML=Te),pe=i(l),b=d(l,"DIV",{class:!0});var ne=M(b);p(L.$$.fragment,ne),me=i(ne),G=d(ne,"P",{"data-svelte-h":!0}),v(G)!=="svelte-1hew89w"&&(G.innerHTML=we),ne.forEach(r),he=i(l),x=d(l,"DIV",{class:!0});var oe=M(x);p(P.$$.fragment,oe),fe=i(oe),N=d(oe,"P",{"data-svelte-h":!0}),v(N)!=="svelte-1k141rk"&&(N.textContent=ye),oe.forEach(r),ge=i(l),$=d(l,"DIV",{class:!0});var ie=M($);p(O.$$.fragment,ie),_e=i(ie),U=d(ie,"P",{"data-svelte-h":!0}),v(U)!=="svelte-1vzm9q"&&(U.textContent=Ce),ie.forEach(r),Ee=i(l),D=d(l,"DIV",{class:!0});var ae=M(D);p(k.$$.fragment,ae),ve=i(ae),B=d(ae,"P",{"data-svelte-h":!0}),v(B)!=="svelte-hi84tp"&&(B.textContent=Le),ae.forEach(r),l.forEach(r),Z=i(e),p(H.$$.fragment,e),ee=i(e),E=d(e,"DIV",{class:!0});var de=M(E);p(I.$$.fragment,de),be=i(de),j=d(de,"P",{"data-svelte-h":!0}),v(j)!=="svelte-id9kic"&&(j.innerHTML=Pe),de.forEach(r),te=i(e),p(V.$$.fragment,e),re=i(e),W=d(e,"P",{}),M(W).forEach(r),this.h()},h(){S(_,"name","hf:doc:metadata"),S(_,"content",Ge),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(E,"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){t(document.head,_),c(e,F,n),c(e,R,n),c(e,J,n),m(T,e,n),c(e,Q,n),c(e,w,n),c(e,X,n),m(y,e,n),c(e,Y,n),c(e,s,n),m(C,s,null),t(s,le),t(s,A),t(s,ce),t(s,K),t(s,ue),t(s,z),t(s,pe),t(s,b),m(L,b,null),t(b,me),t(b,G),t(s,he),t(s,x),m(P,x,null),t(x,fe),t(x,N),t(s,ge),t(s,$),m(O,$,null),t($,_e),t($,U),t(s,Ee),t(s,D),m(k,D,null),t(D,ve),t(D,B),c(e,Z,n),m(H,e,n),c(e,ee,n),c(e,E,n),m(I,E,null),t(E,be),t(E,j),c(e,te,n),m(V,e,n),c(e,re,n),c(e,W,n),se=!0},p:ke,i(e){se||(h(T.$$.fragment,e),h(y.$$.fragment,e),h(C.$$.fragment,e),h(L.$$.fragment,e),h(P.$$.fragment,e),h(O.$$.fragment,e),h(k.$$.fragment,e),h(H.$$.fragment,e),h(I.$$.fragment,e),h(V.$$.fragment,e),se=!0)},o(e){f(T.$$.fragment,e),f(y.$$.fragment,e),f(C.$$.fragment,e),f(L.$$.fragment,e),f(P.$$.fragment,e),f(O.$$.fragment,e),f(k.$$.fragment,e),f(H.$$.fragment,e),f(I.$$.fragment,e),f(V.$$.fragment,e),se=!1},d(e){e&&(r(F),r(R),r(J),r(Q),r(w),r(X),r(Y),r(s),r(Z),r(ee),r(E),r(te),r(re),r(W)),r(_),g(T,e),g(y,e),g(C),g(L),g(P),g(O),g(k),g(H,e),g(I),g(V,e)}}}const Ge='{"title":"EDMEulerScheduler","local":"edmeulerscheduler","sections":[{"title":"EDMEulerScheduler","local":"diffusers.EDMEulerScheduler","sections":[],"depth":2},{"title":"EDMEulerSchedulerOutput","local":"diffusers.schedulers.scheduling_edm_euler.EDMEulerSchedulerOutput","sections":[],"depth":2}],"depth":1}';function Ne($e){return He(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Re extends Ie{constructor(_){super(),Ve(this,_,Ne,ze,Oe,{})}}export{Re as component};
