import{s as Oe,n as ke,o as Ie}from"../chunks/scheduler.8c3d61f6.js";import{S as He,i as ze,g as a,s as o,r as u,A as Ne,h as d,f as s,c as i,j as M,u as m,x as v,k as S,y as t,a as c,v as p,d as h,t as f,w as g}from"../chunks/index.da70eac4.js";import{D as j}from"../chunks/Docstring.6b390b9a.js";import{H as xe,E as Ve}from"../chunks/EditOnGithub.1e64e623.js";function qe($e){let _,F,R,J,T,Q,y,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,w,Y,r,C,le,N,Me="Implements the Euler scheduler in EDM formulation as presented in Karras et al. 2022 [1].",ce,V,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,q,Te=`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.`,me,b,L,pe,A,ye=`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,K,we="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,G,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,I,ee,E,H,be,B,Pe="Output class for the scheduler’s <code>step</code> function output.",te,z,se,W,re;return T=new xe({props:{title:"EDMEulerScheduler",local:"edmeulerscheduler",headingTag:"h1"}}),w=new xe({props:{title:"EDMEulerScheduler",local:"diffusers.EDMEulerScheduler",headingTag:"h2"}}),C=new j({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"},{name:"final_sigmas_type",val:": str = 'zero'"}],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"},{anchor:"diffusers.EDMEulerScheduler.final_sigmas_type",description:`<strong>final_sigmas_type</strong> (<code>str</code>, defaults to <code>&quot;zero&quot;</code>) &#x2014;
The final <code>sigma</code> value for the noise schedule during the sampling process. If <code>&quot;sigma_min&quot;</code>, the final
sigma is the same as the last sigma in the training schedule. If <code>zero</code>, the final sigma is set to 0.`,name:"final_sigmas_type"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_edm_euler.py#L49"}}),L=new j({props:{name:"scale_model_input",anchor:"diffusers.EDMEulerScheduler.scale_model_input",parameters:[{name:"sample",val:": Tensor"},{name:"timestep",val:": typing.Union[float, torch.Tensor]"}],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/main/src/diffusers/schedulers/scheduling_edm_euler.py#L189",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 j({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/main/src/diffusers/schedulers/scheduling_edm_euler.py#L151"}}),O=new j({props:{name:"set_timesteps",anchor:"diffusers.EDMEulerScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int = None"},{name:"device",val:": typing.Union[str, torch.device] = None"},{name:"sigmas",val:": typing.Union[torch.Tensor, typing.List[float], NoneType] = 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"},{anchor:"diffusers.EDMEulerScheduler.set_timesteps.sigmas",description:`<strong>sigmas</strong> (<code>Union[torch.Tensor, List[float]]</code>, <em>optional</em>) &#x2014;
Custom sigmas to use for the denoising process. If not defined, the default behavior when
<code>num_inference_steps</code> is passed will be used.`,name:"sigmas"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_edm_euler.py#L213"}}),k=new j({props:{name:"step",anchor:"diffusers.EDMEulerScheduler.step",parameters:[{name:"model_output",val:": Tensor"},{name:"timestep",val:": typing.Union[float, torch.Tensor]"},{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:": typing.Optional[torch._C.Generator] = 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/main/src/diffusers/schedulers/scheduling_edm_euler.py#L307",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 xe({props:{title:"EDMEulerSchedulerOutput",local:"diffusers.schedulers.scheduling_edm_euler.EDMEulerSchedulerOutput",headingTag:"h2"}}),H=new j({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:": typing.Optional[torch.Tensor] = 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/main/src/diffusers/schedulers/scheduling_edm_euler.py#L30"}}),z=new Ve({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(),y=a("p"),y.innerHTML=De,X=o(),u(w.$$.fragment),Y=o(),r=a("div"),u(C.$$.fragment),le=o(),N=a("p"),N.textContent=Me,ce=o(),V=a("p"),V.innerHTML=Se,ue=o(),q=a("p"),q.innerHTML=Te,me=o(),b=a("div"),u(L.$$.fragment),pe=o(),A=a("p"),A.innerHTML=ye,he=o(),x=a("div"),u(P.$$.fragment),fe=o(),K=a("p"),K.textContent=we,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(),G=a("p"),G.textContent=Le,Z=o(),u(I.$$.fragment),ee=o(),E=a("div"),u(H.$$.fragment),be=o(),B=a("p"),B.innerHTML=Pe,te=o(),u(z.$$.fragment),se=o(),W=a("p"),this.h()},l(e){const n=Ne("svelte-u9bgzb",document.head);_=d(n,"META",{name:!0,content:!0}),n.forEach(s),F=i(e),R=d(e,"P",{}),M(R).forEach(s),J=i(e),m(T.$$.fragment,e),Q=i(e),y=d(e,"P",{"data-svelte-h":!0}),v(y)!=="svelte-1lpsdat"&&(y.innerHTML=De),X=i(e),m(w.$$.fragment,e),Y=i(e),r=d(e,"DIV",{class:!0});var l=M(r);m(C.$$.fragment,l),le=i(l),N=d(l,"P",{"data-svelte-h":!0}),v(N)!=="svelte-1jyik6k"&&(N.textContent=Me),ce=i(l),V=d(l,"P",{"data-svelte-h":!0}),v(V)!=="svelte-72xw7v"&&(V.innerHTML=Se),ue=i(l),q=d(l,"P",{"data-svelte-h":!0}),v(q)!=="svelte-linuuh"&&(q.innerHTML=Te),me=i(l),b=d(l,"DIV",{class:!0});var ne=M(b);m(L.$$.fragment,ne),pe=i(ne),A=d(ne,"P",{"data-svelte-h":!0}),v(A)!=="svelte-1hew89w"&&(A.innerHTML=ye),ne.forEach(s),he=i(l),x=d(l,"DIV",{class:!0});var oe=M(x);m(P.$$.fragment,oe),fe=i(oe),K=d(oe,"P",{"data-svelte-h":!0}),v(K)!=="svelte-1k141rk"&&(K.textContent=we),oe.forEach(s),ge=i(l),$=d(l,"DIV",{class:!0});var ie=M($);m(O.$$.fragment,ie),_e=i(ie),U=d(ie,"P",{"data-svelte-h":!0}),v(U)!=="svelte-1vzm9q"&&(U.textContent=Ce),ie.forEach(s),Ee=i(l),D=d(l,"DIV",{class:!0});var ae=M(D);m(k.$$.fragment,ae),ve=i(ae),G=d(ae,"P",{"data-svelte-h":!0}),v(G)!=="svelte-hi84tp"&&(G.textContent=Le),ae.forEach(s),l.forEach(s),Z=i(e),m(I.$$.fragment,e),ee=i(e),E=d(e,"DIV",{class:!0});var de=M(E);m(H.$$.fragment,de),be=i(de),B=d(de,"P",{"data-svelte-h":!0}),v(B)!=="svelte-id9kic"&&(B.innerHTML=Pe),de.forEach(s),te=i(e),m(z.$$.fragment,e),se=i(e),W=d(e,"P",{}),M(W).forEach(s),this.h()},h(){S(_,"name","hf:doc:metadata"),S(_,"content",Ae),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(r,"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),p(T,e,n),c(e,Q,n),c(e,y,n),c(e,X,n),p(w,e,n),c(e,Y,n),c(e,r,n),p(C,r,null),t(r,le),t(r,N),t(r,ce),t(r,V),t(r,ue),t(r,q),t(r,me),t(r,b),p(L,b,null),t(b,pe),t(b,A),t(r,he),t(r,x),p(P,x,null),t(x,fe),t(x,K),t(r,ge),t(r,$),p(O,$,null),t($,_e),t($,U),t(r,Ee),t(r,D),p(k,D,null),t(D,ve),t(D,G),c(e,Z,n),p(I,e,n),c(e,ee,n),c(e,E,n),p(H,E,null),t(E,be),t(E,B),c(e,te,n),p(z,e,n),c(e,se,n),c(e,W,n),re=!0},p:ke,i(e){re||(h(T.$$.fragment,e),h(w.$$.fragment,e),h(C.$$.fragment,e),h(L.$$.fragment,e),h(P.$$.fragment,e),h(O.$$.fragment,e),h(k.$$.fragment,e),h(I.$$.fragment,e),h(H.$$.fragment,e),h(z.$$.fragment,e),re=!0)},o(e){f(T.$$.fragment,e),f(w.$$.fragment,e),f(C.$$.fragment,e),f(L.$$.fragment,e),f(P.$$.fragment,e),f(O.$$.fragment,e),f(k.$$.fragment,e),f(I.$$.fragment,e),f(H.$$.fragment,e),f(z.$$.fragment,e),re=!1},d(e){e&&(s(F),s(R),s(J),s(Q),s(y),s(X),s(Y),s(r),s(Z),s(ee),s(E),s(te),s(se),s(W)),s(_),g(T,e),g(w,e),g(C),g(L),g(P),g(O),g(k),g(I,e),g(H),g(z,e)}}}const Ae='{"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 Ke($e){return Ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Re extends He{constructor(_){super(),ze(this,_,Ke,qe,Oe,{})}}export{Re as component};
