import{S as ks,i as qs,s as Vs,e as s,k as a,w as g,t as i,M as Ns,c as o,d as r,m as p,a as n,x as v,h as l,b as d,G as e,g as m,y as _,q as S,o as b,B as D,v as zs}from"../../../chunks/vendor-hf-doc-builder.js";import{T as Hs}from"../../../chunks/Tip-hf-doc-builder.js";import{D as T}from"../../../chunks/Docstring-hf-doc-builder.js";import{I as Tt}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function Bs(et){let f,k;return{c(){f=s("p"),k=i(`The algorithm and model type are decoupled. You can use either DPMSolver or DPMSolver++ for both noise
prediction and data prediction models.`)},l(P){f=o(P,"P",{});var $=n(f);k=l($,`The algorithm and model type are decoupled. You can use either DPMSolver or DPMSolver++ for both noise
prediction and data prediction models.`),$.forEach(r)},m(P,$){m(P,f,$),e(f,k)},d(P){P&&r(f)}}}function Js(et){let f,k,P,$,Ee,j,xt,we,Et,tt,M,Oe,wt,Ot,Q,Ft,Ct,X,At,Lt,rt,Se,It,st,q,kt,ee,qt,Vt,ot,w,V,Fe,te,Nt,Ce,zt,nt,x,Ht,Ae,Bt,Jt,Le,Ut,Gt,it,y,Wt,re,Yt,Zt,Ie,Kt,Rt,ke,jt,Qt,lt,O,N,qe,se,Xt,Ve,er,dt,c,oe,tr,be,Ne,rr,sr,or,F,nr,De,ir,lr,Pe,dr,ar,pr,E,ne,cr,ze,ur,hr,z,mr,H,ie,fr,He,gr,vr,B,le,_r,Be,Sr,br,J,de,Dr,Je,Pr,$r,U,ae,yr,Ue,Mr,Tr,G,pe,xr,C,Er,Ge,wr,Or,We,Fr,Cr,Ar,W,ce,Lr,A,Ir,Ye,kr,qr,Ze,Vr,Nr,zr,Y,ue,Hr,Ke,Br,Jr,Z,he,Ur,Re,Gr,at,L,K,je,me,Wr,Qe,Yr,pt,I,fe,Zr,ge,Kr,Xe,Rr,jr,ct;return j=new Tt({}),te=new Tt({}),se=new Tt({}),oe=new T({props:{name:"class diffusers.DPMSolverSinglestepScheduler",anchor:"diffusers.DPMSolverSinglestepScheduler",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 = '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.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.solver_order",description:`<strong>solver_order</strong> (<code>int</code>, defaults to 2) &#x2014;
The DPMSolver 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.DPMSolverSinglestepScheduler.prediction_type",description:`<strong>prediction_type</strong> (<code>str</code>, defaults to <code>epsilon</code>, <em>optional</em>) &#x2014;
Prediction type of the scheduler function; can be <code>epsilon</code> (predicts the noise of the diffusion process),
<code>sample</code> (directly predicts the noisy sample<code>) or </code>v_prediction\` (see section 2.4 of <a href="https://imagen.research.google/video/paper.pdf" rel="nofollow">Imagen
Video</a> paper).`,name:"prediction_type"},{anchor:"diffusers.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.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> and
<code>algorithm_type=&quot;dpmsolver++&quot;</code>.`,name:"sample_max_value"},{anchor:"diffusers.DPMSolverSinglestepScheduler.algorithm_type",description:`<strong>algorithm_type</strong> (<code>str</code>, defaults to <code>dpmsolver++</code>) &#x2014;
Algorithm type for the solver; can be <code>dpmsolver</code>, <code>dpmsolver++</code>, <code>sde-dpmsolver</code> or <code>sde-dpmsolver++</code>. The
<code>dpmsolver</code> type implements the algorithms in the <a href="https://huggingface.co/papers/2206.00927" rel="nofollow">DPMSolver</a>
paper, and the <code>dpmsolver++</code> type implements the algorithms in the
<a href="https://huggingface.co/papers/2211.01095" rel="nofollow">DPMSolver++</a> paper. It is recommended to use <code>dpmsolver++</code> or
<code>sde-dpmsolver++</code> with <code>solver_order=2</code> for guided sampling like in Stable Diffusion.`,name:"algorithm_type"},{anchor:"diffusers.DPMSolverSinglestepScheduler.solver_type",description:`<strong>solver_type</strong> (<code>str</code>, defaults to <code>midpoint</code>) &#x2014;
Solver type for the second-order solver; can be <code>midpoint</code> or <code>heun</code>. The solver type slightly affects the
sample quality, especially for a small number of steps. It is recommended to use <code>midpoint</code> solvers.`,name:"solver_type"},{anchor:"diffusers.DPMSolverSinglestepScheduler.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. This can
stabilize the sampling of DPMSolver for steps &lt; 15, especially for steps &lt;= 10.`,name:"lower_order_final"},{anchor:"diffusers.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.lambda_min_clipped",description:`<strong>lambda_min_clipped</strong> (<code>float</code>, defaults to <code>-inf</code>) &#x2014;
Clipping threshold for the minimum value of <code>lambda(t)</code> for numerical stability. This is critical for the
cosine (<code>squaredcos_cap_v2</code>) noise schedule.`,name:"lambda_min_clipped"},{anchor:"diffusers.DPMSolverSinglestepScheduler.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. If set, the model&#x2019;s output
contains the predicted Gaussian variance.`,name:"variance_type"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py#L76"}}),ne=new T({props:{name:"convert_model_output",anchor:"diffusers.DPMSolverSinglestepScheduler.convert_model_output",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"sample",val:": FloatTensor"}],parametersDescription:[{anchor:"diffusers.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.convert_model_output.timestep",description:`<strong>timestep</strong> (<code>int</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.DPMSolverSinglestepScheduler.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_dpmsolver_singlestep.py#L350",returnDescription:`
<p>The converted model output.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),z=new Hs({props:{$$slots:{default:[Bs]},$$scope:{ctx:et}}}),ie=new T({props:{name:"dpm_solver_first_order_update",anchor:"diffusers.DPMSolverSinglestepScheduler.dpm_solver_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.DPMSolverSinglestepScheduler.dpm_solver_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.DPMSolverSinglestepScheduler.dpm_solver_first_order_update.timestep",description:`<strong>timestep</strong> (<code>int</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.DPMSolverSinglestepScheduler.dpm_solver_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.DPMSolverSinglestepScheduler.dpm_solver_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_dpmsolver_singlestep.py#L421",returnDescription:`
<p>The sample tensor at the previous timestep.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),le=new T({props:{name:"get_order_list",anchor:"diffusers.DPMSolverSinglestepScheduler.get_order_list",parameters:[{name:"num_inference_steps",val:": int"}],parametersDescription:[{anchor:"diffusers.DPMSolverSinglestepScheduler.get_order_list.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"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py#L201"}}),de=new T({props:{name:"scale_model_input",anchor:"diffusers.DPMSolverSinglestepScheduler.scale_model_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.DPMSolverSinglestepScheduler.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_dpmsolver_singlestep.py#L698",returnDescription:`
<p>A scaled input sample.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),ae=new T({props:{name:"set_timesteps",anchor:"diffusers.DPMSolverSinglestepScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": typing.Union[str, torch.device] = None"}],parametersDescription:[{anchor:"diffusers.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.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_dpmsolver_singlestep.py#L235"}}),pe=new T({props:{name:"singlestep_dpm_solver_second_order_update",anchor:"diffusers.DPMSolverSinglestepScheduler.singlestep_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"}],parametersDescription:[{anchor:"diffusers.DPMSolverSinglestepScheduler.singlestep_dpm_solver_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.DPMSolverSinglestepScheduler.singlestep_dpm_solver_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.DPMSolverSinglestepScheduler.singlestep_dpm_solver_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.DPMSolverSinglestepScheduler.singlestep_dpm_solver_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_dpmsolver_singlestep.py#L455",returnDescription:`
<p>The sample tensor at the previous timestep.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),ce=new T({props:{name:"singlestep_dpm_solver_third_order_update",anchor:"diffusers.DPMSolverSinglestepScheduler.singlestep_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.DPMSolverSinglestepScheduler.singlestep_dpm_solver_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.DPMSolverSinglestepScheduler.singlestep_dpm_solver_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.DPMSolverSinglestepScheduler.singlestep_dpm_solver_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.DPMSolverSinglestepScheduler.singlestep_dpm_solver_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_dpmsolver_singlestep.py#L518",returnDescription:`
<p>The sample tensor at the previous timestep.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),ue=new T({props:{name:"singlestep_dpm_solver_update",anchor:"diffusers.DPMSolverSinglestepScheduler.singlestep_dpm_solver_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:"order",val:": int"}],parametersDescription:[{anchor:"diffusers.DPMSolverSinglestepScheduler.singlestep_dpm_solver_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.DPMSolverSinglestepScheduler.singlestep_dpm_solver_update.timestep",description:`<strong>timestep</strong> (<code>int</code>) &#x2014;
The current and latter discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.DPMSolverSinglestepScheduler.singlestep_dpm_solver_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.DPMSolverSinglestepScheduler.singlestep_dpm_solver_update.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
A current instance of a sample created by diffusion process.`,name:"sample"},{anchor:"diffusers.DPMSolverSinglestepScheduler.singlestep_dpm_solver_update.order",description:`<strong>order</strong> (<code>int</code>) &#x2014;
The solver order at this step.`,name:"order"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py#L591",returnDescription:`
<p>The sample tensor at the previous timestep.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),he=new T({props:{name:"step",anchor:"diffusers.DPMSolverSinglestepScheduler.step",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"sample",val:": FloatTensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.step.timestep",description:`<strong>timestep</strong> (<code>int</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.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_dpmsolver_singlestep.py#L631",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>
`}}),me=new Tt({}),fe=new T({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(){f=s("meta"),k=a(),P=s("h1"),$=s("a"),Ee=s("span"),g(j.$$.fragment),xt=a(),we=s("span"),Et=i("DPMSolverSinglestepScheduler"),tt=a(),M=s("p"),Oe=s("code"),wt=i("DPMSolverSinglestepScheduler"),Ot=i(" is a single step scheduler from "),Q=s("a"),Ft=i("DPM-Solver: A Fast ODE Solver for Diffusion Probabilistic Model Sampling in Around 10 Steps"),Ct=i(" and "),X=s("a"),At=i("DPM-Solver++: Fast Solver for Guided Sampling of Diffusion Probabilistic Models"),Lt=i(" by Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu."),rt=a(),Se=s("p"),It=i(`DPMSolver (and the improved version DPMSolver++) is a fast dedicated high-order solver for diffusion ODEs with convergence order guarantee. Empirically, DPMSolver sampling with only 20 steps can generate high-quality
samples, and it can generate quite good samples even in 10 steps.`),st=a(),q=s("p"),kt=i("The original implementation can be found at "),ee=s("a"),qt=i("LuChengTHU/dpm-solver"),Vt=i("."),ot=a(),w=s("h2"),V=s("a"),Fe=s("span"),g(te.$$.fragment),Nt=a(),Ce=s("span"),zt=i("Tips"),nt=a(),x=s("p"),Ht=i("It is recommended to set "),Ae=s("code"),Bt=i("solver_order"),Jt=i(" to 2 for guide sampling, and "),Le=s("code"),Ut=i("solver_order=3"),Gt=i(" for unconditional sampling."),it=a(),y=s("p"),Wt=i("Dynamic thresholding from Imagen ("),re=s("a"),Yt=i("https://huggingface.co/papers/2205.11487"),Zt=i(`) is supported, and for pixel-space
diffusion models, you can set both `),Ie=s("code"),Kt=i('algorithm_type="dpmsolver++"'),Rt=i(" and "),ke=s("code"),jt=i("thresholding=True"),Qt=i(` to use dynamic
thresholding. This thresholding method is unsuitable for latent-space diffusion models such as
Stable Diffusion.`),lt=a(),O=s("h2"),N=s("a"),qe=s("span"),g(se.$$.fragment),Xt=a(),Ve=s("span"),er=i("DPMSolverSinglestepScheduler"),dt=a(),c=s("div"),g(oe.$$.fragment),tr=a(),be=s("p"),Ne=s("code"),rr=i("DPMSolverSinglestepScheduler"),sr=i(" is a fast dedicated high-order solver for diffusion ODEs."),or=a(),F=s("p"),nr=i("This model inherits from "),De=s("a"),ir=i("SchedulerMixin"),lr=i(" and "),Pe=s("a"),dr=i("ConfigMixin"),ar=i(`. Check the superclass documentation for the generic
methods the library implements for all schedulers such as loading and saving.`),pr=a(),E=s("div"),g(ne.$$.fragment),cr=a(),ze=s("p"),ur=i(`Convert the model output to the corresponding type the DPMSolver/DPMSolver++ algorithm needs. 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.`),hr=a(),g(z.$$.fragment),mr=a(),H=s("div"),g(ie.$$.fragment),fr=a(),He=s("p"),gr=i("One step for the first-order DPMSolver (equivalent to DDIM)."),vr=a(),B=s("div"),g(le.$$.fragment),_r=a(),Be=s("p"),Sr=i("Computes the solver order at each time step."),br=a(),J=s("div"),g(de.$$.fragment),Dr=a(),Je=s("p"),Pr=i(`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),$r=a(),U=s("div"),g(ae.$$.fragment),yr=a(),Ue=s("p"),Mr=i("Sets the discrete timesteps used for the diffusion chain (to be run before inference)."),Tr=a(),G=s("div"),g(pe.$$.fragment),xr=a(),C=s("p"),Er=i("One step for the second-order singlestep DPMSolver that computes the solution at time "),Ge=s("code"),wr=i("prev_timestep"),Or=i(` from the
time `),We=s("code"),Fr=i("timestep_list[-2]"),Cr=i("."),Ar=a(),W=s("div"),g(ce.$$.fragment),Lr=a(),A=s("p"),Ir=i("One step for the third-order singlestep DPMSolver that computes the solution at time "),Ye=s("code"),kr=i("prev_timestep"),qr=i(` from the
time `),Ze=s("code"),Vr=i("timestep_list[-3]"),Nr=i("."),zr=a(),Y=s("div"),g(ue.$$.fragment),Hr=a(),Ke=s("p"),Br=i("One step for the singlestep DPMSolver."),Jr=a(),Z=s("div"),g(he.$$.fragment),Ur=a(),Re=s("p"),Gr=i(`Predict the sample from the previous timestep by reversing the SDE. This function propagates the sample with
the singlestep DPMSolver.`),at=a(),L=s("h2"),K=s("a"),je=s("span"),g(me.$$.fragment),Wr=a(),Qe=s("span"),Yr=i("SchedulerOutput"),pt=a(),I=s("div"),g(fe.$$.fragment),Zr=a(),ge=s("p"),Kr=i("Base class for the output of a scheduler\u2019s "),Xe=s("code"),Rr=i("step"),jr=i(" function."),this.h()},l(t){const u=Ns('[data-svelte="svelte-1phssyn"]',document.head);f=o(u,"META",{name:!0,content:!0}),u.forEach(r),k=p(t),P=o(t,"H1",{class:!0});var ve=n(P);$=o(ve,"A",{id:!0,class:!0,href:!0});var Xr=n($);Ee=o(Xr,"SPAN",{});var es=n(Ee);v(j.$$.fragment,es),es.forEach(r),Xr.forEach(r),xt=p(ve),we=o(ve,"SPAN",{});var ts=n(we);Et=l(ts,"DPMSolverSinglestepScheduler"),ts.forEach(r),ve.forEach(r),tt=p(t),M=o(t,"P",{});var _e=n(M);Oe=o(_e,"CODE",{});var rs=n(Oe);wt=l(rs,"DPMSolverSinglestepScheduler"),rs.forEach(r),Ot=l(_e," is a single step scheduler from "),Q=o(_e,"A",{href:!0,rel:!0});var ss=n(Q);Ft=l(ss,"DPM-Solver: A Fast ODE Solver for Diffusion Probabilistic Model Sampling in Around 10 Steps"),ss.forEach(r),Ct=l(_e," and "),X=o(_e,"A",{href:!0,rel:!0});var os=n(X);At=l(os,"DPM-Solver++: Fast Solver for Guided Sampling of Diffusion Probabilistic Models"),os.forEach(r),Lt=l(_e," by Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu."),_e.forEach(r),rt=p(t),Se=o(t,"P",{});var ns=n(Se);It=l(ns,`DPMSolver (and the improved version DPMSolver++) is a fast dedicated high-order solver for diffusion ODEs with convergence order guarantee. Empirically, DPMSolver sampling with only 20 steps can generate high-quality
samples, and it can generate quite good samples even in 10 steps.`),ns.forEach(r),st=p(t),q=o(t,"P",{});var ut=n(q);kt=l(ut,"The original implementation can be found at "),ee=o(ut,"A",{href:!0,rel:!0});var is=n(ee);qt=l(is,"LuChengTHU/dpm-solver"),is.forEach(r),Vt=l(ut,"."),ut.forEach(r),ot=p(t),w=o(t,"H2",{class:!0});var ht=n(w);V=o(ht,"A",{id:!0,class:!0,href:!0});var ls=n(V);Fe=o(ls,"SPAN",{});var ds=n(Fe);v(te.$$.fragment,ds),ds.forEach(r),ls.forEach(r),Nt=p(ht),Ce=o(ht,"SPAN",{});var as=n(Ce);zt=l(as,"Tips"),as.forEach(r),ht.forEach(r),nt=p(t),x=o(t,"P",{});var $e=n(x);Ht=l($e,"It is recommended to set "),Ae=o($e,"CODE",{});var ps=n(Ae);Bt=l(ps,"solver_order"),ps.forEach(r),Jt=l($e," to 2 for guide sampling, and "),Le=o($e,"CODE",{});var cs=n(Le);Ut=l(cs,"solver_order=3"),cs.forEach(r),Gt=l($e," for unconditional sampling."),$e.forEach(r),it=p(t),y=o(t,"P",{});var R=n(y);Wt=l(R,"Dynamic thresholding from Imagen ("),re=o(R,"A",{href:!0,rel:!0});var us=n(re);Yt=l(us,"https://huggingface.co/papers/2205.11487"),us.forEach(r),Zt=l(R,`) is supported, and for pixel-space
diffusion models, you can set both `),Ie=o(R,"CODE",{});var hs=n(Ie);Kt=l(hs,'algorithm_type="dpmsolver++"'),hs.forEach(r),Rt=l(R," and "),ke=o(R,"CODE",{});var ms=n(ke);jt=l(ms,"thresholding=True"),ms.forEach(r),Qt=l(R,` to use dynamic
thresholding. This thresholding method is unsuitable for latent-space diffusion models such as
Stable Diffusion.`),R.forEach(r),lt=p(t),O=o(t,"H2",{class:!0});var mt=n(O);N=o(mt,"A",{id:!0,class:!0,href:!0});var fs=n(N);qe=o(fs,"SPAN",{});var gs=n(qe);v(se.$$.fragment,gs),gs.forEach(r),fs.forEach(r),Xt=p(mt),Ve=o(mt,"SPAN",{});var vs=n(Ve);er=l(vs,"DPMSolverSinglestepScheduler"),vs.forEach(r),mt.forEach(r),dt=p(t),c=o(t,"DIV",{class:!0});var h=n(c);v(oe.$$.fragment,h),tr=p(h),be=o(h,"P",{});var Qr=n(be);Ne=o(Qr,"CODE",{});var _s=n(Ne);rr=l(_s,"DPMSolverSinglestepScheduler"),_s.forEach(r),sr=l(Qr," is a fast dedicated high-order solver for diffusion ODEs."),Qr.forEach(r),or=p(h),F=o(h,"P",{});var ye=n(F);nr=l(ye,"This model inherits from "),De=o(ye,"A",{href:!0});var Ss=n(De);ir=l(Ss,"SchedulerMixin"),Ss.forEach(r),lr=l(ye," and "),Pe=o(ye,"A",{href:!0});var bs=n(Pe);dr=l(bs,"ConfigMixin"),bs.forEach(r),ar=l(ye,`. Check the superclass documentation for the generic
methods the library implements for all schedulers such as loading and saving.`),ye.forEach(r),pr=p(h),E=o(h,"DIV",{class:!0});var Me=n(E);v(ne.$$.fragment,Me),cr=p(Me),ze=o(Me,"P",{});var Ds=n(ze);ur=l(Ds,`Convert the model output to the corresponding type the DPMSolver/DPMSolver++ algorithm needs. 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.`),Ds.forEach(r),hr=p(Me),v(z.$$.fragment,Me),Me.forEach(r),mr=p(h),H=o(h,"DIV",{class:!0});var ft=n(H);v(ie.$$.fragment,ft),fr=p(ft),He=o(ft,"P",{});var Ps=n(He);gr=l(Ps,"One step for the first-order DPMSolver (equivalent to DDIM)."),Ps.forEach(r),ft.forEach(r),vr=p(h),B=o(h,"DIV",{class:!0});var gt=n(B);v(le.$$.fragment,gt),_r=p(gt),Be=o(gt,"P",{});var $s=n(Be);Sr=l($s,"Computes the solver order at each time step."),$s.forEach(r),gt.forEach(r),br=p(h),J=o(h,"DIV",{class:!0});var vt=n(J);v(de.$$.fragment,vt),Dr=p(vt),Je=o(vt,"P",{});var ys=n(Je);Pr=l(ys,`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),ys.forEach(r),vt.forEach(r),$r=p(h),U=o(h,"DIV",{class:!0});var _t=n(U);v(ae.$$.fragment,_t),yr=p(_t),Ue=o(_t,"P",{});var Ms=n(Ue);Mr=l(Ms,"Sets the discrete timesteps used for the diffusion chain (to be run before inference)."),Ms.forEach(r),_t.forEach(r),Tr=p(h),G=o(h,"DIV",{class:!0});var St=n(G);v(pe.$$.fragment,St),xr=p(St),C=o(St,"P",{});var Te=n(C);Er=l(Te,"One step for the second-order singlestep DPMSolver that computes the solution at time "),Ge=o(Te,"CODE",{});var Ts=n(Ge);wr=l(Ts,"prev_timestep"),Ts.forEach(r),Or=l(Te,` from the
time `),We=o(Te,"CODE",{});var xs=n(We);Fr=l(xs,"timestep_list[-2]"),xs.forEach(r),Cr=l(Te,"."),Te.forEach(r),St.forEach(r),Ar=p(h),W=o(h,"DIV",{class:!0});var bt=n(W);v(ce.$$.fragment,bt),Lr=p(bt),A=o(bt,"P",{});var xe=n(A);Ir=l(xe,"One step for the third-order singlestep DPMSolver that computes the solution at time "),Ye=o(xe,"CODE",{});var Es=n(Ye);kr=l(Es,"prev_timestep"),Es.forEach(r),qr=l(xe,` from the
time `),Ze=o(xe,"CODE",{});var ws=n(Ze);Vr=l(ws,"timestep_list[-3]"),ws.forEach(r),Nr=l(xe,"."),xe.forEach(r),bt.forEach(r),zr=p(h),Y=o(h,"DIV",{class:!0});var Dt=n(Y);v(ue.$$.fragment,Dt),Hr=p(Dt),Ke=o(Dt,"P",{});var Os=n(Ke);Br=l(Os,"One step for the singlestep DPMSolver."),Os.forEach(r),Dt.forEach(r),Jr=p(h),Z=o(h,"DIV",{class:!0});var Pt=n(Z);v(he.$$.fragment,Pt),Ur=p(Pt),Re=o(Pt,"P",{});var Fs=n(Re);Gr=l(Fs,`Predict the sample from the previous timestep by reversing the SDE. This function propagates the sample with
the singlestep DPMSolver.`),Fs.forEach(r),Pt.forEach(r),h.forEach(r),at=p(t),L=o(t,"H2",{class:!0});var $t=n(L);K=o($t,"A",{id:!0,class:!0,href:!0});var Cs=n(K);je=o(Cs,"SPAN",{});var As=n(je);v(me.$$.fragment,As),As.forEach(r),Cs.forEach(r),Wr=p($t),Qe=o($t,"SPAN",{});var Ls=n(Qe);Yr=l(Ls,"SchedulerOutput"),Ls.forEach(r),$t.forEach(r),pt=p(t),I=o(t,"DIV",{class:!0});var yt=n(I);v(fe.$$.fragment,yt),Zr=p(yt),ge=o(yt,"P",{});var Mt=n(ge);Kr=l(Mt,"Base class for the output of a scheduler\u2019s "),Xe=o(Mt,"CODE",{});var Is=n(Xe);Rr=l(Is,"step"),Is.forEach(r),jr=l(Mt," function."),Mt.forEach(r),yt.forEach(r),this.h()},h(){d(f,"name","hf:doc:metadata"),d(f,"content",JSON.stringify(Us)),d($,"id","dpmsolversinglestepscheduler"),d($,"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($,"href","#dpmsolversinglestepscheduler"),d(P,"class","relative group"),d(Q,"href","https://huggingface.co/papers/2206.00927"),d(Q,"rel","nofollow"),d(X,"href","https://huggingface.co/papers/2211.01095"),d(X,"rel","nofollow"),d(ee,"href","https://github.com/LuChengTHU/dpm-solver"),d(ee,"rel","nofollow"),d(V,"id","tips"),d(V,"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(V,"href","#tips"),d(w,"class","relative group"),d(re,"href","https://huggingface.co/papers/2205.11487"),d(re,"rel","nofollow"),d(N,"id","diffusers.DPMSolverSinglestepScheduler"),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.DPMSolverSinglestepScheduler"),d(O,"class","relative group"),d(De,"href","/docs/diffusers/v0.20.0/en/api/schedulers/overview#diffusers.SchedulerMixin"),d(Pe,"href","/docs/diffusers/v0.20.0/en/api/configuration#diffusers.ConfigMixin"),d(E,"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(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(J,"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(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(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(Y,"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(c,"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,"id","diffusers.schedulers.scheduling_utils.SchedulerOutput"),d(K,"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(K,"href","#diffusers.schedulers.scheduling_utils.SchedulerOutput"),d(L,"class","relative group"),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")},m(t,u){e(document.head,f),m(t,k,u),m(t,P,u),e(P,$),e($,Ee),_(j,Ee,null),e(P,xt),e(P,we),e(we,Et),m(t,tt,u),m(t,M,u),e(M,Oe),e(Oe,wt),e(M,Ot),e(M,Q),e(Q,Ft),e(M,Ct),e(M,X),e(X,At),e(M,Lt),m(t,rt,u),m(t,Se,u),e(Se,It),m(t,st,u),m(t,q,u),e(q,kt),e(q,ee),e(ee,qt),e(q,Vt),m(t,ot,u),m(t,w,u),e(w,V),e(V,Fe),_(te,Fe,null),e(w,Nt),e(w,Ce),e(Ce,zt),m(t,nt,u),m(t,x,u),e(x,Ht),e(x,Ae),e(Ae,Bt),e(x,Jt),e(x,Le),e(Le,Ut),e(x,Gt),m(t,it,u),m(t,y,u),e(y,Wt),e(y,re),e(re,Yt),e(y,Zt),e(y,Ie),e(Ie,Kt),e(y,Rt),e(y,ke),e(ke,jt),e(y,Qt),m(t,lt,u),m(t,O,u),e(O,N),e(N,qe),_(se,qe,null),e(O,Xt),e(O,Ve),e(Ve,er),m(t,dt,u),m(t,c,u),_(oe,c,null),e(c,tr),e(c,be),e(be,Ne),e(Ne,rr),e(be,sr),e(c,or),e(c,F),e(F,nr),e(F,De),e(De,ir),e(F,lr),e(F,Pe),e(Pe,dr),e(F,ar),e(c,pr),e(c,E),_(ne,E,null),e(E,cr),e(E,ze),e(ze,ur),e(E,hr),_(z,E,null),e(c,mr),e(c,H),_(ie,H,null),e(H,fr),e(H,He),e(He,gr),e(c,vr),e(c,B),_(le,B,null),e(B,_r),e(B,Be),e(Be,Sr),e(c,br),e(c,J),_(de,J,null),e(J,Dr),e(J,Je),e(Je,Pr),e(c,$r),e(c,U),_(ae,U,null),e(U,yr),e(U,Ue),e(Ue,Mr),e(c,Tr),e(c,G),_(pe,G,null),e(G,xr),e(G,C),e(C,Er),e(C,Ge),e(Ge,wr),e(C,Or),e(C,We),e(We,Fr),e(C,Cr),e(c,Ar),e(c,W),_(ce,W,null),e(W,Lr),e(W,A),e(A,Ir),e(A,Ye),e(Ye,kr),e(A,qr),e(A,Ze),e(Ze,Vr),e(A,Nr),e(c,zr),e(c,Y),_(ue,Y,null),e(Y,Hr),e(Y,Ke),e(Ke,Br),e(c,Jr),e(c,Z),_(he,Z,null),e(Z,Ur),e(Z,Re),e(Re,Gr),m(t,at,u),m(t,L,u),e(L,K),e(K,je),_(me,je,null),e(L,Wr),e(L,Qe),e(Qe,Yr),m(t,pt,u),m(t,I,u),_(fe,I,null),e(I,Zr),e(I,ge),e(ge,Kr),e(ge,Xe),e(Xe,Rr),e(ge,jr),ct=!0},p(t,[u]){const ve={};u&2&&(ve.$$scope={dirty:u,ctx:t}),z.$set(ve)},i(t){ct||(S(j.$$.fragment,t),S(te.$$.fragment,t),S(se.$$.fragment,t),S(oe.$$.fragment,t),S(ne.$$.fragment,t),S(z.$$.fragment,t),S(ie.$$.fragment,t),S(le.$$.fragment,t),S(de.$$.fragment,t),S(ae.$$.fragment,t),S(pe.$$.fragment,t),S(ce.$$.fragment,t),S(ue.$$.fragment,t),S(he.$$.fragment,t),S(me.$$.fragment,t),S(fe.$$.fragment,t),ct=!0)},o(t){b(j.$$.fragment,t),b(te.$$.fragment,t),b(se.$$.fragment,t),b(oe.$$.fragment,t),b(ne.$$.fragment,t),b(z.$$.fragment,t),b(ie.$$.fragment,t),b(le.$$.fragment,t),b(de.$$.fragment,t),b(ae.$$.fragment,t),b(pe.$$.fragment,t),b(ce.$$.fragment,t),b(ue.$$.fragment,t),b(he.$$.fragment,t),b(me.$$.fragment,t),b(fe.$$.fragment,t),ct=!1},d(t){r(f),t&&r(k),t&&r(P),D(j),t&&r(tt),t&&r(M),t&&r(rt),t&&r(Se),t&&r(st),t&&r(q),t&&r(ot),t&&r(w),D(te),t&&r(nt),t&&r(x),t&&r(it),t&&r(y),t&&r(lt),t&&r(O),D(se),t&&r(dt),t&&r(c),D(oe),D(ne),D(z),D(ie),D(le),D(de),D(ae),D(pe),D(ce),D(ue),D(he),t&&r(at),t&&r(L),D(me),t&&r(pt),t&&r(I),D(fe)}}}const Us={local:"dpmsolversinglestepscheduler",sections:[{local:"tips",title:"Tips"},{local:"diffusers.DPMSolverSinglestepScheduler",title:"DPMSolverSinglestepScheduler"},{local:"diffusers.schedulers.scheduling_utils.SchedulerOutput",title:"SchedulerOutput"}],title:"DPMSolverSinglestepScheduler"};function Gs(et){return zs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Rs extends ks{constructor(f){super();qs(this,f,Gs,Js,Vs,{})}}export{Rs as default,Us as metadata};
