Buckets:
| import{s as Oe,n as qe,o as Le}from"../chunks/scheduler.8c3d61f6.js";import{S as Pe,i as Ie,g as a,s as n,r as u,A as Ne,h as d,f as t,c as o,j as E,u as p,x as S,k as y,y as s,a as l,v as m,d as f,t as h,w as g}from"../chunks/index.da70eac4.js";import{D as K}from"../chunks/Docstring.ee4b6913.js";import{H as ve,E as ke}from"../chunks/EditOnGithub.1e64e623.js";function Me(xe){let _,j,R,B,T,J,w,$e='The Euler scheduler (Algorithm 2) is 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>.',Q,C,X,i,O,de,z,De="Euler scheduler.",ce,H,Ee=`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.`,le,v,q,ue,A,Se=`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.`,pe,x,L,me,V,ye="Sets the begin index for the scheduler. This function should be run from pipeline before the inference.",fe,$,P,he,F,Te="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",ge,D,I,_e,U,we=`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).`,Y,N,Z,b,k,be,G,Ce="Output class for the scheduler’s <code>step</code> function output.",ee,M,te,W,se;return T=new ve({props:{title:"EulerDiscreteScheduler",local:"eulerdiscretescheduler",headingTag:"h1"}}),C=new ve({props:{title:"EulerDiscreteScheduler",local:"diffusers.EulerDiscreteScheduler",headingTag:"h2"}}),O=new K({props:{name:"class diffusers.EulerDiscreteScheduler",anchor:"diffusers.EulerDiscreteScheduler",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:"interpolation_type",val:": str = 'linear'"},{name:"use_karras_sigmas",val:": Optional = False"},{name:"sigma_min",val:": Optional = None"},{name:"sigma_max",val:": Optional = None"},{name:"timestep_spacing",val:": str = 'linspace'"},{name:"timestep_type",val:": str = 'discrete'"},{name:"steps_offset",val:": int = 0"},{name:"rescale_betas_zero_snr",val:": bool = False"},{name:"final_sigmas_type",val:": str = 'zero'"}],parametersDescription:[{anchor:"diffusers.EulerDiscreteScheduler.num_train_timesteps",description:`<strong>num_train_timesteps</strong> (<code>int</code>, defaults to 1000) — | |
| The number of diffusion steps to train the model.`,name:"num_train_timesteps"},{anchor:"diffusers.EulerDiscreteScheduler.beta_start",description:`<strong>beta_start</strong> (<code>float</code>, defaults to 0.0001) — | |
| The starting <code>beta</code> value of inference.`,name:"beta_start"},{anchor:"diffusers.EulerDiscreteScheduler.beta_end",description:`<strong>beta_end</strong> (<code>float</code>, defaults to 0.02) — | |
| The final <code>beta</code> value.`,name:"beta_end"},{anchor:"diffusers.EulerDiscreteScheduler.beta_schedule",description:`<strong>beta_schedule</strong> (<code>str</code>, defaults to <code>"linear"</code>) — | |
| 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.EulerDiscreteScheduler.trained_betas",description:`<strong>trained_betas</strong> (<code>np.ndarray</code>, <em>optional</em>) — | |
| 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.EulerDiscreteScheduler.prediction_type",description:`<strong>prediction_type</strong> (<code>str</code>, defaults to <code>epsilon</code>, <em>optional</em>) — | |
| 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.EulerDiscreteScheduler.interpolation_type(str,",description:`<strong>interpolation_type(<code>str</code>,</strong> defaults to <code>"linear"</code>, <em>optional</em>) — | |
| The interpolation type to compute intermediate sigmas for the scheduler denoising steps. Should be on of | |
| <code>"linear"</code> or <code>"log_linear"</code>.`,name:"interpolation_type(str,"},{anchor:"diffusers.EulerDiscreteScheduler.use_karras_sigmas",description:`<strong>use_karras_sigmas</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to use Karras sigmas for step sizes in the noise schedule during the sampling process. If <code>True</code>, | |
| the sigmas are determined according to a sequence of noise levels {σi}.`,name:"use_karras_sigmas"},{anchor:"diffusers.EulerDiscreteScheduler.timestep_spacing",description:`<strong>timestep_spacing</strong> (<code>str</code>, defaults to <code>"linspace"</code>) — | |
| 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.EulerDiscreteScheduler.steps_offset",description:`<strong>steps_offset</strong> (<code>int</code>, defaults to 0) — | |
| An offset added to the inference steps, as required by some model families.`,name:"steps_offset"},{anchor:"diffusers.EulerDiscreteScheduler.rescale_betas_zero_snr",description:`<strong>rescale_betas_zero_snr</strong> (<code>bool</code>, defaults to <code>False</code>) — | |
| 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"},{anchor:"diffusers.EulerDiscreteScheduler.final_sigmas_type",description:`<strong>final_sigmas_type</strong> (<code>str</code>, defaults to <code>"zero"</code>) — | |
| The final <code>sigma</code> value for the noise schedule during the sampling process. If <code>"sigma_min"</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_euler_discrete.py#L132"}}),q=new K({props:{name:"scale_model_input",anchor:"diffusers.EulerDiscreteScheduler.scale_model_input",parameters:[{name:"sample",val:": Tensor"},{name:"timestep",val:": Union"}],parametersDescription:[{anchor:"diffusers.EulerDiscreteScheduler.scale_model_input.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) — | |
| The input sample.`,name:"sample"},{anchor:"diffusers.EulerDiscreteScheduler.scale_model_input.timestep",description:`<strong>timestep</strong> (<code>int</code>, <em>optional</em>) — | |
| The current timestep in the diffusion chain.`,name:"timestep"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_euler_discrete.py#L277",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> | |
| `}}),L=new K({props:{name:"set_begin_index",anchor:"diffusers.EulerDiscreteScheduler.set_begin_index",parameters:[{name:"begin_index",val:": int = 0"}],parametersDescription:[{anchor:"diffusers.EulerDiscreteScheduler.set_begin_index.begin_index",description:`<strong>begin_index</strong> (<code>int</code>) — | |
| The begin index for the scheduler.`,name:"begin_index"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_euler_discrete.py#L267"}}),P=new K({props:{name:"set_timesteps",anchor:"diffusers.EulerDiscreteScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int = None"},{name:"device",val:": Union = None"},{name:"timesteps",val:": Optional = None"},{name:"sigmas",val:": Optional = None"}],parametersDescription:[{anchor:"diffusers.EulerDiscreteScheduler.set_timesteps.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>) — | |
| The number of diffusion steps used when generating samples with a pre-trained model.`,name:"num_inference_steps"},{anchor:"diffusers.EulerDiscreteScheduler.set_timesteps.device",description:`<strong>device</strong> (<code>str</code> or <code>torch.device</code>, <em>optional</em>) — | |
| The device to which the timesteps should be moved to. If <code>None</code>, the timesteps are not moved.`,name:"device"},{anchor:"diffusers.EulerDiscreteScheduler.set_timesteps.timesteps",description:`<strong>timesteps</strong> (<code>List[int]</code>, <em>optional</em>) — | |
| Custom timesteps used to support arbitrary timesteps schedule. If <code>None</code>, timesteps will be generated | |
| based on the <code>timestep_spacing</code> attribute. If <code>timesteps</code> is passed, <code>num_inference_steps</code> and <code>sigmas</code> | |
| must be <code>None</code>, and <code>timestep_spacing</code> attribute will be ignored.`,name:"timesteps"},{anchor:"diffusers.EulerDiscreteScheduler.set_timesteps.sigmas",description:`<strong>sigmas</strong> (<code>List[float]</code>, <em>optional</em>) — | |
| Custom sigmas used to support arbitrary timesteps schedule schedule. If <code>None</code>, timesteps and sigmas | |
| will be generated based on the relevant scheduler attributes. If <code>sigmas</code> is passed, | |
| <code>num_inference_steps</code> and <code>timesteps</code> must be <code>None</code>, and the timesteps will be generated based on the | |
| custom sigmas schedule.`,name:"sigmas"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_euler_discrete.py#L301"}}),I=new K({props:{name:"step",anchor:"diffusers.EulerDiscreteScheduler.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.EulerDiscreteScheduler.step.model_output",description:`<strong>model_output</strong> (<code>torch.Tensor</code>) — | |
| The direct output from learned diffusion model.`,name:"model_output"},{anchor:"diffusers.EulerDiscreteScheduler.step.timestep",description:`<strong>timestep</strong> (<code>float</code>) — | |
| The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.EulerDiscreteScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) — | |
| A current instance of a sample created by the diffusion process.`,name:"sample"},{anchor:"diffusers.EulerDiscreteScheduler.step.s_churn",description:"<strong>s_churn</strong> (<code>float</code>) —",name:"s_churn"},{anchor:"diffusers.EulerDiscreteScheduler.step.s_tmin",description:"<strong>s_tmin</strong> (<code>float</code>) —",name:"s_tmin"},{anchor:"diffusers.EulerDiscreteScheduler.step.s_tmax",description:"<strong>s_tmax</strong> (<code>float</code>) —",name:"s_tmax"},{anchor:"diffusers.EulerDiscreteScheduler.step.s_noise",description:`<strong>s_noise</strong> (<code>float</code>, defaults to 1.0) — | |
| Scaling factor for noise added to the sample.`,name:"s_noise"},{anchor:"diffusers.EulerDiscreteScheduler.step.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) — | |
| A random number generator.`,name:"generator"},{anchor:"diffusers.EulerDiscreteScheduler.step.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>) — | |
| Whether or not to return a <a href="/docs/diffusers/main/en/api/schedulers/euler#diffusers.schedulers.scheduling_euler_discrete.EulerDiscreteSchedulerOutput">EulerDiscreteSchedulerOutput</a> or | |
| tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_euler_discrete.py#L493",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#diffusers.schedulers.scheduling_euler_discrete.EulerDiscreteSchedulerOutput" | |
| >EulerDiscreteSchedulerOutput</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#diffusers.schedulers.scheduling_euler_discrete.EulerDiscreteSchedulerOutput" | |
| >EulerDiscreteSchedulerOutput</a> or <code>tuple</code></p> | |
| `}}),N=new ve({props:{title:"EulerDiscreteSchedulerOutput",local:"diffusers.schedulers.scheduling_euler_discrete.EulerDiscreteSchedulerOutput",headingTag:"h2"}}),k=new K({props:{name:"class diffusers.schedulers.scheduling_euler_discrete.EulerDiscreteSchedulerOutput",anchor:"diffusers.schedulers.scheduling_euler_discrete.EulerDiscreteSchedulerOutput",parameters:[{name:"prev_sample",val:": Tensor"},{name:"pred_original_sample",val:": Optional = None"}],parametersDescription:[{anchor:"diffusers.schedulers.scheduling_euler_discrete.EulerDiscreteSchedulerOutput.prev_sample",description:`<strong>prev_sample</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code> for images) — | |
| 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_discrete.EulerDiscreteSchedulerOutput.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) — | |
| 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_discrete.py#L31"}}),M=new ke({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/schedulers/euler.md"}}),{c(){_=a("meta"),j=n(),R=a("p"),B=n(),u(T.$$.fragment),J=n(),w=a("p"),w.innerHTML=$e,Q=n(),u(C.$$.fragment),X=n(),i=a("div"),u(O.$$.fragment),de=n(),z=a("p"),z.textContent=De,ce=n(),H=a("p"),H.innerHTML=Ee,le=n(),v=a("div"),u(q.$$.fragment),ue=n(),A=a("p"),A.innerHTML=Se,pe=n(),x=a("div"),u(L.$$.fragment),me=n(),V=a("p"),V.textContent=ye,fe=n(),$=a("div"),u(P.$$.fragment),he=n(),F=a("p"),F.textContent=Te,ge=n(),D=a("div"),u(I.$$.fragment),_e=n(),U=a("p"),U.textContent=we,Y=n(),u(N.$$.fragment),Z=n(),b=a("div"),u(k.$$.fragment),be=n(),G=a("p"),G.innerHTML=Ce,ee=n(),u(M.$$.fragment),te=n(),W=a("p"),this.h()},l(e){const r=Ne("svelte-u9bgzb",document.head);_=d(r,"META",{name:!0,content:!0}),r.forEach(t),j=o(e),R=d(e,"P",{}),E(R).forEach(t),B=o(e),p(T.$$.fragment,e),J=o(e),w=d(e,"P",{"data-svelte-h":!0}),S(w)!=="svelte-1gv4s4b"&&(w.innerHTML=$e),Q=o(e),p(C.$$.fragment,e),X=o(e),i=d(e,"DIV",{class:!0});var c=E(i);p(O.$$.fragment,c),de=o(c),z=d(c,"P",{"data-svelte-h":!0}),S(z)!=="svelte-rqsn3u"&&(z.textContent=De),ce=o(c),H=d(c,"P",{"data-svelte-h":!0}),S(H)!=="svelte-linuuh"&&(H.innerHTML=Ee),le=o(c),v=d(c,"DIV",{class:!0});var re=E(v);p(q.$$.fragment,re),ue=o(re),A=d(re,"P",{"data-svelte-h":!0}),S(A)!=="svelte-1hew89w"&&(A.innerHTML=Se),re.forEach(t),pe=o(c),x=d(c,"DIV",{class:!0});var ne=E(x);p(L.$$.fragment,ne),me=o(ne),V=d(ne,"P",{"data-svelte-h":!0}),S(V)!=="svelte-1k141rk"&&(V.textContent=ye),ne.forEach(t),fe=o(c),$=d(c,"DIV",{class:!0});var oe=E($);p(P.$$.fragment,oe),he=o(oe),F=d(oe,"P",{"data-svelte-h":!0}),S(F)!=="svelte-1vzm9q"&&(F.textContent=Te),oe.forEach(t),ge=o(c),D=d(c,"DIV",{class:!0});var ie=E(D);p(I.$$.fragment,ie),_e=o(ie),U=d(ie,"P",{"data-svelte-h":!0}),S(U)!=="svelte-hi84tp"&&(U.textContent=we),ie.forEach(t),c.forEach(t),Y=o(e),p(N.$$.fragment,e),Z=o(e),b=d(e,"DIV",{class:!0});var ae=E(b);p(k.$$.fragment,ae),be=o(ae),G=d(ae,"P",{"data-svelte-h":!0}),S(G)!=="svelte-id9kic"&&(G.innerHTML=Ce),ae.forEach(t),ee=o(e),p(M.$$.fragment,e),te=o(e),W=d(e,"P",{}),E(W).forEach(t),this.h()},h(){y(_,"name","hf:doc:metadata"),y(_,"content",ze),y(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(i,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),y(b,"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,_),l(e,j,r),l(e,R,r),l(e,B,r),m(T,e,r),l(e,J,r),l(e,w,r),l(e,Q,r),m(C,e,r),l(e,X,r),l(e,i,r),m(O,i,null),s(i,de),s(i,z),s(i,ce),s(i,H),s(i,le),s(i,v),m(q,v,null),s(v,ue),s(v,A),s(i,pe),s(i,x),m(L,x,null),s(x,me),s(x,V),s(i,fe),s(i,$),m(P,$,null),s($,he),s($,F),s(i,ge),s(i,D),m(I,D,null),s(D,_e),s(D,U),l(e,Y,r),m(N,e,r),l(e,Z,r),l(e,b,r),m(k,b,null),s(b,be),s(b,G),l(e,ee,r),m(M,e,r),l(e,te,r),l(e,W,r),se=!0},p:qe,i(e){se||(f(T.$$.fragment,e),f(C.$$.fragment,e),f(O.$$.fragment,e),f(q.$$.fragment,e),f(L.$$.fragment,e),f(P.$$.fragment,e),f(I.$$.fragment,e),f(N.$$.fragment,e),f(k.$$.fragment,e),f(M.$$.fragment,e),se=!0)},o(e){h(T.$$.fragment,e),h(C.$$.fragment,e),h(O.$$.fragment,e),h(q.$$.fragment,e),h(L.$$.fragment,e),h(P.$$.fragment,e),h(I.$$.fragment,e),h(N.$$.fragment,e),h(k.$$.fragment,e),h(M.$$.fragment,e),se=!1},d(e){e&&(t(j),t(R),t(B),t(J),t(w),t(Q),t(X),t(i),t(Y),t(Z),t(b),t(ee),t(te),t(W)),t(_),g(T,e),g(C,e),g(O),g(q),g(L),g(P),g(I),g(N,e),g(k),g(M,e)}}}const ze='{"title":"EulerDiscreteScheduler","local":"eulerdiscretescheduler","sections":[{"title":"EulerDiscreteScheduler","local":"diffusers.EulerDiscreteScheduler","sections":[],"depth":2},{"title":"EulerDiscreteSchedulerOutput","local":"diffusers.schedulers.scheduling_euler_discrete.EulerDiscreteSchedulerOutput","sections":[],"depth":2}],"depth":1}';function He(xe){return Le(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ge extends Pe{constructor(_){super(),Ie(this,_,He,Me,Oe,{})}}export{Ge as component}; | |
Xet Storage Details
- Size:
- 20.1 kB
- Xet hash:
- 82dd2c9fea8787b8f86369583cc98a62a677db69fa367f5bd255e72224db7eae
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.