import{s as Ie,n as He,o as ze}from"../chunks/scheduler.53228c21.js";import{S as Ne,i as Ve,e as a,s as n,c as u,h as qe,a as d,d as t,b as o,f as M,g as m,j as v,k as S,l as s,m as c,n as p,t as h,o as f,p as g}from"../chunks/index.100fac89.js";import{C as Ke}from"../chunks/CopyLLMTxtMenu.0ee1b69b.js";import{D as R}from"../chunks/Docstring.db856a1e.js";import{H as De,E as Ue}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.136ef3fd.js";function Ae(Me){let _,J,W,Q,T,X,y,Y,w,Se='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>.',Z,C,ee,i,L,ue,V,Te="Implements the Euler scheduler in EDM formulation as presented in Karras et al. 2022 [1].",me,q,ye=`[1] Karras, Tero, et al. “Elucidating the Design Space of Diffusion-Based Generative Models.”
<a href="https://huggingface.co/papers/2206.00364" rel="nofollow">https://huggingface.co/papers/2206.00364</a>`,pe,K,we=`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.`,he,b,O,fe,U,Ce=`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.`,ge,x,P,_e,A,Le="Sets the begin index for the scheduler. This function should be run from pipeline before the inference.",Ee,$,k,ve,G,Oe="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",be,D,I,xe,B,Pe=`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).`,te,H,se,E,z,$e,j,ke="Output class for the scheduler’s <code>step</code> function output.",re,N,ne,F,oe;return T=new Ke({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),y=new De({props:{title:"EDMEulerScheduler",local:"edmeulerscheduler",headingTag:"h1"}}),C=new De({props:{title:"EDMEulerScheduler",local:"diffusers.EDMEulerScheduler",headingTag:"h2"}}),L=new R({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://huggingface.co/papers/2206.00364" rel="nofollow">https://huggingface.co/papers/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"}}),O=new R({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#L191",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 R({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#L153"}}),k=new R({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#L215"}}),I=new R({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"},{name:"pred_original_sample",val:": typing.Optional[torch.Tensor] = None"}],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#L310",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 De({props:{title:"EDMEulerSchedulerOutput",local:"diffusers.schedulers.scheduling_edm_euler.EDMEulerSchedulerOutput",headingTag:"h2"}}),z=new R({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#L32"}}),N=new Ue({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/schedulers/edm_euler.md"}}),{c(){_=a("meta"),J=n(),W=a("p"),Q=n(),u(T.$$.fragment),X=n(),u(y.$$.fragment),Y=n(),w=a("p"),w.innerHTML=Se,Z=n(),u(C.$$.fragment),ee=n(),i=a("div"),u(L.$$.fragment),ue=n(),V=a("p"),V.textContent=Te,me=n(),q=a("p"),q.innerHTML=ye,pe=n(),K=a("p"),K.innerHTML=we,he=n(),b=a("div"),u(O.$$.fragment),fe=n(),U=a("p"),U.innerHTML=Ce,ge=n(),x=a("div"),u(P.$$.fragment),_e=n(),A=a("p"),A.textContent=Le,Ee=n(),$=a("div"),u(k.$$.fragment),ve=n(),G=a("p"),G.textContent=Oe,be=n(),D=a("div"),u(I.$$.fragment),xe=n(),B=a("p"),B.textContent=Pe,te=n(),u(H.$$.fragment),se=n(),E=a("div"),u(z.$$.fragment),$e=n(),j=a("p"),j.innerHTML=ke,re=n(),u(N.$$.fragment),ne=n(),F=a("p"),this.h()},l(e){const r=qe("svelte-u9bgzb",document.head);_=d(r,"META",{name:!0,content:!0}),r.forEach(t),J=o(e),W=d(e,"P",{}),M(W).forEach(t),Q=o(e),m(T.$$.fragment,e),X=o(e),m(y.$$.fragment,e),Y=o(e),w=d(e,"P",{"data-svelte-h":!0}),v(w)!=="svelte-1lpsdat"&&(w.innerHTML=Se),Z=o(e),m(C.$$.fragment,e),ee=o(e),i=d(e,"DIV",{class:!0});var l=M(i);m(L.$$.fragment,l),ue=o(l),V=d(l,"P",{"data-svelte-h":!0}),v(V)!=="svelte-1jyik6k"&&(V.textContent=Te),me=o(l),q=d(l,"P",{"data-svelte-h":!0}),v(q)!=="svelte-bibwfr"&&(q.innerHTML=ye),pe=o(l),K=d(l,"P",{"data-svelte-h":!0}),v(K)!=="svelte-linuuh"&&(K.innerHTML=we),he=o(l),b=d(l,"DIV",{class:!0});var ie=M(b);m(O.$$.fragment,ie),fe=o(ie),U=d(ie,"P",{"data-svelte-h":!0}),v(U)!=="svelte-1hew89w"&&(U.innerHTML=Ce),ie.forEach(t),ge=o(l),x=d(l,"DIV",{class:!0});var ae=M(x);m(P.$$.fragment,ae),_e=o(ae),A=d(ae,"P",{"data-svelte-h":!0}),v(A)!=="svelte-1k141rk"&&(A.textContent=Le),ae.forEach(t),Ee=o(l),$=d(l,"DIV",{class:!0});var de=M($);m(k.$$.fragment,de),ve=o(de),G=d(de,"P",{"data-svelte-h":!0}),v(G)!=="svelte-1vzm9q"&&(G.textContent=Oe),de.forEach(t),be=o(l),D=d(l,"DIV",{class:!0});var le=M(D);m(I.$$.fragment,le),xe=o(le),B=d(le,"P",{"data-svelte-h":!0}),v(B)!=="svelte-hi84tp"&&(B.textContent=Pe),le.forEach(t),l.forEach(t),te=o(e),m(H.$$.fragment,e),se=o(e),E=d(e,"DIV",{class:!0});var ce=M(E);m(z.$$.fragment,ce),$e=o(ce),j=d(ce,"P",{"data-svelte-h":!0}),v(j)!=="svelte-id9kic"&&(j.innerHTML=ke),ce.forEach(t),re=o(e),m(N.$$.fragment,e),ne=o(e),F=d(e,"P",{}),M(F).forEach(t),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(i,"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,r){s(document.head,_),c(e,J,r),c(e,W,r),c(e,Q,r),p(T,e,r),c(e,X,r),p(y,e,r),c(e,Y,r),c(e,w,r),c(e,Z,r),p(C,e,r),c(e,ee,r),c(e,i,r),p(L,i,null),s(i,ue),s(i,V),s(i,me),s(i,q),s(i,pe),s(i,K),s(i,he),s(i,b),p(O,b,null),s(b,fe),s(b,U),s(i,ge),s(i,x),p(P,x,null),s(x,_e),s(x,A),s(i,Ee),s(i,$),p(k,$,null),s($,ve),s($,G),s(i,be),s(i,D),p(I,D,null),s(D,xe),s(D,B),c(e,te,r),p(H,e,r),c(e,se,r),c(e,E,r),p(z,E,null),s(E,$e),s(E,j),c(e,re,r),p(N,e,r),c(e,ne,r),c(e,F,r),oe=!0},p:He,i(e){oe||(h(T.$$.fragment,e),h(y.$$.fragment,e),h(C.$$.fragment,e),h(L.$$.fragment,e),h(O.$$.fragment,e),h(P.$$.fragment,e),h(k.$$.fragment,e),h(I.$$.fragment,e),h(H.$$.fragment,e),h(z.$$.fragment,e),h(N.$$.fragment,e),oe=!0)},o(e){f(T.$$.fragment,e),f(y.$$.fragment,e),f(C.$$.fragment,e),f(L.$$.fragment,e),f(O.$$.fragment,e),f(P.$$.fragment,e),f(k.$$.fragment,e),f(I.$$.fragment,e),f(H.$$.fragment,e),f(z.$$.fragment,e),f(N.$$.fragment,e),oe=!1},d(e){e&&(t(J),t(W),t(Q),t(X),t(Y),t(w),t(Z),t(ee),t(i),t(te),t(se),t(E),t(re),t(ne),t(F)),t(_),g(T,e),g(y,e),g(C,e),g(L),g(O),g(P),g(k),g(I),g(H,e),g(z),g(N,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 Be(Me){return ze(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Qe extends Ne{constructor(_){super(),Ve(this,_,Be,Ae,Ie,{})}}export{Qe as component};
