import{S as _r,i as vr,s as Sr,e as r,k as l,w as m,t as n,M as Er,c as o,d as s,m as c,a as i,x as g,h as a,b as d,G as e,g as u,y as _,L as Dr,q as v,o as S,B as E,v as br}from"../../../chunks/vendor-hf-doc-builder.js";import{D as O}from"../../../chunks/Docstring-hf-doc-builder.js";import{I as vt}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function yr(qs){let I,Ue,$,A,Ee,W,St,De,Et,Be,b,Dt,G,bt,yt,be,It,$t,je,P,wt,ye,Tt,xt,He,pe,Mt,We,ue,Y,Ft,Q,Ot,At,Ge,k,Pt,Z,kt,qt,Ye,w,q,Ie,J,Ct,$e,Lt,Qe,D,Nt,we,zt,Vt,Te,Rt,Ut,he,Bt,jt,Ze,y,Ht,K,Wt,Gt,xe,Yt,Qt,Je,T,C,Me,X,Zt,Fe,Jt,Ke,h,ee,Kt,fe,Oe,Xt,es,ts,x,ss,me,rs,os,ge,is,ns,as,L,te,ds,Ae,ls,cs,N,se,ps,Pe,us,hs,z,re,fs,ke,ms,gs,V,oe,_s,qe,vs,Ss,R,ie,Es,Ce,Ds,bs,U,ne,ys,Le,Is,$s,B,ae,ws,Ne,Ts,Xe,M,j,ze,de,xs,Ve,Ms,et,F,le,Fs,ce,Os,Re,As,Ps,tt;return W=new vt({}),J=new vt({}),X=new vt({}),ee=new O({props:{name:"class diffusers.DEISMultistepScheduler",anchor:"diffusers.DEISMultistepScheduler",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:": typing.Optional[numpy.ndarray] = None"},{name:"solver_order",val:": int = 2"},{name:"prediction_type",val:": str = 'epsilon'"},{name:"thresholding",val:": bool = False"},{name:"dynamic_thresholding_ratio",val:": float = 0.995"},{name:"sample_max_value",val:": float = 1.0"},{name:"algorithm_type",val:": str = 'deis'"},{name:"solver_type",val:": str = 'logrho'"},{name:"lower_order_final",val:": bool = True"},{name:"use_karras_sigmas",val:": typing.Optional[bool] = False"},{name:"timestep_spacing",val:": str = 'linspace'"},{name:"steps_offset",val:": int = 0"}],parametersDescription:[{anchor:"diffusers.DEISMultistepScheduler.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.DEISMultistepScheduler.beta_start",description:`<strong>beta_start</strong> (<code>float</code>, defaults to 0.0001) &#x2014;
The starting <code>beta</code> value of inference.`,name:"beta_start"},{anchor:"diffusers.DEISMultistepScheduler.beta_end",description:`<strong>beta_end</strong> (<code>float</code>, defaults to 0.02) &#x2014;
The final <code>beta</code> value.`,name:"beta_end"},{anchor:"diffusers.DEISMultistepScheduler.beta_schedule",description:`<strong>beta_schedule</strong> (<code>str</code>, defaults to <code>&quot;linear&quot;</code>) &#x2014;
The beta schedule, a mapping from a beta range to a sequence of betas for stepping the model. Choose from
<code>linear</code>, <code>scaled_linear</code>, or <code>squaredcos_cap_v2</code>.`,name:"beta_schedule"},{anchor:"diffusers.DEISMultistepScheduler.trained_betas",description:`<strong>trained_betas</strong> (<code>np.ndarray</code>, <em>optional</em>) &#x2014;
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.DEISMultistepScheduler.solver_order",description:`<strong>solver_order</strong> (<code>int</code>, defaults to 2) &#x2014;
The DEIS order which can be <code>1</code> or <code>2</code> or <code>3</code>. It is recommended to use <code>solver_order=2</code> for guided
sampling, and <code>solver_order=3</code> for unconditional sampling.`,name:"solver_order"},{anchor:"diffusers.DEISMultistepScheduler.prediction_type",description:`<strong>prediction_type</strong> (<code>str</code>, defaults to <code>epsilon</code>) &#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.DEISMultistepScheduler.thresholding",description:`<strong>thresholding</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Whether to use the &#x201C;dynamic thresholding&#x201D; method. This is unsuitable for latent-space diffusion models such
as Stable Diffusion.`,name:"thresholding"},{anchor:"diffusers.DEISMultistepScheduler.dynamic_thresholding_ratio",description:`<strong>dynamic_thresholding_ratio</strong> (<code>float</code>, defaults to 0.995) &#x2014;
The ratio for the dynamic thresholding method. Valid only when <code>thresholding=True</code>.`,name:"dynamic_thresholding_ratio"},{anchor:"diffusers.DEISMultistepScheduler.sample_max_value",description:`<strong>sample_max_value</strong> (<code>float</code>, defaults to 1.0) &#x2014;
The threshold value for dynamic thresholding. Valid only when <code>thresholding=True</code>.`,name:"sample_max_value"},{anchor:"diffusers.DEISMultistepScheduler.algorithm_type",description:`<strong>algorithm_type</strong> (<code>str</code>, defaults to <code>deis</code>) &#x2014;
The algorithm type for the solver.`,name:"algorithm_type"},{anchor:"diffusers.DEISMultistepScheduler.lower_order_final",description:`<strong>lower_order_final</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to use lower-order solvers in the final steps. Only valid for &lt; 15 inference steps.`,name:"lower_order_final"},{anchor:"diffusers.DEISMultistepScheduler.use_karras_sigmas",description:`<strong>use_karras_sigmas</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
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 {&#x3C3;i}.`,name:"use_karras_sigmas"},{anchor:"diffusers.DEISMultistepScheduler.timestep_spacing",description:`<strong>timestep_spacing</strong> (<code>str</code>, defaults to <code>&quot;linspace&quot;</code>) &#x2014;
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.DEISMultistepScheduler.steps_offset",description:`<strong>steps_offset</strong> (<code>int</code>, defaults to 0) &#x2014;
An offset added to the inference steps. You can use a combination of <code>offset=1</code> and
<code>set_alpha_to_one=False</code> to make the last step use step 0 for the previous alpha product like in Stable
Diffusion.`,name:"steps_offset"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/schedulers/scheduling_deis_multistep.py#L73"}}),te=new O({props:{name:"convert_model_output",anchor:"diffusers.DEISMultistepScheduler.convert_model_output",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"sample",val:": FloatTensor"}],parametersDescription:[{anchor:"diffusers.DEISMultistepScheduler.convert_model_output.model_output",description:`<strong>model_output</strong> (<code>torch.FloatTensor</code>) &#x2014;
The direct output from the learned diffusion model.`,name:"model_output"},{anchor:"diffusers.DEISMultistepScheduler.convert_model_output.timestep",description:`<strong>timestep</strong> (<code>int</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.DEISMultistepScheduler.convert_model_output.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
A current instance of a sample created by the diffusion process.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/schedulers/scheduling_deis_multistep.py#L283",returnDescription:`
<p>The converted model output.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),se=new O({props:{name:"deis_first_order_update",anchor:"diffusers.DEISMultistepScheduler.deis_first_order_update",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"prev_timestep",val:": int"},{name:"sample",val:": FloatTensor"}],parametersDescription:[{anchor:"diffusers.DEISMultistepScheduler.deis_first_order_update.model_output",description:`<strong>model_output</strong> (<code>torch.FloatTensor</code>) &#x2014;
The direct output from the learned diffusion model.`,name:"model_output"},{anchor:"diffusers.DEISMultistepScheduler.deis_first_order_update.timestep",description:`<strong>timestep</strong> (<code>int</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.DEISMultistepScheduler.deis_first_order_update.prev_timestep",description:`<strong>prev_timestep</strong> (<code>int</code>) &#x2014;
The previous discrete timestep in the diffusion chain.`,name:"prev_timestep"},{anchor:"diffusers.DEISMultistepScheduler.deis_first_order_update.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
A current instance of a sample created by the diffusion process.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/schedulers/scheduling_deis_multistep.py#L324",returnDescription:`
<p>The sample tensor at the previous timestep.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),re=new O({props:{name:"multistep_deis_second_order_update",anchor:"diffusers.DEISMultistepScheduler.multistep_deis_second_order_update",parameters:[{name:"model_output_list",val:": typing.List[torch.FloatTensor]"},{name:"timestep_list",val:": typing.List[int]"},{name:"prev_timestep",val:": int"},{name:"sample",val:": FloatTensor"}],parametersDescription:[{anchor:"diffusers.DEISMultistepScheduler.multistep_deis_second_order_update.model_output_list",description:`<strong>model_output_list</strong> (<code>List[torch.FloatTensor]</code>) &#x2014;
The direct outputs from learned diffusion model at current and latter timesteps.`,name:"model_output_list"},{anchor:"diffusers.DEISMultistepScheduler.multistep_deis_second_order_update.timestep",description:`<strong>timestep</strong> (<code>int</code>) &#x2014;
The current and latter discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.DEISMultistepScheduler.multistep_deis_second_order_update.prev_timestep",description:`<strong>prev_timestep</strong> (<code>int</code>) &#x2014;
The previous discrete timestep in the diffusion chain.`,name:"prev_timestep"},{anchor:"diffusers.DEISMultistepScheduler.multistep_deis_second_order_update.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
A current instance of a sample created by the diffusion process.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/schedulers/scheduling_deis_multistep.py#L358",returnDescription:`
<p>The sample tensor at the previous timestep.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),oe=new O({props:{name:"multistep_deis_third_order_update",anchor:"diffusers.DEISMultistepScheduler.multistep_deis_third_order_update",parameters:[{name:"model_output_list",val:": typing.List[torch.FloatTensor]"},{name:"timestep_list",val:": typing.List[int]"},{name:"prev_timestep",val:": int"},{name:"sample",val:": FloatTensor"}],parametersDescription:[{anchor:"diffusers.DEISMultistepScheduler.multistep_deis_third_order_update.model_output_list",description:`<strong>model_output_list</strong> (<code>List[torch.FloatTensor]</code>) &#x2014;
The direct outputs from learned diffusion model at current and latter timesteps.`,name:"model_output_list"},{anchor:"diffusers.DEISMultistepScheduler.multistep_deis_third_order_update.timestep",description:`<strong>timestep</strong> (<code>int</code>) &#x2014;
The current and latter discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.DEISMultistepScheduler.multistep_deis_third_order_update.prev_timestep",description:`<strong>prev_timestep</strong> (<code>int</code>) &#x2014;
The previous discrete timestep in the diffusion chain.`,name:"prev_timestep"},{anchor:"diffusers.DEISMultistepScheduler.multistep_deis_third_order_update.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
A current instance of a sample created by diffusion process.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/schedulers/scheduling_deis_multistep.py#L403",returnDescription:`
<p>The sample tensor at the previous timestep.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),ie=new O({props:{name:"scale_model_input",anchor:"diffusers.DEISMultistepScheduler.scale_model_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.DEISMultistepScheduler.scale_model_input.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
The input sample.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/schedulers/scheduling_deis_multistep.py#L536",returnDescription:`
<p>A scaled input sample.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),ne=new O({props:{name:"set_timesteps",anchor:"diffusers.DEISMultistepScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": typing.Union[str, torch.device] = None"}],parametersDescription:[{anchor:"diffusers.DEISMultistepScheduler.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.DEISMultistepScheduler.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/v0.20.0/src/diffusers/schedulers/scheduling_deis_multistep.py#L190"}}),ae=new O({props:{name:"step",anchor:"diffusers.DEISMultistepScheduler.step",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"sample",val:": FloatTensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.DEISMultistepScheduler.step.model_output",description:`<strong>model_output</strong> (<code>torch.FloatTensor</code>) &#x2014;
The direct output from learned diffusion model.`,name:"model_output"},{anchor:"diffusers.DEISMultistepScheduler.step.timestep",description:`<strong>timestep</strong> (<code>float</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.DEISMultistepScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
A current instance of a sample created by the diffusion process.`,name:"sample"},{anchor:"diffusers.DEISMultistepScheduler.step.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/v0.20.0/en/api/schedulers/dpm_discrete#diffusers.schedulers.scheduling_utils.SchedulerOutput">SchedulerOutput</a> or <code>tuple</code>.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/schedulers/scheduling_deis_multistep.py#L463",returnDescription:`
<p>If return_dict is <code>True</code>, <a
  href="/docs/diffusers/v0.20.0/en/api/schedulers/dpm_discrete#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> is returned, otherwise a
tuple is returned where the first element is the sample tensor.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/v0.20.0/en/api/schedulers/dpm_discrete#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> or <code>tuple</code></p>
`}}),de=new vt({}),le=new O({props:{name:"class diffusers.schedulers.scheduling_utils.SchedulerOutput",anchor:"diffusers.schedulers.scheduling_utils.SchedulerOutput",parameters:[{name:"prev_sample",val:": FloatTensor"}],parametersDescription:[{anchor:"diffusers.schedulers.scheduling_utils.SchedulerOutput.prev_sample",description:`<strong>prev_sample</strong> (<code>torch.FloatTensor</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"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/schedulers/scheduling_utils.py#L50"}}),{c(){I=r("meta"),Ue=l(),$=r("h1"),A=r("a"),Ee=r("span"),m(W.$$.fragment),St=l(),De=r("span"),Et=n("DEISMultistepScheduler"),Be=l(),b=r("p"),Dt=n("Diffusion Exponential Integrator Sampler (DEIS) is proposed in "),G=r("a"),bt=n("Fast Sampling of Diffusion Models with Exponential Integrator"),yt=n(" by Qinsheng Zhang and Yongxin Chen. "),be=r("code"),It=n("DEISMultistepScheduler"),$t=n(" is a fast high order solver for diffusion ordinary differential equations (ODEs)."),je=l(),P=r("p"),wt=n("This implementation modifies the polynomial fitting formula in log-rho space instead of the original linear "),ye=r("code"),Tt=n("t"),xt=n(" space in the DEIS paper. The modification enjoys closed-form coefficients for exponential multistep update instead of replying on the numerical solver."),He=l(),pe=r("p"),Mt=n("The abstract from the paper is:"),We=l(),ue=r("p"),Y=r("em"),Ft=n("The past few years have witnessed the great success of Diffusion models~(DMs) in generating high-fidelity samples in generative modeling tasks. A major limitation of the DM is its notoriously slow sampling procedure which normally requires hundreds to thousands of time discretization steps of the learned diffusion process to reach the desired accuracy. Our goal is to develop a fast sampling method for DMs with a much less number of steps while retaining high sample quality. To this end, we systematically analyze the sampling procedure in DMs and identify key factors that affect the sample quality, among which the method of discretization is most crucial. By carefully examining the learned diffusion process, we propose Diffusion Exponential Integrator Sampler~(DEIS). It is based on the Exponential Integrator designed for discretizing ordinary differential equations (ODEs) and leverages a semilinear structure of the learned diffusion process to reduce the discretization error. The proposed method can be applied to any DMs and can generate high-fidelity samples in as few as 10 steps. In our experiments, it takes about 3 minutes on one A6000 GPU to generate 50k images from CIFAR10. Moreover, by directly using pre-trained DMs, we achieve the state-of-art sampling performance when the number of score function evaluation~(NFE) is limited, e.g., 4.17 FID with 10 NFEs, 3.37 FID, and 9.74 IS with only 15 NFEs on CIFAR10. Code is available at "),Q=r("a"),Ot=n("this https URL"),At=n("."),Ge=l(),k=r("p"),Pt=n("The original codebase can be found at "),Z=r("a"),kt=n("qsh-zh/deis"),qt=n("."),Ye=l(),w=r("h2"),q=r("a"),Ie=r("span"),m(J.$$.fragment),Ct=l(),$e=r("span"),Lt=n("Tips"),Qe=l(),D=r("p"),Nt=n("It is recommended to set "),we=r("code"),zt=n("solver_order"),Vt=n(" to 2 or 3, while "),Te=r("code"),Rt=n("solver_order=1"),Ut=n(" is equivalent to "),he=r("a"),Bt=n("DDIMScheduler"),jt=n("."),Ze=l(),y=r("p"),Ht=n("Dynamic thresholding from "),K=r("a"),Wt=n("Imagen"),Gt=n(` is supported, and for pixel-space
diffusion models, you can set `),xe=r("code"),Yt=n("thresholding=True"),Qt=n(" to use the dynamic thresholding."),Je=l(),T=r("h2"),C=r("a"),Me=r("span"),m(X.$$.fragment),Zt=l(),Fe=r("span"),Jt=n("DEISMultistepScheduler"),Ke=l(),h=r("div"),m(ee.$$.fragment),Kt=l(),fe=r("p"),Oe=r("code"),Xt=n("DEISMultistepScheduler"),es=n(" is a fast high order solver for diffusion ordinary differential equations (ODEs)."),ts=l(),x=r("p"),ss=n("This model inherits from "),me=r("a"),rs=n("SchedulerMixin"),os=n(" and "),ge=r("a"),is=n("ConfigMixin"),ns=n(`. Check the superclass documentation for the generic
methods the library implements for all schedulers such as loading and saving.`),as=l(),L=r("div"),m(te.$$.fragment),ds=l(),Ae=r("p"),ls=n("Convert the model output to the corresponding type the DEIS algorithm needs."),cs=l(),N=r("div"),m(se.$$.fragment),ps=l(),Pe=r("p"),us=n("One step for the first-order DEIS (equivalent to DDIM)."),hs=l(),z=r("div"),m(re.$$.fragment),fs=l(),ke=r("p"),ms=n("One step for the second-order multistep DEIS."),gs=l(),V=r("div"),m(oe.$$.fragment),_s=l(),qe=r("p"),vs=n("One step for the third-order multistep DEIS."),Ss=l(),R=r("div"),m(ie.$$.fragment),Es=l(),Ce=r("p"),Ds=n(`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),bs=l(),U=r("div"),m(ne.$$.fragment),ys=l(),Le=r("p"),Is=n("Sets the discrete timesteps used for the diffusion chain (to be run before inference)."),$s=l(),B=r("div"),m(ae.$$.fragment),ws=l(),Ne=r("p"),Ts=n(`Predict the sample from the previous timestep by reversing the SDE. This function propagates the sample with
the multistep DEIS.`),Xe=l(),M=r("h2"),j=r("a"),ze=r("span"),m(de.$$.fragment),xs=l(),Ve=r("span"),Ms=n("SchedulerOutput"),et=l(),F=r("div"),m(le.$$.fragment),Fs=l(),ce=r("p"),Os=n("Base class for the output of a scheduler\u2019s "),Re=r("code"),As=n("step"),Ps=n(" function."),this.h()},l(t){const p=Er('[data-svelte="svelte-1phssyn"]',document.head);I=o(p,"META",{name:!0,content:!0}),p.forEach(s),Ue=c(t),$=o(t,"H1",{class:!0});var st=i($);A=o(st,"A",{id:!0,class:!0,href:!0});var Cs=i(A);Ee=o(Cs,"SPAN",{});var Ls=i(Ee);g(W.$$.fragment,Ls),Ls.forEach(s),Cs.forEach(s),St=c(st),De=o(st,"SPAN",{});var Ns=i(De);Et=a(Ns,"DEISMultistepScheduler"),Ns.forEach(s),st.forEach(s),Be=c(t),b=o(t,"P",{});var _e=i(b);Dt=a(_e,"Diffusion Exponential Integrator Sampler (DEIS) is proposed in "),G=o(_e,"A",{href:!0,rel:!0});var zs=i(G);bt=a(zs,"Fast Sampling of Diffusion Models with Exponential Integrator"),zs.forEach(s),yt=a(_e," by Qinsheng Zhang and Yongxin Chen. "),be=o(_e,"CODE",{});var Vs=i(be);It=a(Vs,"DEISMultistepScheduler"),Vs.forEach(s),$t=a(_e," is a fast high order solver for diffusion ordinary differential equations (ODEs)."),_e.forEach(s),je=c(t),P=o(t,"P",{});var rt=i(P);wt=a(rt,"This implementation modifies the polynomial fitting formula in log-rho space instead of the original linear "),ye=o(rt,"CODE",{});var Rs=i(ye);Tt=a(Rs,"t"),Rs.forEach(s),xt=a(rt," space in the DEIS paper. The modification enjoys closed-form coefficients for exponential multistep update instead of replying on the numerical solver."),rt.forEach(s),He=c(t),pe=o(t,"P",{});var Us=i(pe);Mt=a(Us,"The abstract from the paper is:"),Us.forEach(s),We=c(t),ue=o(t,"P",{});var Bs=i(ue);Y=o(Bs,"EM",{});var ot=i(Y);Ft=a(ot,"The past few years have witnessed the great success of Diffusion models~(DMs) in generating high-fidelity samples in generative modeling tasks. A major limitation of the DM is its notoriously slow sampling procedure which normally requires hundreds to thousands of time discretization steps of the learned diffusion process to reach the desired accuracy. Our goal is to develop a fast sampling method for DMs with a much less number of steps while retaining high sample quality. To this end, we systematically analyze the sampling procedure in DMs and identify key factors that affect the sample quality, among which the method of discretization is most crucial. By carefully examining the learned diffusion process, we propose Diffusion Exponential Integrator Sampler~(DEIS). It is based on the Exponential Integrator designed for discretizing ordinary differential equations (ODEs) and leverages a semilinear structure of the learned diffusion process to reduce the discretization error. The proposed method can be applied to any DMs and can generate high-fidelity samples in as few as 10 steps. In our experiments, it takes about 3 minutes on one A6000 GPU to generate 50k images from CIFAR10. Moreover, by directly using pre-trained DMs, we achieve the state-of-art sampling performance when the number of score function evaluation~(NFE) is limited, e.g., 4.17 FID with 10 NFEs, 3.37 FID, and 9.74 IS with only 15 NFEs on CIFAR10. Code is available at "),Q=o(ot,"A",{href:!0,rel:!0});var js=i(Q);Ot=a(js,"this https URL"),js.forEach(s),At=a(ot,"."),ot.forEach(s),Bs.forEach(s),Ge=c(t),k=o(t,"P",{});var it=i(k);Pt=a(it,"The original codebase can be found at "),Z=o(it,"A",{href:!0,rel:!0});var Hs=i(Z);kt=a(Hs,"qsh-zh/deis"),Hs.forEach(s),qt=a(it,"."),it.forEach(s),Ye=c(t),w=o(t,"H2",{class:!0});var nt=i(w);q=o(nt,"A",{id:!0,class:!0,href:!0});var Ws=i(q);Ie=o(Ws,"SPAN",{});var Gs=i(Ie);g(J.$$.fragment,Gs),Gs.forEach(s),Ws.forEach(s),Ct=c(nt),$e=o(nt,"SPAN",{});var Ys=i($e);Lt=a(Ys,"Tips"),Ys.forEach(s),nt.forEach(s),Qe=c(t),D=o(t,"P",{});var H=i(D);Nt=a(H,"It is recommended to set "),we=o(H,"CODE",{});var Qs=i(we);zt=a(Qs,"solver_order"),Qs.forEach(s),Vt=a(H," to 2 or 3, while "),Te=o(H,"CODE",{});var Zs=i(Te);Rt=a(Zs,"solver_order=1"),Zs.forEach(s),Ut=a(H," is equivalent to "),he=o(H,"A",{href:!0});var Js=i(he);Bt=a(Js,"DDIMScheduler"),Js.forEach(s),jt=a(H,"."),H.forEach(s),Ze=c(t),y=o(t,"P",{});var ve=i(y);Ht=a(ve,"Dynamic thresholding from "),K=o(ve,"A",{href:!0,rel:!0});var Ks=i(K);Wt=a(Ks,"Imagen"),Ks.forEach(s),Gt=a(ve,` is supported, and for pixel-space
diffusion models, you can set `),xe=o(ve,"CODE",{});var Xs=i(xe);Yt=a(Xs,"thresholding=True"),Xs.forEach(s),Qt=a(ve," to use the dynamic thresholding."),ve.forEach(s),Je=c(t),T=o(t,"H2",{class:!0});var at=i(T);C=o(at,"A",{id:!0,class:!0,href:!0});var er=i(C);Me=o(er,"SPAN",{});var tr=i(Me);g(X.$$.fragment,tr),tr.forEach(s),er.forEach(s),Zt=c(at),Fe=o(at,"SPAN",{});var sr=i(Fe);Jt=a(sr,"DEISMultistepScheduler"),sr.forEach(s),at.forEach(s),Ke=c(t),h=o(t,"DIV",{class:!0});var f=i(h);g(ee.$$.fragment,f),Kt=c(f),fe=o(f,"P",{});var ks=i(fe);Oe=o(ks,"CODE",{});var rr=i(Oe);Xt=a(rr,"DEISMultistepScheduler"),rr.forEach(s),es=a(ks," is a fast high order solver for diffusion ordinary differential equations (ODEs)."),ks.forEach(s),ts=c(f),x=o(f,"P",{});var Se=i(x);ss=a(Se,"This model inherits from "),me=o(Se,"A",{href:!0});var or=i(me);rs=a(or,"SchedulerMixin"),or.forEach(s),os=a(Se," and "),ge=o(Se,"A",{href:!0});var ir=i(ge);is=a(ir,"ConfigMixin"),ir.forEach(s),ns=a(Se,`. Check the superclass documentation for the generic
methods the library implements for all schedulers such as loading and saving.`),Se.forEach(s),as=c(f),L=o(f,"DIV",{class:!0});var dt=i(L);g(te.$$.fragment,dt),ds=c(dt),Ae=o(dt,"P",{});var nr=i(Ae);ls=a(nr,"Convert the model output to the corresponding type the DEIS algorithm needs."),nr.forEach(s),dt.forEach(s),cs=c(f),N=o(f,"DIV",{class:!0});var lt=i(N);g(se.$$.fragment,lt),ps=c(lt),Pe=o(lt,"P",{});var ar=i(Pe);us=a(ar,"One step for the first-order DEIS (equivalent to DDIM)."),ar.forEach(s),lt.forEach(s),hs=c(f),z=o(f,"DIV",{class:!0});var ct=i(z);g(re.$$.fragment,ct),fs=c(ct),ke=o(ct,"P",{});var dr=i(ke);ms=a(dr,"One step for the second-order multistep DEIS."),dr.forEach(s),ct.forEach(s),gs=c(f),V=o(f,"DIV",{class:!0});var pt=i(V);g(oe.$$.fragment,pt),_s=c(pt),qe=o(pt,"P",{});var lr=i(qe);vs=a(lr,"One step for the third-order multistep DEIS."),lr.forEach(s),pt.forEach(s),Ss=c(f),R=o(f,"DIV",{class:!0});var ut=i(R);g(ie.$$.fragment,ut),Es=c(ut),Ce=o(ut,"P",{});var cr=i(Ce);Ds=a(cr,`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),cr.forEach(s),ut.forEach(s),bs=c(f),U=o(f,"DIV",{class:!0});var ht=i(U);g(ne.$$.fragment,ht),ys=c(ht),Le=o(ht,"P",{});var pr=i(Le);Is=a(pr,"Sets the discrete timesteps used for the diffusion chain (to be run before inference)."),pr.forEach(s),ht.forEach(s),$s=c(f),B=o(f,"DIV",{class:!0});var ft=i(B);g(ae.$$.fragment,ft),ws=c(ft),Ne=o(ft,"P",{});var ur=i(Ne);Ts=a(ur,`Predict the sample from the previous timestep by reversing the SDE. This function propagates the sample with
the multistep DEIS.`),ur.forEach(s),ft.forEach(s),f.forEach(s),Xe=c(t),M=o(t,"H2",{class:!0});var mt=i(M);j=o(mt,"A",{id:!0,class:!0,href:!0});var hr=i(j);ze=o(hr,"SPAN",{});var fr=i(ze);g(de.$$.fragment,fr),fr.forEach(s),hr.forEach(s),xs=c(mt),Ve=o(mt,"SPAN",{});var mr=i(Ve);Ms=a(mr,"SchedulerOutput"),mr.forEach(s),mt.forEach(s),et=c(t),F=o(t,"DIV",{class:!0});var gt=i(F);g(le.$$.fragment,gt),Fs=c(gt),ce=o(gt,"P",{});var _t=i(ce);Os=a(_t,"Base class for the output of a scheduler\u2019s "),Re=o(_t,"CODE",{});var gr=i(Re);As=a(gr,"step"),gr.forEach(s),Ps=a(_t," function."),_t.forEach(s),gt.forEach(s),this.h()},h(){d(I,"name","hf:doc:metadata"),d(I,"content",JSON.stringify(Ir)),d(A,"id","deismultistepscheduler"),d(A,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(A,"href","#deismultistepscheduler"),d($,"class","relative group"),d(G,"href","https://huggingface.co/papers/2204.13902"),d(G,"rel","nofollow"),d(Q,"href","https://github.com/qsh-zh/deis"),d(Q,"rel","nofollow"),d(Z,"href","https://github.com/qsh-zh/deis"),d(Z,"rel","nofollow"),d(q,"id","tips"),d(q,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(q,"href","#tips"),d(w,"class","relative group"),d(he,"href","/docs/diffusers/v0.20.0/en/api/schedulers/ddim#diffusers.DDIMScheduler"),d(K,"href","https://huggingface.co/papers/2205.11487"),d(K,"rel","nofollow"),d(C,"id","diffusers.DEISMultistepScheduler"),d(C,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(C,"href","#diffusers.DEISMultistepScheduler"),d(T,"class","relative group"),d(me,"href","/docs/diffusers/v0.20.0/en/api/schedulers/overview#diffusers.SchedulerMixin"),d(ge,"href","/docs/diffusers/v0.20.0/en/api/configuration#diffusers.ConfigMixin"),d(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(h,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(j,"id","diffusers.schedulers.scheduling_utils.SchedulerOutput"),d(j,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(j,"href","#diffusers.schedulers.scheduling_utils.SchedulerOutput"),d(M,"class","relative group"),d(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,p){e(document.head,I),u(t,Ue,p),u(t,$,p),e($,A),e(A,Ee),_(W,Ee,null),e($,St),e($,De),e(De,Et),u(t,Be,p),u(t,b,p),e(b,Dt),e(b,G),e(G,bt),e(b,yt),e(b,be),e(be,It),e(b,$t),u(t,je,p),u(t,P,p),e(P,wt),e(P,ye),e(ye,Tt),e(P,xt),u(t,He,p),u(t,pe,p),e(pe,Mt),u(t,We,p),u(t,ue,p),e(ue,Y),e(Y,Ft),e(Y,Q),e(Q,Ot),e(Y,At),u(t,Ge,p),u(t,k,p),e(k,Pt),e(k,Z),e(Z,kt),e(k,qt),u(t,Ye,p),u(t,w,p),e(w,q),e(q,Ie),_(J,Ie,null),e(w,Ct),e(w,$e),e($e,Lt),u(t,Qe,p),u(t,D,p),e(D,Nt),e(D,we),e(we,zt),e(D,Vt),e(D,Te),e(Te,Rt),e(D,Ut),e(D,he),e(he,Bt),e(D,jt),u(t,Ze,p),u(t,y,p),e(y,Ht),e(y,K),e(K,Wt),e(y,Gt),e(y,xe),e(xe,Yt),e(y,Qt),u(t,Je,p),u(t,T,p),e(T,C),e(C,Me),_(X,Me,null),e(T,Zt),e(T,Fe),e(Fe,Jt),u(t,Ke,p),u(t,h,p),_(ee,h,null),e(h,Kt),e(h,fe),e(fe,Oe),e(Oe,Xt),e(fe,es),e(h,ts),e(h,x),e(x,ss),e(x,me),e(me,rs),e(x,os),e(x,ge),e(ge,is),e(x,ns),e(h,as),e(h,L),_(te,L,null),e(L,ds),e(L,Ae),e(Ae,ls),e(h,cs),e(h,N),_(se,N,null),e(N,ps),e(N,Pe),e(Pe,us),e(h,hs),e(h,z),_(re,z,null),e(z,fs),e(z,ke),e(ke,ms),e(h,gs),e(h,V),_(oe,V,null),e(V,_s),e(V,qe),e(qe,vs),e(h,Ss),e(h,R),_(ie,R,null),e(R,Es),e(R,Ce),e(Ce,Ds),e(h,bs),e(h,U),_(ne,U,null),e(U,ys),e(U,Le),e(Le,Is),e(h,$s),e(h,B),_(ae,B,null),e(B,ws),e(B,Ne),e(Ne,Ts),u(t,Xe,p),u(t,M,p),e(M,j),e(j,ze),_(de,ze,null),e(M,xs),e(M,Ve),e(Ve,Ms),u(t,et,p),u(t,F,p),_(le,F,null),e(F,Fs),e(F,ce),e(ce,Os),e(ce,Re),e(Re,As),e(ce,Ps),tt=!0},p:Dr,i(t){tt||(v(W.$$.fragment,t),v(J.$$.fragment,t),v(X.$$.fragment,t),v(ee.$$.fragment,t),v(te.$$.fragment,t),v(se.$$.fragment,t),v(re.$$.fragment,t),v(oe.$$.fragment,t),v(ie.$$.fragment,t),v(ne.$$.fragment,t),v(ae.$$.fragment,t),v(de.$$.fragment,t),v(le.$$.fragment,t),tt=!0)},o(t){S(W.$$.fragment,t),S(J.$$.fragment,t),S(X.$$.fragment,t),S(ee.$$.fragment,t),S(te.$$.fragment,t),S(se.$$.fragment,t),S(re.$$.fragment,t),S(oe.$$.fragment,t),S(ie.$$.fragment,t),S(ne.$$.fragment,t),S(ae.$$.fragment,t),S(de.$$.fragment,t),S(le.$$.fragment,t),tt=!1},d(t){s(I),t&&s(Ue),t&&s($),E(W),t&&s(Be),t&&s(b),t&&s(je),t&&s(P),t&&s(He),t&&s(pe),t&&s(We),t&&s(ue),t&&s(Ge),t&&s(k),t&&s(Ye),t&&s(w),E(J),t&&s(Qe),t&&s(D),t&&s(Ze),t&&s(y),t&&s(Je),t&&s(T),E(X),t&&s(Ke),t&&s(h),E(ee),E(te),E(se),E(re),E(oe),E(ie),E(ne),E(ae),t&&s(Xe),t&&s(M),E(de),t&&s(et),t&&s(F),E(le)}}}const Ir={local:"deismultistepscheduler",sections:[{local:"tips",title:"Tips"},{local:"diffusers.DEISMultistepScheduler",title:"DEISMultistepScheduler"},{local:"diffusers.schedulers.scheduling_utils.SchedulerOutput",title:"SchedulerOutput"}],title:"DEISMultistepScheduler"};function $r(qs){return br(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Mr extends _r{constructor(I){super();vr(this,I,$r,yr,Sr,{})}}export{Mr as default,Ir as metadata};
