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,R,it,Se,at,Ue,v,dt,B,lt,pt,J,ct,ut,Y,ht,mt,Ke,F,N,Me,j,ft,ye,vt,Re,l,Q,gt,De,_t,bt,k,St,X,Mt,yt,Z,Dt,Pt,O,xt,Pe,wt,$t,xe,Et,Tt,Ft,_,Ot,ee,Ct,At,we,Nt,kt,$e,It,Lt,qt,te,Wt,Ee,Vt,zt,Gt,h,ce,Ht,Ut,Te,Kt,Rt,Fe,Bt,Jt,Oe,Yt,jt,ue,Qt,Xt,he,Zt,er,me,tr,rr,or,g,re,sr,Ce,nr,ir,Ae,ar,dr,Ne,lr,pr,x,oe,cr,ke,ur,hr,se,mr,ne,fr,vr,gr,I,ie,_r,Ie,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,Be;return K=new Cr({}),R=new Cr({}),j=new Cr({}),Q=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"},{name:"timestep_spacing",val:": str = 'linspace'"},{name:"steps_offset",val:": int = 0"}],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"},{anchor:"diffusers.DPMSolverMultistepScheduler.timestep_spacing",description:`<strong>timestep_spacing</strong> (<code>str</code>, default <code>&quot;linspace&quot;</code>) &#x2014;
The way the timesteps should be scaled. Refer to Table 2. of <a href="https://arxiv.org/abs/2305.08891" rel="nofollow">Common Diffusion Noise Schedules and Sample
Steps are Flawed</a> for more information.`,name:"timestep_spacing"},{anchor:"diffusers.DPMSolverMultistepScheduler.steps_offset",description:`<strong>steps_offset</strong> (<code>int</code>, default <code>0</code>) &#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, as done in
stable diffusion.`,name:"steps_offset"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py#L73"}}),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.18.0/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py#L364",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.18.0/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py#L439",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.18.0/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py#L486",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.18.0/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py#L578",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.18.0/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py#L711",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.18.0/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py#L231"}}),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.18.0/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py#L633",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(R.$$.fragment),it=p(),Se=r("span"),at=n("Overview"),Ue=p(),v=r("p"),dt=n("Original paper can be found "),B=r("a"),lt=n("here"),pt=n(" and the "),J=r("a"),ct=n("improved version"),ut=n(". The original implementation can be found "),Y=r("a"),ht=n("here"),mt=n("."),Ke=p(),F=r("h2"),N=r("a"),Me=r("span"),b(j.$$.fragment),ft=p(),ye=r("span"),vt=n("DPMSolverMultistepScheduler"),Re=p(),l=r("div"),b(Q.$$.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(),k=r("p"),St=n("For more details, see the original paper: "),X=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++"'),kt=n(" and "),$e=r("code"),It=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__"),Rt=n(`
function, such as `),Fe=r("code"),Bt=n("num_train_timesteps"),Jt=n(". They can be accessed via "),Oe=r("code"),Yt=n("scheduler.config.num_train_timesteps"),jt=n(`.
`),ue=r("a"),Qt=n("SchedulerMixin"),Xt=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(),ke=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(),I=r("div"),b(ie.$$.fragment),_r=p(),Ie=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 Je=i(E);C=o(Je,"A",{id:!0,class:!0,href:!0});var Nr=i(C);ge=o(Nr,"SPAN",{});var kr=i(ge);S(K.$$.fragment,kr),kr.forEach(t),Nr.forEach(t),st=c(Je),_e=o(Je,"SPAN",{});var Ir=i(_e);nt=a(Ir,"Multistep DPM-Solver"),Ir.forEach(t),Je.forEach(t),He=c(s),T=o(s,"H2",{class:!0});var Ye=i(T);A=o(Ye,"A",{id:!0,class:!0,href:!0});var Lr=i(A);be=o(Lr,"SPAN",{});var qr=i(be);S(R.$$.fragment,qr),qr.forEach(t),Lr.forEach(t),it=c(Ye),Se=o(Ye,"SPAN",{});var Wr=i(Se);at=a(Wr,"Overview"),Wr.forEach(t),Ye.forEach(t),Ue=c(s),v=o(s,"P",{});var z=i(v);dt=a(z,"Original paper can be found "),B=o(z,"A",{href:!0,rel:!0});var Vr=i(B);lt=a(Vr,"here"),Vr.forEach(t),pt=a(z," and the "),J=o(z,"A",{href:!0,rel:!0});var zr=i(J);ct=a(zr,"improved version"),zr.forEach(t),ut=a(z,". The original implementation can be found "),Y=o(z,"A",{href:!0,rel:!0});var Gr=i(Y);ht=a(Gr,"here"),Gr.forEach(t),mt=a(z,"."),z.forEach(t),Ke=c(s),F=o(s,"H2",{class:!0});var je=i(F);N=o(je,"A",{id:!0,class:!0,href:!0});var Hr=i(N);Me=o(Hr,"SPAN",{});var Ur=i(Me);S(j.$$.fragment,Ur),Ur.forEach(t),Hr.forEach(t),ft=c(je),ye=o(je,"SPAN",{});var Kr=i(ye);vt=a(Kr,"DPMSolverMultistepScheduler"),Kr.forEach(t),je.forEach(t),Re=c(s),l=o(s,"DIV",{class:!0});var u=i(l);S(Q.$$.fragment,u),gt=c(u),De=o(u,"P",{});var Rr=i(De);_t=a(Rr,`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.`),Rr.forEach(t),bt=c(u),k=o(u,"P",{});var ze=i(k);St=a(ze,"For more details, see the original paper: "),X=o(ze,"A",{href:!0,rel:!0});var Br=i(X);Mt=a(Br,"https://arxiv.org/abs/2206.00927"),Br.forEach(t),yt=a(ze," and "),Z=o(ze,"A",{href:!0,rel:!0});var Jr=i(Z);Dt=a(Jr,"https://arxiv.org/abs/2211.01095"),Jr.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 Yr=i(Pe);wt=a(Yr,"solver_order=2"),Yr.forEach(t),$t=a(fe," for guided sampling, and "),xe=o(fe,"CODE",{});var jr=i(xe);Et=a(jr,"solver_order=3"),jr.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 Qr=i(ee);Ct=a(Qr,"https://arxiv.org/abs/2205.11487"),Qr.forEach(t),At=a(G,`). For pixel-space
diffusion models, you can set both `),we=o(G,"CODE",{});var Xr=i(we);Nt=a(Xr,'algorithm_type="dpmsolver++"'),Xr.forEach(t),kt=a(G," and "),$e=o(G,"CODE",{});var Zr=i($e);It=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 Qe=i(te);Wt=a(Qe,`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(Qe,"CODE",{});var eo=i(Ee);Vt=a(eo,"sde-dpmsolver++"),eo.forEach(t),zt=a(Qe,"."),Qe.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),Rt=a(m,`
function, such as `),Fe=o(m,"CODE",{});var oo=i(Fe);Bt=a(oo,"num_train_timesteps"),oo.forEach(t),Jt=a(m,". They can be accessed via "),Oe=o(m,"CODE",{});var so=i(Oe);Yt=a(so,"scheduler.config.num_train_timesteps"),so.forEach(t),jt=a(m,`.
`),ue=o(m,"A",{href:!0});var no=i(ue);Qt=a(no,"SchedulerMixin"),no.forEach(t),Xt=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),ke=o(ve,"P",{});var uo=i(ke);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 Xe=i(se);mr=a(Xe,"See "),ne=o(Xe,"A",{href:!0,rel:!0});var ho=i(ne);fr=a(ho,"https://arxiv.org/abs/2206.00927"),ho.forEach(t),vr=a(Xe," for the detailed derivation."),Xe.forEach(t),ve.forEach(t),gr=c(u),I=o(u,"DIV",{class:!0});var Ze=i(I);S(ie.$$.fragment,Ze),_r=c(Ze),Ie=o(Ze,"P",{});var mo=i(Ie);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(B,"href","https://arxiv.org/abs/2206.00927"),d(B,"rel","nofollow"),d(J,"href","https://arxiv.org/abs/2211.01095"),d(J,"rel","nofollow"),d(Y,"href","https://github.com/LuChengTHU/dpm-solver"),d(Y,"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(X,"href","https://arxiv.org/abs/2206.00927"),d(X,"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.18.0/en/api/configuration#diffusers.ConfigMixin"),d(ue,"href","/docs/diffusers/v0.18.0/en/api/schedulers/overview#diffusers.SchedulerMixin"),d(he,"href","/docs/diffusers/v0.18.0/en/api/schedulers/overview#diffusers.SchedulerMixin.save_pretrained"),d(me,"href","/docs/diffusers/v0.18.0/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(I,"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(R,be,null),e(T,it),e(T,Se),e(Se,at),w(s,Ue,f),w(s,v,f),e(v,dt),e(v,B),e(B,lt),e(v,pt),e(v,J),e(J,ct),e(v,ut),e(v,Y),e(Y,ht),e(v,mt),w(s,Ke,f),w(s,F,f),e(F,N),e(N,Me),M(j,Me,null),e(F,ft),e(F,ye),e(ye,vt),w(s,Re,f),w(s,l,f),M(Q,l,null),e(l,gt),e(l,De),e(De,_t),e(l,bt),e(l,k),e(k,St),e(k,X),e(X,Mt),e(k,yt),e(k,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(_,kt),e(_,$e),e($e,It),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,Rt),e(h,Fe),e(Fe,Bt),e(h,Jt),e(h,Oe),e(Oe,Yt),e(h,jt),e(h,ue),e(ue,Qt),e(h,Xt),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,ke),e(ke,ur),e(x,hr),e(x,se),e(se,mr),e(se,ne),e(ne,fr),e(se,vr),e(l,gr),e(l,I),M(ie,I,null),e(I,_r),e(I,Ie),e(Ie,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),Be=!0},p:Do,i(s){Be||(y(K.$$.fragment,s),y(R.$$.fragment,s),y(j.$$.fragment,s),y(Q.$$.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),Be=!0)},o(s){D(K.$$.fragment,s),D(R.$$.fragment,s),D(j.$$.fragment,s),D(Q.$$.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),Be=!1},d(s){t($),s&&t(Ge),s&&t(E),P(K),s&&t(He),s&&t(T),P(R),s&&t(Ue),s&&t(v),s&&t(Ke),s&&t(F),P(j),s&&t(Re),s&&t(l),P(Q),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};
