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 a,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,k,xe,K,vt,we,_t,ot,C,q,Ee,Q,St,Te,bt,st,y,Dt,X,yt,Pt,Y,Mt,$t,Z,xt,wt,nt,I,V,Fe,ee,Et,Oe,Tt,it,c,te,Ft,Ce,Ot,Ct,W,It,re,Lt,At,oe,Nt,kt,L,qt,Ie,Vt,Wt,Le,zt,Ht,Ut,M,Bt,se,Gt,Jt,Ae,Rt,jt,Ne,Kt,Qt,Xt,u,ge,Yt,Zt,ke,er,tr,qe,rr,or,Ve,sr,nr,ve,ir,dr,_e,ar,lr,Se,pr,cr,hr,P,ne,ur,We,mr,fr,ze,gr,vr,He,_r,Sr,$,ie,br,Ue,Dr,yr,de,Pr,ae,Mr,$r,xr,z,le,wr,Be,Er,Tr,H,pe,Fr,Ge,Or,Cr,U,ce,Ir,Je,Lr,Ar,x,he,Nr,Re,kr,qr,A,Vr,je,Wr,zr,Ke,Hr,Ur,Br,w,ue,Gr,Qe,Jr,Rr,N,jr,Xe,Kr,Qr,Ye,Xr,Yr,Zr,B,me,eo,Ze,to,ro,G,fe,oo,et,so,dt;return K=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"}],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"}],source:"https://github.com/huggingface/diffusers/blob/v0.12.0/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py#L56"}}),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.12.0/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py#L239",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.12.0/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py#L310",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.12.0/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py#L183"}}),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.12.0/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py#L567",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.12.0/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py#L217"}}),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.12.0/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py#L342",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.12.0/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py#L403",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.12.0/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py#L474",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.12.0/src/diffusers/schedulers/scheduling_dpmsolver_singlestep.py#L511",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"),k=r("a"),xe=r("span"),g(K.$$.fragment),vt=l(),we=r("span"),_t=o("Singlestep DPM-Solver"),ot=l(),C=r("h2"),q=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"),Mt=o("improved version"),$t=o(". The original implementation can be found "),Z=r("a"),xt=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"),Lt=o("https://arxiv.org/abs/2206.00927"),At=o(" and "),oe=r("a"),Nt=o("https://arxiv.org/abs/2211.01095"),kt=l(),L=r("p"),qt=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 "),Le=r("code"),zt=o("solver_order=3"),Ht=o(" for unconditional sampling."),Ut=l(),M=r("p"),Bt=o("We also support the \u201Cdynamic thresholding\u201D method in Imagen ("),se=r("a"),Gt=o("https://arxiv.org/abs/2205.11487"),Jt=o(`). For pixel-space
diffusion models, you can set both `),Ae=r("code"),Rt=o('algorithm_type="dpmsolver++"'),jt=o(" and "),Ne=r("code"),Kt=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 "),ke=r("code"),er=o("__init__"),tr=o(`
function, such as `),qe=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"),dr=o(" provides general loading and saving functionality via the "),_e=r("a"),ar=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(),He=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(),$=r("div"),g(ie.$$.fragment),br=l(),Ue=r("p"),Dr=o("One step for the first-order DPM-Solver (equivalent to DDIM)."),yr=l(),de=r("p"),Pr=o("See "),ae=r("a"),Mr=o("https://arxiv.org/abs/2206.00927"),$r=o(" for the detailed derivation."),xr=l(),z=r("div"),g(le.$$.fragment),wr=l(),Be=r("p"),Er=o("Computes the solver order at each time step."),Tr=l(),H=r("div"),g(pe.$$.fragment),Fr=l(),Ge=r("p"),Or=o(`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),Cr=l(),U=r("div"),g(ce.$$.fragment),Ir=l(),Je=r("p"),Lr=o("Sets the timesteps used for the diffusion chain. Supporting function to be run before inference."),Ar=l(),x=r("div"),g(he.$$.fragment),Nr=l(),Re=r("p"),kr=o("One step for the second-order singlestep DPM-Solver."),qr=l(),A=r("p"),Vr=o("It computes the solution at time "),je=r("code"),Wr=o("prev_timestep"),zr=o(" from the time "),Ke=r("code"),Hr=o("timestep_list[-2]"),Ur=o("."),Br=l(),w=r("div"),g(ue.$$.fragment),Gr=l(),Qe=r("p"),Jr=o("One step for the third-order singlestep DPM-Solver."),Rr=l(),N=r("p"),jr=o("It computes the solution at time "),Xe=r("code"),Kr=o("prev_timestep"),Qr=o(" from the time "),Ye=r("code"),Xr=o("timestep_list[-3]"),Yr=o("."),Zr=l(),B=r("div"),g(me.$$.fragment),eo=l(),Ze=r("p"),to=o("One step for the singlestep DPM-Solver."),ro=l(),G=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(d){const f=es('[data-svelte="svelte-1phssyn"]',document.head);F=s(f,"META",{name:!0,content:!0}),f.forEach(t),rt=p(d),O=s(d,"H1",{class:!0});var at=i(O);k=s(at,"A",{id:!0,class:!0,href:!0});var ao=i(k);xe=s(ao,"SPAN",{});var lo=i(xe);v(K.$$.fragment,lo),lo.forEach(t),ao.forEach(t),vt=p(at),we=s(at,"SPAN",{});var po=i(we);_t=n(po,"Singlestep DPM-Solver"),po.forEach(t),at.forEach(t),ot=p(d),C=s(d,"H2",{class:!0});var lt=i(C);q=s(lt,"A",{id:!0,class:!0,href:!0});var co=i(q);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(d),y=s(d,"P",{});var J=i(y);Dt=n(J,"Original paper can be found "),X=s(J,"A",{href:!0,rel:!0});var mo=i(X);yt=n(mo,"here"),mo.forEach(t),Pt=n(J," and the "),Y=s(J,"A",{href:!0,rel:!0});var fo=i(Y);Mt=n(fo,"improved version"),fo.forEach(t),$t=n(J,". The original implementation can be found "),Z=s(J,"A",{href:!0,rel:!0});var go=i(Z);xt=n(go,"here"),go.forEach(t),wt=n(J,"."),J.forEach(t),nt=p(d),I=s(d,"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(d),c=s(d,"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);Lt=n(Do,"https://arxiv.org/abs/2206.00927"),Do.forEach(t),At=n(tt," and "),oe=s(tt,"A",{href:!0,rel:!0});var yo=i(oe);Nt=n(yo,"https://arxiv.org/abs/2211.01095"),yo.forEach(t),tt.forEach(t),kt=p(h),L=s(h,"P",{});var be=i(L);qt=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 "),Le=s(be,"CODE",{});var Mo=i(Le);zt=n(Mo,"solver_order=3"),Mo.forEach(t),Ht=n(be," for unconditional sampling."),be.forEach(t),Ut=p(h),M=s(h,"P",{});var R=i(M);Bt=n(R,"We also support the \u201Cdynamic thresholding\u201D method in Imagen ("),se=s(R,"A",{href:!0,rel:!0});var $o=i(se);Gt=n($o,"https://arxiv.org/abs/2205.11487"),$o.forEach(t),Jt=n(R,`). For pixel-space
diffusion models, you can set both `),Ae=s(R,"CODE",{});var xo=i(Ae);Rt=n(xo,'algorithm_type="dpmsolver++"'),xo.forEach(t),jt=n(R," and "),Ne=s(R,"CODE",{});var wo=i(Ne);Kt=n(wo,"thresholding=True"),wo.forEach(t),Qt=n(R,` to use the dynamic
thresholding. Note that the thresholding method is unsuitable for latent-space diffusion models (such as
stable-diffusion).`),R.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 "),ke=s(m,"CODE",{});var To=i(ke);er=n(To,"__init__"),To.forEach(t),tr=n(m,`
function, such as `),qe=s(m,"CODE",{});var Fo=i(qe);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),dr=n(m," provides general loading and saving functionality via the "),_e=s(m,"A",{href:!0});var Io=i(_e);ar=n(Io,"SchedulerMixin.save_pretrained()"),Io.forEach(t),lr=n(m,` and
`),Se=s(m,"A",{href:!0});var Lo=i(Se);pr=n(Lo,"from_pretrained()"),Lo.forEach(t),cr=n(m," functions."),m.forEach(t),hr=p(h),P=s(h,"DIV",{class:!0});var j=i(P);v(ne.$$.fragment,j),ur=p(j),We=s(j,"P",{});var Ao=i(We);mr=n(Ao,"Convert the model output to the corresponding type that the algorithm (DPM-Solver / DPM-Solver++) needs."),Ao.forEach(t),fr=p(j),ze=s(j,"P",{});var No=i(ze);gr=n(No,`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.`),No.forEach(t),vr=p(j),He=s(j,"P",{});var ko=i(He);_r=n(ko,`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.`),ko.forEach(t),j.forEach(t),Sr=p(h),$=s(h,"DIV",{class:!0});var De=i($);v(ie.$$.fragment,De),br=p(De),Ue=s(De,"P",{});var qo=i(Ue);Dr=n(qo,"One step for the first-order DPM-Solver (equivalent to DDIM)."),qo.forEach(t),yr=p(De),de=s(De,"P",{});var ct=i(de);Pr=n(ct,"See "),ae=s(ct,"A",{href:!0,rel:!0});var Vo=i(ae);Mr=n(Vo,"https://arxiv.org/abs/2206.00927"),Vo.forEach(t),$r=n(ct," for the detailed derivation."),ct.forEach(t),De.forEach(t),xr=p(h),z=s(h,"DIV",{class:!0});var ht=i(z);v(le.$$.fragment,ht),wr=p(ht),Be=s(ht,"P",{});var Wo=i(Be);Er=n(Wo,"Computes the solver order at each time step."),Wo.forEach(t),ht.forEach(t),Tr=p(h),H=s(h,"DIV",{class:!0});var ut=i(H);v(pe.$$.fragment,ut),Fr=p(ut),Ge=s(ut,"P",{});var zo=i(Ge);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),U=s(h,"DIV",{class:!0});var mt=i(U);v(ce.$$.fragment,mt),Ir=p(mt),Je=s(mt,"P",{});var Ho=i(Je);Lr=n(Ho,"Sets the timesteps used for the diffusion chain. Supporting function to be run before inference."),Ho.forEach(t),mt.forEach(t),Ar=p(h),x=s(h,"DIV",{class:!0});var ye=i(x);v(he.$$.fragment,ye),Nr=p(ye),Re=s(ye,"P",{});var Uo=i(Re);kr=n(Uo,"One step for the second-order singlestep DPM-Solver."),Uo.forEach(t),qr=p(ye),A=s(ye,"P",{});var Pe=i(A);Vr=n(Pe,"It computes the solution at time "),je=s(Pe,"CODE",{});var Bo=i(je);Wr=n(Bo,"prev_timestep"),Bo.forEach(t),zr=n(Pe," from the time "),Ke=s(Pe,"CODE",{});var Go=i(Ke);Hr=n(Go,"timestep_list[-2]"),Go.forEach(t),Ur=n(Pe,"."),Pe.forEach(t),ye.forEach(t),Br=p(h),w=s(h,"DIV",{class:!0});var Me=i(w);v(ue.$$.fragment,Me),Gr=p(Me),Qe=s(Me,"P",{});var Jo=i(Qe);Jr=n(Jo,"One step for the third-order singlestep DPM-Solver."),Jo.forEach(t),Rr=p(Me),N=s(Me,"P",{});var $e=i(N);jr=n($e,"It computes the solution at time "),Xe=s($e,"CODE",{});var Ro=i(Xe);Kr=n(Ro,"prev_timestep"),Ro.forEach(t),Qr=n($e," from the time "),Ye=s($e,"CODE",{});var jo=i(Ye);Xr=n(jo,"timestep_list[-3]"),jo.forEach(t),Yr=n($e,"."),$e.forEach(t),Me.forEach(t),Zr=p(h),B=s(h,"DIV",{class:!0});var ft=i(B);v(me.$$.fragment,ft),eo=p(ft),Ze=s(ft,"P",{});var Ko=i(Ze);to=n(Ko,"One step for the singlestep DPM-Solver."),Ko.forEach(t),ft.forEach(t),ro=p(h),G=s(h,"DIV",{class:!0});var gt=i(G);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(){a(F,"name","hf:doc:metadata"),a(F,"content",JSON.stringify(ss)),a(k,"id","singlestep-dpmsolver"),a(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"),a(k,"href","#singlestep-dpmsolver"),a(O,"class","relative group"),a(q,"id","overview"),a(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"),a(q,"href","#overview"),a(C,"class","relative group"),a(X,"href","https://arxiv.org/abs/2206.00927"),a(X,"rel","nofollow"),a(Y,"href","https://arxiv.org/abs/2211.01095"),a(Y,"rel","nofollow"),a(Z,"href","https://github.com/LuChengTHU/dpm-solver"),a(Z,"rel","nofollow"),a(V,"id","diffusers.DPMSolverSinglestepScheduler"),a(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"),a(V,"href","#diffusers.DPMSolverSinglestepScheduler"),a(I,"class","relative group"),a(re,"href","https://arxiv.org/abs/2206.00927"),a(re,"rel","nofollow"),a(oe,"href","https://arxiv.org/abs/2211.01095"),a(oe,"rel","nofollow"),a(se,"href","https://arxiv.org/abs/2205.11487"),a(se,"rel","nofollow"),a(ge,"href","/docs/diffusers/v0.12.0/en/api/configuration#diffusers.ConfigMixin"),a(ve,"href","/docs/diffusers/v0.12.0/en/api/schedulers/overview#diffusers.SchedulerMixin"),a(_e,"href","/docs/diffusers/v0.12.0/en/api/schedulers/overview#diffusers.SchedulerMixin.save_pretrained"),a(Se,"href","/docs/diffusers/v0.12.0/en/api/schedulers/overview#diffusers.SchedulerMixin.from_pretrained"),a(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),a(ae,"href","https://arxiv.org/abs/2206.00927"),a(ae,"rel","nofollow"),a($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),a(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),a(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),a(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),a(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),a(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),a(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),a(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),a(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(d,f){e(document.head,F),E(d,rt,f),E(d,O,f),e(O,k),e(k,xe),_(K,xe,null),e(O,vt),e(O,we),e(we,_t),E(d,ot,f),E(d,C,f),e(C,q),e(q,Ee),_(Q,Ee,null),e(C,St),e(C,Te),e(Te,bt),E(d,st,f),E(d,y,f),e(y,Dt),e(y,X),e(X,yt),e(y,Pt),e(y,Y),e(Y,Mt),e(y,$t),e(y,Z),e(Z,xt),e(y,wt),E(d,nt,f),E(d,I,f),e(I,V),e(V,Fe),_(ee,Fe,null),e(I,Et),e(I,Oe),e(Oe,Tt),E(d,it,f),E(d,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,Lt),e(W,At),e(W,oe),e(oe,Nt),e(c,kt),e(c,L),e(L,qt),e(L,Ie),e(Ie,Vt),e(L,Wt),e(L,Le),e(Le,zt),e(L,Ht),e(c,Ut),e(c,M),e(M,Bt),e(M,se),e(se,Gt),e(M,Jt),e(M,Ae),e(Ae,Rt),e(M,jt),e(M,Ne),e(Ne,Kt),e(M,Qt),e(c,Xt),e(c,u),e(u,ge),e(ge,Yt),e(u,Zt),e(u,ke),e(ke,er),e(u,tr),e(u,qe),e(qe,rr),e(u,or),e(u,Ve),e(Ve,sr),e(u,nr),e(u,ve),e(ve,ir),e(u,dr),e(u,_e),e(_e,ar),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,He),e(He,_r),e(c,Sr),e(c,$),_(ie,$,null),e($,br),e($,Ue),e(Ue,Dr),e($,yr),e($,de),e(de,Pr),e(de,ae),e(ae,Mr),e(de,$r),e(c,xr),e(c,z),_(le,z,null),e(z,wr),e(z,Be),e(Be,Er),e(c,Tr),e(c,H),_(pe,H,null),e(H,Fr),e(H,Ge),e(Ge,Or),e(c,Cr),e(c,U),_(ce,U,null),e(U,Ir),e(U,Je),e(Je,Lr),e(c,Ar),e(c,x),_(he,x,null),e(x,Nr),e(x,Re),e(Re,kr),e(x,qr),e(x,A),e(A,Vr),e(A,je),e(je,Wr),e(A,zr),e(A,Ke),e(Ke,Hr),e(A,Ur),e(c,Br),e(c,w),_(ue,w,null),e(w,Gr),e(w,Qe),e(Qe,Jr),e(w,Rr),e(w,N),e(N,jr),e(N,Xe),e(Xe,Kr),e(N,Qr),e(N,Ye),e(Ye,Xr),e(N,Yr),e(c,Zr),e(c,B),_(me,B,null),e(B,eo),e(B,Ze),e(Ze,to),e(c,ro),e(c,G),_(fe,G,null),e(G,oo),e(G,et),e(et,so),dt=!0},p:ts,i(d){dt||(S(K.$$.fragment,d),S(Q.$$.fragment,d),S(ee.$$.fragment,d),S(te.$$.fragment,d),S(ne.$$.fragment,d),S(ie.$$.fragment,d),S(le.$$.fragment,d),S(pe.$$.fragment,d),S(ce.$$.fragment,d),S(he.$$.fragment,d),S(ue.$$.fragment,d),S(me.$$.fragment,d),S(fe.$$.fragment,d),dt=!0)},o(d){b(K.$$.fragment,d),b(Q.$$.fragment,d),b(ee.$$.fragment,d),b(te.$$.fragment,d),b(ne.$$.fragment,d),b(ie.$$.fragment,d),b(le.$$.fragment,d),b(pe.$$.fragment,d),b(ce.$$.fragment,d),b(he.$$.fragment,d),b(ue.$$.fragment,d),b(me.$$.fragment,d),b(fe.$$.fragment,d),dt=!1},d(d){t(F),d&&t(rt),d&&t(O),D(K),d&&t(ot),d&&t(C),D(Q),d&&t(st),d&&t(y),d&&t(nt),d&&t(I),D(ee),d&&t(it),d&&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};
