import{S as Xo,i as Yo,s as Zo,e as r,k as l,w as g,t as o,M as es,c as s,d as t,m as p,a as i,x as v,h as n,b as d,G as e,g as E,y as _,L as ts,q as S,o as b,B as D,v as rs}from"../../../chunks/vendor-hf-doc-builder.js";import{D as T}from"../../../chunks/Docstring-hf-doc-builder.js";import{I as no}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function os(io){let F,rt,O,q,$e,j,vt,we,_t,ot,C,N,Ee,Q,St,Te,bt,st,y,Dt,X,yt,Pt,Y,xt,Mt,Z,$t,wt,nt,I,V,Fe,ee,Et,Oe,Tt,it,c,te,Ft,Ce,Ot,Ct,W,It,re,At,Lt,oe,kt,qt,A,Nt,Ie,Vt,Wt,Ae,zt,Gt,Ht,x,Ut,se,Kt,Bt,Le,Jt,Rt,ke,jt,Qt,Xt,u,ge,Yt,Zt,qe,er,tr,Ne,rr,or,Ve,sr,nr,ve,ir,ar,_e,dr,lr,Se,pr,cr,hr,P,ne,ur,We,mr,fr,ze,gr,vr,Ge,_r,Sr,M,ie,br,He,Dr,yr,ae,Pr,de,xr,Mr,$r,z,le,wr,Ue,Er,Tr,G,pe,Fr,Ke,Or,Cr,H,ce,Ir,Be,Ar,Lr,$,he,kr,Je,qr,Nr,L,Vr,Re,Wr,zr,je,Gr,Hr,Ur,w,ue,Kr,Qe,Br,Jr,k,Rr,Xe,jr,Qr,Ye,Xr,Yr,Zr,U,me,eo,Ze,to,ro,K,fe,oo,et,so,at;return j=new no({}),Q=new no({}),ee=new no({}),te=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>) &#x2014; number of diffusion steps used to train the model.",name:"num_train_timesteps"},{anchor:"diffusers.DPMSolverSinglestepScheduler.beta_start",description:"<strong>beta_start</strong> (<code>float</code>) &#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>) &#x2014; the final <code>beta</code> value.",name:"beta_end"},{anchor:"diffusers.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.prediction_type",description:`<strong>prediction_type</strong> (<code>str</code>, default <code>epsilon</code>) &#x2014;
indicates whether the model predicts the noise (epsilon), or the data / <code>x0</code>. One of <code>epsilon</code>, <code>sample</code>,
or <code>v-prediction</code>.`,name:"prediction_type"},{anchor:"diffusers.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.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>. 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> with <code>solver_order=2</code> for guided
sampling (e.g. stable-diffusion).`,name:"algorithm_type"},{anchor:"diffusers.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.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. For singlestep schedulers, we recommend to enable
this to use up all the function evaluations.`,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;
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.DPMSolverSinglestepScheduler.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.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. 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_singlestep.py#L61"}}),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; direct output from learned diffusion model.",name:"model_output"},{anchor:"diffusers.DPMSolverSinglestepScheduler.convert_model_output.timestep",description:"<strong>timestep</strong> (<code>int</code>) &#x2014; 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;
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_singlestep.py#L354",returnDescription:`
<p>the converted model output.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),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; direct output from learned diffusion model.",name:"model_output"},{anchor:"diffusers.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.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.DPMSolverSinglestepScheduler.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_singlestep.py#L420",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.17.1/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py#L207"}}),pe=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; input sample",name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py#L683",returnDescription:`
<p>scaled input sample</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),ce=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>, 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_singlestep.py#L241"}}),he=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;
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; 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; 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;
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_singlestep.py#L452",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_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;
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; 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; 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;
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_singlestep.py#L513",returnDescription:`
<p>the sample tensor at the previous timestep.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),me=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;
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; 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; 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;
current instance of sample being 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.17.1/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py#L584",returnDescription:`
<p>the sample tensor at the previous timestep.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),fe=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; direct output from learned diffusion model.",name:"model_output"},{anchor:"diffusers.DPMSolverSinglestepScheduler.step.timestep",description:"<strong>timestep</strong> (<code>int</code>) &#x2014; current discrete timestep in the diffusion chain.",name:"timestep"},{anchor:"diffusers.DPMSolverSinglestepScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
current instance of sample being created by diffusion process.`,name:"sample"},{anchor:"diffusers.DPMSolverSinglestepScheduler.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_singlestep.py#L621",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(){F=r("meta"),rt=l(),O=r("h1"),q=r("a"),$e=r("span"),g(j.$$.fragment),vt=l(),we=r("span"),_t=o("Singlestep DPM-Solver"),ot=l(),C=r("h2"),N=r("a"),Ee=r("span"),g(Q.$$.fragment),St=l(),Te=r("span"),bt=o("Overview"),st=l(),y=r("p"),Dt=o("Original paper can be found "),X=r("a"),yt=o("here"),Pt=o(" and the "),Y=r("a"),xt=o("improved version"),Mt=o(". The original implementation can be found "),Z=r("a"),$t=o("here"),wt=o("."),nt=l(),I=r("h2"),V=r("a"),Fe=r("span"),g(ee.$$.fragment),Et=l(),Oe=r("span"),Tt=o("DPMSolverSinglestepScheduler"),it=l(),c=r("div"),g(te.$$.fragment),Ft=l(),Ce=r("p"),Ot=o(`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.`),Ct=l(),W=r("p"),It=o("For more details, see the original paper: "),re=r("a"),At=o("https://arxiv.org/abs/2206.00927"),Lt=o(" and "),oe=r("a"),kt=o("https://arxiv.org/abs/2211.01095"),qt=l(),A=r("p"),Nt=o(`Currently, we support the singlestep DPM-Solver for both noise prediction models and data prediction models. We
recommend to use `),Ie=r("code"),Vt=o("solver_order=2"),Wt=o(" for guided sampling, and "),Ae=r("code"),zt=o("solver_order=3"),Gt=o(" for unconditional sampling."),Ht=l(),x=r("p"),Ut=o("We also support the \u201Cdynamic thresholding\u201D method in Imagen ("),se=r("a"),Kt=o("https://arxiv.org/abs/2205.11487"),Bt=o(`). For pixel-space
diffusion models, you can set both `),Le=r("code"),Jt=o('algorithm_type="dpmsolver++"'),Rt=o(" and "),ke=r("code"),jt=o("thresholding=True"),Qt=o(` to use the dynamic
thresholding. Note that the thresholding method is unsuitable for latent-space diffusion models (such as
stable-diffusion).`),Xt=l(),u=r("p"),ge=r("a"),Yt=o("~ConfigMixin"),Zt=o(" takes care of storing all config attributes that are passed in the scheduler\u2019s "),qe=r("code"),er=o("__init__"),tr=o(`
function, such as `),Ne=r("code"),rr=o("num_train_timesteps"),or=o(". They can be accessed via "),Ve=r("code"),sr=o("scheduler.config.num_train_timesteps"),nr=o(`.
`),ve=r("a"),ir=o("SchedulerMixin"),ar=o(" provides general loading and saving functionality via the "),_e=r("a"),dr=o("SchedulerMixin.save_pretrained()"),lr=o(` and
`),Se=r("a"),pr=o("from_pretrained()"),cr=o(" functions."),hr=l(),P=r("div"),g(ne.$$.fragment),ur=l(),We=r("p"),mr=o("Convert the model output to the corresponding type that the algorithm (DPM-Solver / DPM-Solver++) needs."),fr=l(),ze=r("p"),gr=o(`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.`),vr=l(),Ge=r("p"),_r=o(`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.`),Sr=l(),M=r("div"),g(ie.$$.fragment),br=l(),He=r("p"),Dr=o("One step for the first-order DPM-Solver (equivalent to DDIM)."),yr=l(),ae=r("p"),Pr=o("See "),de=r("a"),xr=o("https://arxiv.org/abs/2206.00927"),Mr=o(" for the detailed derivation."),$r=l(),z=r("div"),g(le.$$.fragment),wr=l(),Ue=r("p"),Er=o("Computes the solver order at each time step."),Tr=l(),G=r("div"),g(pe.$$.fragment),Fr=l(),Ke=r("p"),Or=o(`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),Cr=l(),H=r("div"),g(ce.$$.fragment),Ir=l(),Be=r("p"),Ar=o("Sets the timesteps used for the diffusion chain. Supporting function to be run before inference."),Lr=l(),$=r("div"),g(he.$$.fragment),kr=l(),Je=r("p"),qr=o("One step for the second-order singlestep DPM-Solver."),Nr=l(),L=r("p"),Vr=o("It computes the solution at time "),Re=r("code"),Wr=o("prev_timestep"),zr=o(" from the time "),je=r("code"),Gr=o("timestep_list[-2]"),Hr=o("."),Ur=l(),w=r("div"),g(ue.$$.fragment),Kr=l(),Qe=r("p"),Br=o("One step for the third-order singlestep DPM-Solver."),Jr=l(),k=r("p"),Rr=o("It computes the solution at time "),Xe=r("code"),jr=o("prev_timestep"),Qr=o(" from the time "),Ye=r("code"),Xr=o("timestep_list[-3]"),Yr=o("."),Zr=l(),U=r("div"),g(me.$$.fragment),eo=l(),Ze=r("p"),to=o("One step for the singlestep DPM-Solver."),ro=l(),K=r("div"),g(fe.$$.fragment),oo=l(),et=r("p"),so=o("Step function propagating the sample with the singlestep DPM-Solver."),this.h()},l(a){const f=es('[data-svelte="svelte-1phssyn"]',document.head);F=s(f,"META",{name:!0,content:!0}),f.forEach(t),rt=p(a),O=s(a,"H1",{class:!0});var dt=i(O);q=s(dt,"A",{id:!0,class:!0,href:!0});var ao=i(q);$e=s(ao,"SPAN",{});var lo=i($e);v(j.$$.fragment,lo),lo.forEach(t),ao.forEach(t),vt=p(dt),we=s(dt,"SPAN",{});var po=i(we);_t=n(po,"Singlestep DPM-Solver"),po.forEach(t),dt.forEach(t),ot=p(a),C=s(a,"H2",{class:!0});var lt=i(C);N=s(lt,"A",{id:!0,class:!0,href:!0});var co=i(N);Ee=s(co,"SPAN",{});var ho=i(Ee);v(Q.$$.fragment,ho),ho.forEach(t),co.forEach(t),St=p(lt),Te=s(lt,"SPAN",{});var uo=i(Te);bt=n(uo,"Overview"),uo.forEach(t),lt.forEach(t),st=p(a),y=s(a,"P",{});var B=i(y);Dt=n(B,"Original paper can be found "),X=s(B,"A",{href:!0,rel:!0});var mo=i(X);yt=n(mo,"here"),mo.forEach(t),Pt=n(B," and the "),Y=s(B,"A",{href:!0,rel:!0});var fo=i(Y);xt=n(fo,"improved version"),fo.forEach(t),Mt=n(B,". The original implementation can be found "),Z=s(B,"A",{href:!0,rel:!0});var go=i(Z);$t=n(go,"here"),go.forEach(t),wt=n(B,"."),B.forEach(t),nt=p(a),I=s(a,"H2",{class:!0});var pt=i(I);V=s(pt,"A",{id:!0,class:!0,href:!0});var vo=i(V);Fe=s(vo,"SPAN",{});var _o=i(Fe);v(ee.$$.fragment,_o),_o.forEach(t),vo.forEach(t),Et=p(pt),Oe=s(pt,"SPAN",{});var So=i(Oe);Tt=n(So,"DPMSolverSinglestepScheduler"),So.forEach(t),pt.forEach(t),it=p(a),c=s(a,"DIV",{class:!0});var h=i(c);v(te.$$.fragment,h),Ft=p(h),Ce=s(h,"P",{});var bo=i(Ce);Ot=n(bo,`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.`),bo.forEach(t),Ct=p(h),W=s(h,"P",{});var tt=i(W);It=n(tt,"For more details, see the original paper: "),re=s(tt,"A",{href:!0,rel:!0});var Do=i(re);At=n(Do,"https://arxiv.org/abs/2206.00927"),Do.forEach(t),Lt=n(tt," and "),oe=s(tt,"A",{href:!0,rel:!0});var yo=i(oe);kt=n(yo,"https://arxiv.org/abs/2211.01095"),yo.forEach(t),tt.forEach(t),qt=p(h),A=s(h,"P",{});var be=i(A);Nt=n(be,`Currently, we support the singlestep DPM-Solver for both noise prediction models and data prediction models. We
recommend to use `),Ie=s(be,"CODE",{});var Po=i(Ie);Vt=n(Po,"solver_order=2"),Po.forEach(t),Wt=n(be," for guided sampling, and "),Ae=s(be,"CODE",{});var xo=i(Ae);zt=n(xo,"solver_order=3"),xo.forEach(t),Gt=n(be," for unconditional sampling."),be.forEach(t),Ht=p(h),x=s(h,"P",{});var J=i(x);Ut=n(J,"We also support the \u201Cdynamic thresholding\u201D method in Imagen ("),se=s(J,"A",{href:!0,rel:!0});var Mo=i(se);Kt=n(Mo,"https://arxiv.org/abs/2205.11487"),Mo.forEach(t),Bt=n(J,`). For pixel-space
diffusion models, you can set both `),Le=s(J,"CODE",{});var $o=i(Le);Jt=n($o,'algorithm_type="dpmsolver++"'),$o.forEach(t),Rt=n(J," and "),ke=s(J,"CODE",{});var wo=i(ke);jt=n(wo,"thresholding=True"),wo.forEach(t),Qt=n(J,` to use the dynamic
thresholding. Note that the thresholding method is unsuitable for latent-space diffusion models (such as
stable-diffusion).`),J.forEach(t),Xt=p(h),u=s(h,"P",{});var m=i(u);ge=s(m,"A",{href:!0});var Eo=i(ge);Yt=n(Eo,"~ConfigMixin"),Eo.forEach(t),Zt=n(m," takes care of storing all config attributes that are passed in the scheduler\u2019s "),qe=s(m,"CODE",{});var To=i(qe);er=n(To,"__init__"),To.forEach(t),tr=n(m,`
function, such as `),Ne=s(m,"CODE",{});var Fo=i(Ne);rr=n(Fo,"num_train_timesteps"),Fo.forEach(t),or=n(m,". They can be accessed via "),Ve=s(m,"CODE",{});var Oo=i(Ve);sr=n(Oo,"scheduler.config.num_train_timesteps"),Oo.forEach(t),nr=n(m,`.
`),ve=s(m,"A",{href:!0});var Co=i(ve);ir=n(Co,"SchedulerMixin"),Co.forEach(t),ar=n(m," provides general loading and saving functionality via the "),_e=s(m,"A",{href:!0});var Io=i(_e);dr=n(Io,"SchedulerMixin.save_pretrained()"),Io.forEach(t),lr=n(m,` and
`),Se=s(m,"A",{href:!0});var Ao=i(Se);pr=n(Ao,"from_pretrained()"),Ao.forEach(t),cr=n(m," functions."),m.forEach(t),hr=p(h),P=s(h,"DIV",{class:!0});var R=i(P);v(ne.$$.fragment,R),ur=p(R),We=s(R,"P",{});var Lo=i(We);mr=n(Lo,"Convert the model output to the corresponding type that the algorithm (DPM-Solver / DPM-Solver++) needs."),Lo.forEach(t),fr=p(R),ze=s(R,"P",{});var ko=i(ze);gr=n(ko,`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.`),ko.forEach(t),vr=p(R),Ge=s(R,"P",{});var qo=i(Ge);_r=n(qo,`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.`),qo.forEach(t),R.forEach(t),Sr=p(h),M=s(h,"DIV",{class:!0});var De=i(M);v(ie.$$.fragment,De),br=p(De),He=s(De,"P",{});var No=i(He);Dr=n(No,"One step for the first-order DPM-Solver (equivalent to DDIM)."),No.forEach(t),yr=p(De),ae=s(De,"P",{});var ct=i(ae);Pr=n(ct,"See "),de=s(ct,"A",{href:!0,rel:!0});var Vo=i(de);xr=n(Vo,"https://arxiv.org/abs/2206.00927"),Vo.forEach(t),Mr=n(ct," for the detailed derivation."),ct.forEach(t),De.forEach(t),$r=p(h),z=s(h,"DIV",{class:!0});var ht=i(z);v(le.$$.fragment,ht),wr=p(ht),Ue=s(ht,"P",{});var Wo=i(Ue);Er=n(Wo,"Computes the solver order at each time step."),Wo.forEach(t),ht.forEach(t),Tr=p(h),G=s(h,"DIV",{class:!0});var ut=i(G);v(pe.$$.fragment,ut),Fr=p(ut),Ke=s(ut,"P",{});var zo=i(Ke);Or=n(zo,`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),zo.forEach(t),ut.forEach(t),Cr=p(h),H=s(h,"DIV",{class:!0});var mt=i(H);v(ce.$$.fragment,mt),Ir=p(mt),Be=s(mt,"P",{});var Go=i(Be);Ar=n(Go,"Sets the timesteps used for the diffusion chain. Supporting function to be run before inference."),Go.forEach(t),mt.forEach(t),Lr=p(h),$=s(h,"DIV",{class:!0});var ye=i($);v(he.$$.fragment,ye),kr=p(ye),Je=s(ye,"P",{});var Ho=i(Je);qr=n(Ho,"One step for the second-order singlestep DPM-Solver."),Ho.forEach(t),Nr=p(ye),L=s(ye,"P",{});var Pe=i(L);Vr=n(Pe,"It computes the solution at time "),Re=s(Pe,"CODE",{});var Uo=i(Re);Wr=n(Uo,"prev_timestep"),Uo.forEach(t),zr=n(Pe," from the time "),je=s(Pe,"CODE",{});var Ko=i(je);Gr=n(Ko,"timestep_list[-2]"),Ko.forEach(t),Hr=n(Pe,"."),Pe.forEach(t),ye.forEach(t),Ur=p(h),w=s(h,"DIV",{class:!0});var xe=i(w);v(ue.$$.fragment,xe),Kr=p(xe),Qe=s(xe,"P",{});var Bo=i(Qe);Br=n(Bo,"One step for the third-order singlestep DPM-Solver."),Bo.forEach(t),Jr=p(xe),k=s(xe,"P",{});var Me=i(k);Rr=n(Me,"It computes the solution at time "),Xe=s(Me,"CODE",{});var Jo=i(Xe);jr=n(Jo,"prev_timestep"),Jo.forEach(t),Qr=n(Me," from the time "),Ye=s(Me,"CODE",{});var Ro=i(Ye);Xr=n(Ro,"timestep_list[-3]"),Ro.forEach(t),Yr=n(Me,"."),Me.forEach(t),xe.forEach(t),Zr=p(h),U=s(h,"DIV",{class:!0});var ft=i(U);v(me.$$.fragment,ft),eo=p(ft),Ze=s(ft,"P",{});var jo=i(Ze);to=n(jo,"One step for the singlestep DPM-Solver."),jo.forEach(t),ft.forEach(t),ro=p(h),K=s(h,"DIV",{class:!0});var gt=i(K);v(fe.$$.fragment,gt),oo=p(gt),et=s(gt,"P",{});var Qo=i(et);so=n(Qo,"Step function propagating the sample with the singlestep DPM-Solver."),Qo.forEach(t),gt.forEach(t),h.forEach(t),this.h()},h(){d(F,"name","hf:doc:metadata"),d(F,"content",JSON.stringify(ss)),d(q,"id","singlestep-dpmsolver"),d(q,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(q,"href","#singlestep-dpmsolver"),d(O,"class","relative group"),d(N,"id","overview"),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","#overview"),d(C,"class","relative group"),d(X,"href","https://arxiv.org/abs/2206.00927"),d(X,"rel","nofollow"),d(Y,"href","https://arxiv.org/abs/2211.01095"),d(Y,"rel","nofollow"),d(Z,"href","https://github.com/LuChengTHU/dpm-solver"),d(Z,"rel","nofollow"),d(V,"id","diffusers.DPMSolverSinglestepScheduler"),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","#diffusers.DPMSolverSinglestepScheduler"),d(I,"class","relative group"),d(re,"href","https://arxiv.org/abs/2206.00927"),d(re,"rel","nofollow"),d(oe,"href","https://arxiv.org/abs/2211.01095"),d(oe,"rel","nofollow"),d(se,"href","https://arxiv.org/abs/2205.11487"),d(se,"rel","nofollow"),d(ge,"href","/docs/diffusers/v0.17.1/en/api/configuration#diffusers.ConfigMixin"),d(ve,"href","/docs/diffusers/v0.17.1/en/api/schedulers/overview#diffusers.SchedulerMixin"),d(_e,"href","/docs/diffusers/v0.17.1/en/api/schedulers/overview#diffusers.SchedulerMixin.save_pretrained"),d(Se,"href","/docs/diffusers/v0.17.1/en/api/schedulers/overview#diffusers.SchedulerMixin.from_pretrained"),d(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(de,"href","https://arxiv.org/abs/2206.00927"),d(de,"rel","nofollow"),d(M,"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(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(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($,"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(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(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(c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(a,f){e(document.head,F),E(a,rt,f),E(a,O,f),e(O,q),e(q,$e),_(j,$e,null),e(O,vt),e(O,we),e(we,_t),E(a,ot,f),E(a,C,f),e(C,N),e(N,Ee),_(Q,Ee,null),e(C,St),e(C,Te),e(Te,bt),E(a,st,f),E(a,y,f),e(y,Dt),e(y,X),e(X,yt),e(y,Pt),e(y,Y),e(Y,xt),e(y,Mt),e(y,Z),e(Z,$t),e(y,wt),E(a,nt,f),E(a,I,f),e(I,V),e(V,Fe),_(ee,Fe,null),e(I,Et),e(I,Oe),e(Oe,Tt),E(a,it,f),E(a,c,f),_(te,c,null),e(c,Ft),e(c,Ce),e(Ce,Ot),e(c,Ct),e(c,W),e(W,It),e(W,re),e(re,At),e(W,Lt),e(W,oe),e(oe,kt),e(c,qt),e(c,A),e(A,Nt),e(A,Ie),e(Ie,Vt),e(A,Wt),e(A,Ae),e(Ae,zt),e(A,Gt),e(c,Ht),e(c,x),e(x,Ut),e(x,se),e(se,Kt),e(x,Bt),e(x,Le),e(Le,Jt),e(x,Rt),e(x,ke),e(ke,jt),e(x,Qt),e(c,Xt),e(c,u),e(u,ge),e(ge,Yt),e(u,Zt),e(u,qe),e(qe,er),e(u,tr),e(u,Ne),e(Ne,rr),e(u,or),e(u,Ve),e(Ve,sr),e(u,nr),e(u,ve),e(ve,ir),e(u,ar),e(u,_e),e(_e,dr),e(u,lr),e(u,Se),e(Se,pr),e(u,cr),e(c,hr),e(c,P),_(ne,P,null),e(P,ur),e(P,We),e(We,mr),e(P,fr),e(P,ze),e(ze,gr),e(P,vr),e(P,Ge),e(Ge,_r),e(c,Sr),e(c,M),_(ie,M,null),e(M,br),e(M,He),e(He,Dr),e(M,yr),e(M,ae),e(ae,Pr),e(ae,de),e(de,xr),e(ae,Mr),e(c,$r),e(c,z),_(le,z,null),e(z,wr),e(z,Ue),e(Ue,Er),e(c,Tr),e(c,G),_(pe,G,null),e(G,Fr),e(G,Ke),e(Ke,Or),e(c,Cr),e(c,H),_(ce,H,null),e(H,Ir),e(H,Be),e(Be,Ar),e(c,Lr),e(c,$),_(he,$,null),e($,kr),e($,Je),e(Je,qr),e($,Nr),e($,L),e(L,Vr),e(L,Re),e(Re,Wr),e(L,zr),e(L,je),e(je,Gr),e(L,Hr),e(c,Ur),e(c,w),_(ue,w,null),e(w,Kr),e(w,Qe),e(Qe,Br),e(w,Jr),e(w,k),e(k,Rr),e(k,Xe),e(Xe,jr),e(k,Qr),e(k,Ye),e(Ye,Xr),e(k,Yr),e(c,Zr),e(c,U),_(me,U,null),e(U,eo),e(U,Ze),e(Ze,to),e(c,ro),e(c,K),_(fe,K,null),e(K,oo),e(K,et),e(et,so),at=!0},p:ts,i(a){at||(S(j.$$.fragment,a),S(Q.$$.fragment,a),S(ee.$$.fragment,a),S(te.$$.fragment,a),S(ne.$$.fragment,a),S(ie.$$.fragment,a),S(le.$$.fragment,a),S(pe.$$.fragment,a),S(ce.$$.fragment,a),S(he.$$.fragment,a),S(ue.$$.fragment,a),S(me.$$.fragment,a),S(fe.$$.fragment,a),at=!0)},o(a){b(j.$$.fragment,a),b(Q.$$.fragment,a),b(ee.$$.fragment,a),b(te.$$.fragment,a),b(ne.$$.fragment,a),b(ie.$$.fragment,a),b(le.$$.fragment,a),b(pe.$$.fragment,a),b(ce.$$.fragment,a),b(he.$$.fragment,a),b(ue.$$.fragment,a),b(me.$$.fragment,a),b(fe.$$.fragment,a),at=!1},d(a){t(F),a&&t(rt),a&&t(O),D(j),a&&t(ot),a&&t(C),D(Q),a&&t(st),a&&t(y),a&&t(nt),a&&t(I),D(ee),a&&t(it),a&&t(c),D(te),D(ne),D(ie),D(le),D(pe),D(ce),D(he),D(ue),D(me),D(fe)}}}const ss={local:"singlestep-dpmsolver",sections:[{local:"overview",title:"Overview"},{local:"diffusers.DPMSolverSinglestepScheduler",title:"DPMSolverSinglestepScheduler"}],title:"Singlestep DPM-Solver"};function ns(io){return rs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ls extends Xo{constructor(F){super();Yo(this,F,ns,os,Zo,{})}}export{ls as default,ss as metadata};
