import{S as bo,i as So,s as Mo,e as r,k as p,w as b,t as n,M as yo,c as o,d as t,m as c,a as i,x as S,h as a,b as d,G as e,g as w,y as M,L as Do,q as y,o as D,B as P,v as Po}from"../../../chunks/vendor-hf-doc-builder.js";import{D as U}from"../../../chunks/Docstring-hf-doc-builder.js";import{I as Cr}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function xo(Ar){let $,Ge,E,C,ge,K,st,_e,nt,He,T,A,be,B,it,Se,at,Ue,v,dt,J,lt,pt,R,ct,ut,j,ht,mt,Ke,F,N,Me,Q,ft,ye,vt,Be,l,X,gt,De,_t,bt,I,St,Y,Mt,yt,Z,Dt,Pt,O,xt,Pe,wt,$t,xe,Et,Tt,Ft,_,Ot,ee,Ct,At,we,Nt,It,$e,kt,Lt,qt,te,Wt,Ee,Vt,zt,Gt,h,ce,Ht,Ut,Te,Kt,Bt,Fe,Jt,Rt,Oe,jt,Qt,ue,Xt,Yt,he,Zt,er,me,tr,rr,or,g,re,sr,Ce,nr,ir,Ae,ar,dr,Ne,lr,pr,x,oe,cr,Ie,ur,hr,se,mr,ne,fr,vr,gr,k,ie,_r,ke,br,Sr,L,ae,Mr,Le,yr,Dr,q,de,Pr,qe,xr,wr,W,le,$r,We,Er,Tr,V,pe,Fr,Ve,Or,Je;return K=new Cr({}),B=new Cr({}),Q=new Cr({}),X=new U({props:{name:"class diffusers.DPMSolverMultistepScheduler",anchor:"diffusers.DPMSolverMultistepScheduler",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.Union[numpy.ndarray, typing.List[float], NoneType] = 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 = 'dpmsolver++'"},{name:"solver_type",val:": str = 'midpoint'"},{name:"lower_order_final",val:": bool = True"},{name:"use_karras_sigmas",val:": typing.Optional[bool] = False"},{name:"lambda_min_clipped",val:": float = -inf"},{name:"variance_type",val:": typing.Optional[str] = None"}],parametersDescription:[{anchor:"diffusers.DPMSolverMultistepScheduler.num_train_timesteps",description:"<strong>num_train_timesteps</strong> (<code>int</code>) &#x2014; number of diffusion steps used to train the model.",name:"num_train_timesteps"},{anchor:"diffusers.DPMSolverMultistepScheduler.beta_start",description:"<strong>beta_start</strong> (<code>float</code>) &#x2014; the starting <code>beta</code> value of inference.",name:"beta_start"},{anchor:"diffusers.DPMSolverMultistepScheduler.beta_end",description:"<strong>beta_end</strong> (<code>float</code>) &#x2014; the final <code>beta</code> value.",name:"beta_end"},{anchor:"diffusers.DPMSolverMultistepScheduler.beta_schedule",description:`<strong>beta_schedule</strong> (<code>str</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.DPMSolverMultistepScheduler.trained_betas",description:`<strong>trained_betas</strong> (<code>np.ndarray</code>, optional) &#x2014;
option to pass an array of betas directly to the constructor to bypass <code>beta_start</code>, <code>beta_end</code> etc.`,name:"trained_betas"},{anchor:"diffusers.DPMSolverMultistepScheduler.solver_order",description:`<strong>solver_order</strong> (<code>int</code>, default <code>2</code>) &#x2014;
the order of DPM-Solver; can be <code>1</code> or <code>2</code> or <code>3</code>. We recommend to use <code>solver_order=2</code> for guided
sampling, and <code>solver_order=3</code> for unconditional sampling.`,name:"solver_order"},{anchor:"diffusers.DPMSolverMultistepScheduler.prediction_type",description:`<strong>prediction_type</strong> (<code>str</code>, default <code>epsilon</code>, optional) &#x2014;
prediction type of the scheduler function, one of <code>epsilon</code> (predicting the noise of the diffusion
process), <code>sample</code> (directly predicting the noisy sample<code>) or </code>v_prediction\` (see section 2.4
<a href="https://imagen.research.google/video/paper.pdf" rel="nofollow">https://imagen.research.google/video/paper.pdf</a>)`,name:"prediction_type"},{anchor:"diffusers.DPMSolverMultistepScheduler.thresholding",description:`<strong>thresholding</strong> (<code>bool</code>, default <code>False</code>) &#x2014;
whether to use the &#x201C;dynamic thresholding&#x201D; method (introduced by Imagen, <a href="https://arxiv.org/abs/2205.11487" rel="nofollow">https://arxiv.org/abs/2205.11487</a>).
For pixel-space diffusion models, you can set both <code>algorithm_type=dpmsolver++</code> and <code>thresholding=True</code> to
use the dynamic thresholding. Note that the thresholding method is unsuitable for latent-space diffusion
models (such as stable-diffusion).`,name:"thresholding"},{anchor:"diffusers.DPMSolverMultistepScheduler.dynamic_thresholding_ratio",description:`<strong>dynamic_thresholding_ratio</strong> (<code>float</code>, default <code>0.995</code>) &#x2014;
the ratio for the dynamic thresholding method. Default is <code>0.995</code>, the same as Imagen
(<a href="https://arxiv.org/abs/2205.11487" rel="nofollow">https://arxiv.org/abs/2205.11487</a>).`,name:"dynamic_thresholding_ratio"},{anchor:"diffusers.DPMSolverMultistepScheduler.sample_max_value",description:`<strong>sample_max_value</strong> (<code>float</code>, default <code>1.0</code>) &#x2014;
the threshold value for dynamic thresholding. Valid only when <code>thresholding=True</code> and
<code>algorithm_type=&quot;dpmsolver++</code>.`,name:"sample_max_value"},{anchor:"diffusers.DPMSolverMultistepScheduler.algorithm_type",description:`<strong>algorithm_type</strong> (<code>str</code>, default <code>dpmsolver++</code>) &#x2014;
the algorithm type for the solver. Either <code>dpmsolver</code> or <code>dpmsolver++</code> or <code>sde-dpmsolver</code> or
<code>sde-dpmsolver++</code>. The <code>dpmsolver</code> type implements the algorithms in <a href="https://arxiv.org/abs/2206.00927" rel="nofollow">https://arxiv.org/abs/2206.00927</a>, and
the <code>dpmsolver++</code> type implements the algorithms in <a href="https://arxiv.org/abs/2211.01095" rel="nofollow">https://arxiv.org/abs/2211.01095</a>. We recommend to use
<code>dpmsolver++</code> or <code>sde-dpmsolver++</code> with <code>solver_order=2</code> for guided sampling (e.g. stable-diffusion).`,name:"algorithm_type"},{anchor:"diffusers.DPMSolverMultistepScheduler.solver_type",description:`<strong>solver_type</strong> (<code>str</code>, default <code>midpoint</code>) &#x2014;
the solver type for the second-order solver. Either <code>midpoint</code> or <code>heun</code>. The solver type slightly affects
the sample quality, especially for small number of steps. We empirically find that <code>midpoint</code> solvers are
slightly better, so we recommend to use the <code>midpoint</code> type.`,name:"solver_type"},{anchor:"diffusers.DPMSolverMultistepScheduler.lower_order_final",description:`<strong>lower_order_final</strong> (<code>bool</code>, default <code>True</code>) &#x2014;
whether to use lower-order solvers in the final steps. Only valid for &lt; 15 inference steps. We empirically
find this trick can stabilize the sampling of DPM-Solver for steps &lt; 15, especially for steps &lt;= 10.`,name:"lower_order_final"},{anchor:"diffusers.DPMSolverMultistepScheduler.use_karras_sigmas",description:`<strong>use_karras_sigmas</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
This parameter controls whether to use Karras sigmas (Karras et al. (2022) scheme) for step sizes in the
noise schedule during the sampling process. If True, the sigmas will be determined according to a sequence
of noise levels {&#x3C3;i} as defined in Equation (5) of the paper <a href="https://arxiv.org/pdf/2206.00364.pdf" rel="nofollow">https://arxiv.org/pdf/2206.00364.pdf</a>.`,name:"use_karras_sigmas"},{anchor:"diffusers.DPMSolverMultistepScheduler.lambda_min_clipped",description:`<strong>lambda_min_clipped</strong> (<code>float</code>, default <code>-inf</code>) &#x2014;
the clipping threshold for the minimum value of lambda(t) for numerical stability. This is critical for
cosine (squaredcos_cap_v2) noise schedule.`,name:"lambda_min_clipped"},{anchor:"diffusers.DPMSolverMultistepScheduler.variance_type",description:`<strong>variance_type</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Set to &#x201C;learned&#x201D; or &#x201C;learned_range&#x201D; for diffusion models that predict variance. For example, OpenAI&#x2019;s
guided-diffusion (<a href="https://github.com/openai/guided-diffusion" rel="nofollow">https://github.com/openai/guided-diffusion</a>) predicts both mean and variance of the
Gaussian distribution in the model&#x2019;s output. DPM-Solver only needs the &#x201C;mean&#x201D; output because it is based on
diffusion ODEs. whether the model&#x2019;s output contains the predicted Gaussian variance. For example, OpenAI&#x2019;s
guided-diffusion (<a href="https://github.com/openai/guided-diffusion" rel="nofollow">https://github.com/openai/guided-diffusion</a>) predicts both mean and variance of the
Gaussian distribution in the model&#x2019;s output. DPM-Solver only needs the &#x201C;mean&#x201D; output because it is based on
diffusion ODEs.`,name:"variance_type"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py#L58"}}),re=new U({props:{name:"convert_model_output",anchor:"diffusers.DPMSolverMultistepScheduler.convert_model_output",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"sample",val:": FloatTensor"}],parametersDescription:[{anchor:"diffusers.DPMSolverMultistepScheduler.convert_model_output.model_output",description:"<strong>model_output</strong> (<code>torch.FloatTensor</code>) &#x2014; direct output from learned diffusion model.",name:"model_output"},{anchor:"diffusers.DPMSolverMultistepScheduler.convert_model_output.timestep",description:"<strong>timestep</strong> (<code>int</code>) &#x2014; current discrete timestep in the diffusion chain.",name:"timestep"},{anchor:"diffusers.DPMSolverMultistepScheduler.convert_model_output.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
current instance of sample being created by diffusion process.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py#L322",returnDescription:`
<p>the converted model output.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),oe=new U({props:{name:"dpm_solver_first_order_update",anchor:"diffusers.DPMSolverMultistepScheduler.dpm_solver_first_order_update",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"prev_timestep",val:": int"},{name:"sample",val:": FloatTensor"},{name:"noise",val:": typing.Optional[torch.FloatTensor] = None"}],parametersDescription:[{anchor:"diffusers.DPMSolverMultistepScheduler.dpm_solver_first_order_update.model_output",description:"<strong>model_output</strong> (<code>torch.FloatTensor</code>) &#x2014; direct output from learned diffusion model.",name:"model_output"},{anchor:"diffusers.DPMSolverMultistepScheduler.dpm_solver_first_order_update.timestep",description:"<strong>timestep</strong> (<code>int</code>) &#x2014; current discrete timestep in the diffusion chain.",name:"timestep"},{anchor:"diffusers.DPMSolverMultistepScheduler.dpm_solver_first_order_update.prev_timestep",description:"<strong>prev_timestep</strong> (<code>int</code>) &#x2014; previous discrete timestep in the diffusion chain.",name:"prev_timestep"},{anchor:"diffusers.DPMSolverMultistepScheduler.dpm_solver_first_order_update.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
current instance of sample being created by diffusion process.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py#L397",returnDescription:`
<p>the sample tensor at the previous timestep.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),ie=new U({props:{name:"multistep_dpm_solver_second_order_update",anchor:"diffusers.DPMSolverMultistepScheduler.multistep_dpm_solver_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"},{name:"noise",val:": typing.Optional[torch.FloatTensor] = None"}],parametersDescription:[{anchor:"diffusers.DPMSolverMultistepScheduler.multistep_dpm_solver_second_order_update.model_output_list",description:`<strong>model_output_list</strong> (<code>List[torch.FloatTensor]</code>) &#x2014;
direct outputs from learned diffusion model at current and latter timesteps.`,name:"model_output_list"},{anchor:"diffusers.DPMSolverMultistepScheduler.multistep_dpm_solver_second_order_update.timestep",description:"<strong>timestep</strong> (<code>int</code>) &#x2014; current and latter discrete timestep in the diffusion chain.",name:"timestep"},{anchor:"diffusers.DPMSolverMultistepScheduler.multistep_dpm_solver_second_order_update.prev_timestep",description:"<strong>prev_timestep</strong> (<code>int</code>) &#x2014; previous discrete timestep in the diffusion chain.",name:"prev_timestep"},{anchor:"diffusers.DPMSolverMultistepScheduler.multistep_dpm_solver_second_order_update.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
current instance of sample being created by diffusion process.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py#L444",returnDescription:`
<p>the sample tensor at the previous timestep.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),ae=new U({props:{name:"multistep_dpm_solver_third_order_update",anchor:"diffusers.DPMSolverMultistepScheduler.multistep_dpm_solver_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.DPMSolverMultistepScheduler.multistep_dpm_solver_third_order_update.model_output_list",description:`<strong>model_output_list</strong> (<code>List[torch.FloatTensor]</code>) &#x2014;
direct outputs from learned diffusion model at current and latter timesteps.`,name:"model_output_list"},{anchor:"diffusers.DPMSolverMultistepScheduler.multistep_dpm_solver_third_order_update.timestep",description:"<strong>timestep</strong> (<code>int</code>) &#x2014; current and latter discrete timestep in the diffusion chain.",name:"timestep"},{anchor:"diffusers.DPMSolverMultistepScheduler.multistep_dpm_solver_third_order_update.prev_timestep",description:"<strong>prev_timestep</strong> (<code>int</code>) &#x2014; previous discrete timestep in the diffusion chain.",name:"prev_timestep"},{anchor:"diffusers.DPMSolverMultistepScheduler.multistep_dpm_solver_third_order_update.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
current instance of sample being created by diffusion process.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py#L536",returnDescription:`
<p>the sample tensor at the previous timestep.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),de=new U({props:{name:"scale_model_input",anchor:"diffusers.DPMSolverMultistepScheduler.scale_model_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.DPMSolverMultistepScheduler.scale_model_input.sample",description:"<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014; input sample",name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py#L669",returnDescription:`
<p>scaled input sample</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),le=new U({props:{name:"set_timesteps",anchor:"diffusers.DPMSolverMultistepScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int = None"},{name:"device",val:": typing.Union[str, torch.device] = None"}],parametersDescription:[{anchor:"diffusers.DPMSolverMultistepScheduler.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.DPMSolverMultistepScheduler.set_timesteps.device",description:`<strong>device</strong> (<code>str</code> or <code>torch.device</code>, optional) &#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.17.1/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py#L208"}}),pe=new U({props:{name:"step",anchor:"diffusers.DPMSolverMultistepScheduler.step",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"sample",val:": FloatTensor"},{name:"generator",val:" = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.DPMSolverMultistepScheduler.step.model_output",description:"<strong>model_output</strong> (<code>torch.FloatTensor</code>) &#x2014; direct output from learned diffusion model.",name:"model_output"},{anchor:"diffusers.DPMSolverMultistepScheduler.step.timestep",description:"<strong>timestep</strong> (<code>int</code>) &#x2014; current discrete timestep in the diffusion chain.",name:"timestep"},{anchor:"diffusers.DPMSolverMultistepScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
current instance of sample being created by diffusion process.`,name:"sample"},{anchor:"diffusers.DPMSolverMultistepScheduler.step.return_dict",description:"<strong>return_dict</strong> (<code>bool</code>) &#x2014; option for returning tuple rather than SchedulerOutput class",name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py#L591",returnDescription:`
<p><code>~scheduling_utils.SchedulerOutput</code> if <code>return_dict</code> is
True, otherwise a <code>tuple</code>. When returning a tuple, the first element is the sample tensor.</p>
`,returnType:`
<p><code>~scheduling_utils.SchedulerOutput</code> or <code>tuple</code></p>
`}}),{c(){$=r("meta"),Ge=p(),E=r("h1"),C=r("a"),ge=r("span"),b(K.$$.fragment),st=p(),_e=r("span"),nt=n("Multistep DPM-Solver"),He=p(),T=r("h2"),A=r("a"),be=r("span"),b(B.$$.fragment),it=p(),Se=r("span"),at=n("Overview"),Ue=p(),v=r("p"),dt=n("Original paper can be found "),J=r("a"),lt=n("here"),pt=n(" and the "),R=r("a"),ct=n("improved version"),ut=n(". The original implementation can be found "),j=r("a"),ht=n("here"),mt=n("."),Ke=p(),F=r("h2"),N=r("a"),Me=r("span"),b(Q.$$.fragment),ft=p(),ye=r("span"),vt=n("DPMSolverMultistepScheduler"),Be=p(),l=r("div"),b(X.$$.fragment),gt=p(),De=r("p"),_t=n(`DPM-Solver (and the improved version DPM-Solver++) is a fast dedicated high-order solver for diffusion ODEs with
the convergence order guarantee. Empirically, sampling by DPM-Solver with only 20 steps can generate high-quality
samples, and it can generate quite good samples even in only 10 steps.`),bt=p(),I=r("p"),St=n("For more details, see the original paper: "),Y=r("a"),Mt=n("https://arxiv.org/abs/2206.00927"),yt=n(" and "),Z=r("a"),Dt=n("https://arxiv.org/abs/2211.01095"),Pt=p(),O=r("p"),xt=n(`Currently, we support the multistep DPM-Solver for both noise prediction models and data prediction models. We
recommend to use `),Pe=r("code"),wt=n("solver_order=2"),$t=n(" for guided sampling, and "),xe=r("code"),Et=n("solver_order=3"),Tt=n(" for unconditional sampling."),Ft=p(),_=r("p"),Ot=n("We also support the \u201Cdynamic thresholding\u201D method in Imagen ("),ee=r("a"),Ct=n("https://arxiv.org/abs/2205.11487"),At=n(`). For pixel-space
diffusion models, you can set both `),we=r("code"),Nt=n('algorithm_type="dpmsolver++"'),It=n(" and "),$e=r("code"),kt=n("thresholding=True"),Lt=n(` to use the dynamic
thresholding. Note that the thresholding method is unsuitable for latent-space diffusion models (such as
stable-diffusion).`),qt=p(),te=r("p"),Wt=n(`We also support the SDE variant of DPM-Solver and DPM-Solver++, which is a fast SDE solver for the reverse
diffusion SDE. Currently we only support the first-order and second-order solvers. We recommend using the
second-order `),Ee=r("code"),Vt=n("sde-dpmsolver++"),zt=n("."),Gt=p(),h=r("p"),ce=r("a"),Ht=n("~ConfigMixin"),Ut=n(" takes care of storing all config attributes that are passed in the scheduler\u2019s "),Te=r("code"),Kt=n("__init__"),Bt=n(`
function, such as `),Fe=r("code"),Jt=n("num_train_timesteps"),Rt=n(". They can be accessed via "),Oe=r("code"),jt=n("scheduler.config.num_train_timesteps"),Qt=n(`.
`),ue=r("a"),Xt=n("SchedulerMixin"),Yt=n(" provides general loading and saving functionality via the "),he=r("a"),Zt=n("SchedulerMixin.save_pretrained()"),er=n(` and
`),me=r("a"),tr=n("from_pretrained()"),rr=n(" functions."),or=p(),g=r("div"),b(re.$$.fragment),sr=p(),Ce=r("p"),nr=n("Convert the model output to the corresponding type that the algorithm (DPM-Solver / DPM-Solver++) needs."),ir=p(),Ae=r("p"),ar=n(`DPM-Solver is designed to discretize an integral of the noise prediction model, and DPM-Solver++ is designed to
discretize an integral of the data prediction model. So we need to first convert the model output to the
corresponding type to match the algorithm.`),dr=p(),Ne=r("p"),lr=n(`Note that the algorithm type and the model type is decoupled. That is to say, we can use either DPM-Solver or
DPM-Solver++ for both noise prediction model and data prediction model.`),pr=p(),x=r("div"),b(oe.$$.fragment),cr=p(),Ie=r("p"),ur=n("One step for the first-order DPM-Solver (equivalent to DDIM)."),hr=p(),se=r("p"),mr=n("See "),ne=r("a"),fr=n("https://arxiv.org/abs/2206.00927"),vr=n(" for the detailed derivation."),gr=p(),k=r("div"),b(ie.$$.fragment),_r=p(),ke=r("p"),br=n("One step for the second-order multistep DPM-Solver."),Sr=p(),L=r("div"),b(ae.$$.fragment),Mr=p(),Le=r("p"),yr=n("One step for the third-order multistep DPM-Solver."),Dr=p(),q=r("div"),b(de.$$.fragment),Pr=p(),qe=r("p"),xr=n(`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),wr=p(),W=r("div"),b(le.$$.fragment),$r=p(),We=r("p"),Er=n("Sets the timesteps used for the diffusion chain. Supporting function to be run before inference."),Tr=p(),V=r("div"),b(pe.$$.fragment),Fr=p(),Ve=r("p"),Or=n("Step function propagating the sample with the multistep DPM-Solver."),this.h()},l(s){const f=yo('[data-svelte="svelte-1phssyn"]',document.head);$=o(f,"META",{name:!0,content:!0}),f.forEach(t),Ge=c(s),E=o(s,"H1",{class:!0});var Re=i(E);C=o(Re,"A",{id:!0,class:!0,href:!0});var Nr=i(C);ge=o(Nr,"SPAN",{});var Ir=i(ge);S(K.$$.fragment,Ir),Ir.forEach(t),Nr.forEach(t),st=c(Re),_e=o(Re,"SPAN",{});var kr=i(_e);nt=a(kr,"Multistep DPM-Solver"),kr.forEach(t),Re.forEach(t),He=c(s),T=o(s,"H2",{class:!0});var je=i(T);A=o(je,"A",{id:!0,class:!0,href:!0});var Lr=i(A);be=o(Lr,"SPAN",{});var qr=i(be);S(B.$$.fragment,qr),qr.forEach(t),Lr.forEach(t),it=c(je),Se=o(je,"SPAN",{});var Wr=i(Se);at=a(Wr,"Overview"),Wr.forEach(t),je.forEach(t),Ue=c(s),v=o(s,"P",{});var z=i(v);dt=a(z,"Original paper can be found "),J=o(z,"A",{href:!0,rel:!0});var Vr=i(J);lt=a(Vr,"here"),Vr.forEach(t),pt=a(z," and the "),R=o(z,"A",{href:!0,rel:!0});var zr=i(R);ct=a(zr,"improved version"),zr.forEach(t),ut=a(z,". The original implementation can be found "),j=o(z,"A",{href:!0,rel:!0});var Gr=i(j);ht=a(Gr,"here"),Gr.forEach(t),mt=a(z,"."),z.forEach(t),Ke=c(s),F=o(s,"H2",{class:!0});var Qe=i(F);N=o(Qe,"A",{id:!0,class:!0,href:!0});var Hr=i(N);Me=o(Hr,"SPAN",{});var Ur=i(Me);S(Q.$$.fragment,Ur),Ur.forEach(t),Hr.forEach(t),ft=c(Qe),ye=o(Qe,"SPAN",{});var Kr=i(ye);vt=a(Kr,"DPMSolverMultistepScheduler"),Kr.forEach(t),Qe.forEach(t),Be=c(s),l=o(s,"DIV",{class:!0});var u=i(l);S(X.$$.fragment,u),gt=c(u),De=o(u,"P",{});var Br=i(De);_t=a(Br,`DPM-Solver (and the improved version DPM-Solver++) is a fast dedicated high-order solver for diffusion ODEs with
the convergence order guarantee. Empirically, sampling by DPM-Solver with only 20 steps can generate high-quality
samples, and it can generate quite good samples even in only 10 steps.`),Br.forEach(t),bt=c(u),I=o(u,"P",{});var ze=i(I);St=a(ze,"For more details, see the original paper: "),Y=o(ze,"A",{href:!0,rel:!0});var Jr=i(Y);Mt=a(Jr,"https://arxiv.org/abs/2206.00927"),Jr.forEach(t),yt=a(ze," and "),Z=o(ze,"A",{href:!0,rel:!0});var Rr=i(Z);Dt=a(Rr,"https://arxiv.org/abs/2211.01095"),Rr.forEach(t),ze.forEach(t),Pt=c(u),O=o(u,"P",{});var fe=i(O);xt=a(fe,`Currently, we support the multistep DPM-Solver for both noise prediction models and data prediction models. We
recommend to use `),Pe=o(fe,"CODE",{});var jr=i(Pe);wt=a(jr,"solver_order=2"),jr.forEach(t),$t=a(fe," for guided sampling, and "),xe=o(fe,"CODE",{});var Qr=i(xe);Et=a(Qr,"solver_order=3"),Qr.forEach(t),Tt=a(fe," for unconditional sampling."),fe.forEach(t),Ft=c(u),_=o(u,"P",{});var G=i(_);Ot=a(G,"We also support the \u201Cdynamic thresholding\u201D method in Imagen ("),ee=o(G,"A",{href:!0,rel:!0});var Xr=i(ee);Ct=a(Xr,"https://arxiv.org/abs/2205.11487"),Xr.forEach(t),At=a(G,`). For pixel-space
diffusion models, you can set both `),we=o(G,"CODE",{});var Yr=i(we);Nt=a(Yr,'algorithm_type="dpmsolver++"'),Yr.forEach(t),It=a(G," and "),$e=o(G,"CODE",{});var Zr=i($e);kt=a(Zr,"thresholding=True"),Zr.forEach(t),Lt=a(G,` to use the dynamic
thresholding. Note that the thresholding method is unsuitable for latent-space diffusion models (such as
stable-diffusion).`),G.forEach(t),qt=c(u),te=o(u,"P",{});var Xe=i(te);Wt=a(Xe,`We also support the SDE variant of DPM-Solver and DPM-Solver++, which is a fast SDE solver for the reverse
diffusion SDE. Currently we only support the first-order and second-order solvers. We recommend using the
second-order `),Ee=o(Xe,"CODE",{});var eo=i(Ee);Vt=a(eo,"sde-dpmsolver++"),eo.forEach(t),zt=a(Xe,"."),Xe.forEach(t),Gt=c(u),h=o(u,"P",{});var m=i(h);ce=o(m,"A",{href:!0});var to=i(ce);Ht=a(to,"~ConfigMixin"),to.forEach(t),Ut=a(m," takes care of storing all config attributes that are passed in the scheduler\u2019s "),Te=o(m,"CODE",{});var ro=i(Te);Kt=a(ro,"__init__"),ro.forEach(t),Bt=a(m,`
function, such as `),Fe=o(m,"CODE",{});var oo=i(Fe);Jt=a(oo,"num_train_timesteps"),oo.forEach(t),Rt=a(m,". They can be accessed via "),Oe=o(m,"CODE",{});var so=i(Oe);jt=a(so,"scheduler.config.num_train_timesteps"),so.forEach(t),Qt=a(m,`.
`),ue=o(m,"A",{href:!0});var no=i(ue);Xt=a(no,"SchedulerMixin"),no.forEach(t),Yt=a(m," provides general loading and saving functionality via the "),he=o(m,"A",{href:!0});var io=i(he);Zt=a(io,"SchedulerMixin.save_pretrained()"),io.forEach(t),er=a(m,` and
`),me=o(m,"A",{href:!0});var ao=i(me);tr=a(ao,"from_pretrained()"),ao.forEach(t),rr=a(m," functions."),m.forEach(t),or=c(u),g=o(u,"DIV",{class:!0});var H=i(g);S(re.$$.fragment,H),sr=c(H),Ce=o(H,"P",{});var lo=i(Ce);nr=a(lo,"Convert the model output to the corresponding type that the algorithm (DPM-Solver / DPM-Solver++) needs."),lo.forEach(t),ir=c(H),Ae=o(H,"P",{});var po=i(Ae);ar=a(po,`DPM-Solver is designed to discretize an integral of the noise prediction model, and DPM-Solver++ is designed to
discretize an integral of the data prediction model. So we need to first convert the model output to the
corresponding type to match the algorithm.`),po.forEach(t),dr=c(H),Ne=o(H,"P",{});var co=i(Ne);lr=a(co,`Note that the algorithm type and the model type is decoupled. That is to say, we can use either DPM-Solver or
DPM-Solver++ for both noise prediction model and data prediction model.`),co.forEach(t),H.forEach(t),pr=c(u),x=o(u,"DIV",{class:!0});var ve=i(x);S(oe.$$.fragment,ve),cr=c(ve),Ie=o(ve,"P",{});var uo=i(Ie);ur=a(uo,"One step for the first-order DPM-Solver (equivalent to DDIM)."),uo.forEach(t),hr=c(ve),se=o(ve,"P",{});var Ye=i(se);mr=a(Ye,"See "),ne=o(Ye,"A",{href:!0,rel:!0});var ho=i(ne);fr=a(ho,"https://arxiv.org/abs/2206.00927"),ho.forEach(t),vr=a(Ye," for the detailed derivation."),Ye.forEach(t),ve.forEach(t),gr=c(u),k=o(u,"DIV",{class:!0});var Ze=i(k);S(ie.$$.fragment,Ze),_r=c(Ze),ke=o(Ze,"P",{});var mo=i(ke);br=a(mo,"One step for the second-order multistep DPM-Solver."),mo.forEach(t),Ze.forEach(t),Sr=c(u),L=o(u,"DIV",{class:!0});var et=i(L);S(ae.$$.fragment,et),Mr=c(et),Le=o(et,"P",{});var fo=i(Le);yr=a(fo,"One step for the third-order multistep DPM-Solver."),fo.forEach(t),et.forEach(t),Dr=c(u),q=o(u,"DIV",{class:!0});var tt=i(q);S(de.$$.fragment,tt),Pr=c(tt),qe=o(tt,"P",{});var vo=i(qe);xr=a(vo,`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),vo.forEach(t),tt.forEach(t),wr=c(u),W=o(u,"DIV",{class:!0});var rt=i(W);S(le.$$.fragment,rt),$r=c(rt),We=o(rt,"P",{});var go=i(We);Er=a(go,"Sets the timesteps used for the diffusion chain. Supporting function to be run before inference."),go.forEach(t),rt.forEach(t),Tr=c(u),V=o(u,"DIV",{class:!0});var ot=i(V);S(pe.$$.fragment,ot),Fr=c(ot),Ve=o(ot,"P",{});var _o=i(Ve);Or=a(_o,"Step function propagating the sample with the multistep DPM-Solver."),_o.forEach(t),ot.forEach(t),u.forEach(t),this.h()},h(){d($,"name","hf:doc:metadata"),d($,"content",JSON.stringify(wo)),d(C,"id","multistep-dpmsolver"),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","#multistep-dpmsolver"),d(E,"class","relative group"),d(A,"id","overview"),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","#overview"),d(T,"class","relative group"),d(J,"href","https://arxiv.org/abs/2206.00927"),d(J,"rel","nofollow"),d(R,"href","https://arxiv.org/abs/2211.01095"),d(R,"rel","nofollow"),d(j,"href","https://github.com/LuChengTHU/dpm-solver"),d(j,"rel","nofollow"),d(N,"id","diffusers.DPMSolverMultistepScheduler"),d(N,"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(N,"href","#diffusers.DPMSolverMultistepScheduler"),d(F,"class","relative group"),d(Y,"href","https://arxiv.org/abs/2206.00927"),d(Y,"rel","nofollow"),d(Z,"href","https://arxiv.org/abs/2211.01095"),d(Z,"rel","nofollow"),d(ee,"href","https://arxiv.org/abs/2205.11487"),d(ee,"rel","nofollow"),d(ce,"href","/docs/diffusers/v0.17.1/en/api/configuration#diffusers.ConfigMixin"),d(ue,"href","/docs/diffusers/v0.17.1/en/api/schedulers/overview#diffusers.SchedulerMixin"),d(he,"href","/docs/diffusers/v0.17.1/en/api/schedulers/overview#diffusers.SchedulerMixin.save_pretrained"),d(me,"href","/docs/diffusers/v0.17.1/en/api/schedulers/overview#diffusers.SchedulerMixin.from_pretrained"),d(g,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ne,"href","https://arxiv.org/abs/2206.00927"),d(ne,"rel","nofollow"),d(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(W,"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(l,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(s,f){e(document.head,$),w(s,Ge,f),w(s,E,f),e(E,C),e(C,ge),M(K,ge,null),e(E,st),e(E,_e),e(_e,nt),w(s,He,f),w(s,T,f),e(T,A),e(A,be),M(B,be,null),e(T,it),e(T,Se),e(Se,at),w(s,Ue,f),w(s,v,f),e(v,dt),e(v,J),e(J,lt),e(v,pt),e(v,R),e(R,ct),e(v,ut),e(v,j),e(j,ht),e(v,mt),w(s,Ke,f),w(s,F,f),e(F,N),e(N,Me),M(Q,Me,null),e(F,ft),e(F,ye),e(ye,vt),w(s,Be,f),w(s,l,f),M(X,l,null),e(l,gt),e(l,De),e(De,_t),e(l,bt),e(l,I),e(I,St),e(I,Y),e(Y,Mt),e(I,yt),e(I,Z),e(Z,Dt),e(l,Pt),e(l,O),e(O,xt),e(O,Pe),e(Pe,wt),e(O,$t),e(O,xe),e(xe,Et),e(O,Tt),e(l,Ft),e(l,_),e(_,Ot),e(_,ee),e(ee,Ct),e(_,At),e(_,we),e(we,Nt),e(_,It),e(_,$e),e($e,kt),e(_,Lt),e(l,qt),e(l,te),e(te,Wt),e(te,Ee),e(Ee,Vt),e(te,zt),e(l,Gt),e(l,h),e(h,ce),e(ce,Ht),e(h,Ut),e(h,Te),e(Te,Kt),e(h,Bt),e(h,Fe),e(Fe,Jt),e(h,Rt),e(h,Oe),e(Oe,jt),e(h,Qt),e(h,ue),e(ue,Xt),e(h,Yt),e(h,he),e(he,Zt),e(h,er),e(h,me),e(me,tr),e(h,rr),e(l,or),e(l,g),M(re,g,null),e(g,sr),e(g,Ce),e(Ce,nr),e(g,ir),e(g,Ae),e(Ae,ar),e(g,dr),e(g,Ne),e(Ne,lr),e(l,pr),e(l,x),M(oe,x,null),e(x,cr),e(x,Ie),e(Ie,ur),e(x,hr),e(x,se),e(se,mr),e(se,ne),e(ne,fr),e(se,vr),e(l,gr),e(l,k),M(ie,k,null),e(k,_r),e(k,ke),e(ke,br),e(l,Sr),e(l,L),M(ae,L,null),e(L,Mr),e(L,Le),e(Le,yr),e(l,Dr),e(l,q),M(de,q,null),e(q,Pr),e(q,qe),e(qe,xr),e(l,wr),e(l,W),M(le,W,null),e(W,$r),e(W,We),e(We,Er),e(l,Tr),e(l,V),M(pe,V,null),e(V,Fr),e(V,Ve),e(Ve,Or),Je=!0},p:Do,i(s){Je||(y(K.$$.fragment,s),y(B.$$.fragment,s),y(Q.$$.fragment,s),y(X.$$.fragment,s),y(re.$$.fragment,s),y(oe.$$.fragment,s),y(ie.$$.fragment,s),y(ae.$$.fragment,s),y(de.$$.fragment,s),y(le.$$.fragment,s),y(pe.$$.fragment,s),Je=!0)},o(s){D(K.$$.fragment,s),D(B.$$.fragment,s),D(Q.$$.fragment,s),D(X.$$.fragment,s),D(re.$$.fragment,s),D(oe.$$.fragment,s),D(ie.$$.fragment,s),D(ae.$$.fragment,s),D(de.$$.fragment,s),D(le.$$.fragment,s),D(pe.$$.fragment,s),Je=!1},d(s){t($),s&&t(Ge),s&&t(E),P(K),s&&t(He),s&&t(T),P(B),s&&t(Ue),s&&t(v),s&&t(Ke),s&&t(F),P(Q),s&&t(Be),s&&t(l),P(X),P(re),P(oe),P(ie),P(ae),P(de),P(le),P(pe)}}}const wo={local:"multistep-dpmsolver",sections:[{local:"overview",title:"Overview"},{local:"diffusers.DPMSolverMultistepScheduler",title:"DPMSolverMultistepScheduler"}],title:"Multistep DPM-Solver"};function $o(Ar){return Po(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Oo extends bo{constructor($){super();So(this,$,$o,xo,Mo,{})}}export{Oo as default,wo as metadata};
