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