import{S as Kr,i as Yr,s as Xr,e as o,k as l,w as S,t as i,M as jr,c as s,d as t,m as p,a as n,x as b,h as a,b as d,G as e,g as I,y as M,L as Qr,q as D,o as y,B as P,v as eo}from"../../../chunks/vendor-hf-doc-builder.js";import{D as z}from"../../../chunks/Docstring-hf-doc-builder.js";import{I as hr}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function to(fr){let w,Ce,E,O,fe,J,Ye,me,Xe,Ne,T,A,ve,Z,je,_e,Qe,Le,m,et,B,tt,rt,H,ot,st,R,nt,it,U,at,dt,ke,F,C,ge,K,lt,Se,pt,qe,c,Y,ct,X,ut,de,ht,ft,mt,g,vt,j,_t,gt,be,St,bt,Me,Mt,Dt,yt,h,le,Pt,xt,De,$t,It,ye,wt,Et,Pe,Tt,Ft,pe,Ot,At,ce,Ct,Nt,ue,Lt,kt,qt,_,Q,Vt,xe,Gt,Wt,$e,zt,Jt,Ie,Zt,Bt,x,ee,Ht,we,Rt,Ut,te,Kt,re,Yt,Xt,jt,N,oe,Qt,Ee,er,tr,L,se,rr,Te,or,sr,k,ne,nr,Fe,ir,ar,q,ie,dr,Oe,lr,pr,V,ae,cr,Ae,ur,Ve;return J=new hr({}),Z=new hr({}),K=new hr({}),Y=new z({props:{name:"class diffusers.DPMSolverMultistepInverseScheduler",anchor:"diffusers.DPMSolverMultistepInverseScheduler",parameters:[{name:"num_train_timesteps",val:": int = 1000"},{name:"beta_start",val:": float = 0.0001"},{name:"beta_end",val:": float = 0.02"},{name:"beta_schedule",val:": str = 'linear'"},{name:"trained_betas",val:": typing.Union[numpy.ndarray, typing.List[float], NoneType] = None"},{name:"solver_order",val:": int = 2"},{name:"prediction_type",val:": str = 'epsilon'"},{name:"thresholding",val:": bool = False"},{name:"dynamic_thresholding_ratio",val:": float = 0.995"},{name:"sample_max_value",val:": float = 1.0"},{name:"algorithm_type",val:": str = 'dpmsolver++'"},{name:"solver_type",val:": str = 'midpoint'"},{name:"lower_order_final",val:": bool = True"},{name:"use_karras_sigmas",val:": typing.Optional[bool] = False"},{name:"lambda_min_clipped",val:": float = -inf"},{name:"variance_type",val:": typing.Optional[str] = None"}],parametersDescription:[{anchor:"diffusers.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.beta_start",description:"<strong>beta_start</strong> (<code>float</code>) &#x2014; the starting <code>beta</code> value of inference.",name:"beta_start"},{anchor:"diffusers.DPMSolverMultistepInverseScheduler.beta_end",description:"<strong>beta_end</strong> (<code>float</code>) &#x2014; the final <code>beta</code> value.",name:"beta_end"},{anchor:"diffusers.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.algorithm_type",description:`<strong>algorithm_type</strong> (<code>str</code>, default <code>dpmsolver++</code>) &#x2014;
the algorithm type for the solver. Either <code>dpmsolver</code> or <code>dpmsolver++</code> or <code>sde-dpmsolver</code> or
<code>sde-dpmsolver++</code>. The <code>dpmsolver</code> type implements the algorithms in <a href="https://arxiv.org/abs/2206.00927" rel="nofollow">https://arxiv.org/abs/2206.00927</a>, and
the <code>dpmsolver++</code> type implements the algorithms in <a href="https://arxiv.org/abs/2211.01095" rel="nofollow">https://arxiv.org/abs/2211.01095</a>. We recommend to use
<code>dpmsolver++</code> or <code>sde-dpmsolver++</code> with <code>solver_order=2</code> for guided sampling (e.g. stable-diffusion).`,name:"algorithm_type"},{anchor:"diffusers.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.lower_order_final",description:`<strong>lower_order_final</strong> (<code>bool</code>, default <code>True</code>) &#x2014;
whether to use lower-order solvers in the final steps. Only valid for &lt; 15 inference steps. We empirically
find this trick can stabilize the sampling of DPM-Solver for steps &lt; 15, especially for steps &lt;= 10.`,name:"lower_order_final"},{anchor:"diffusers.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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_multistep_inverse.py#L58"}}),Q=new z({props:{name:"convert_model_output",anchor:"diffusers.DPMSolverMultistepInverseScheduler.convert_model_output",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"sample",val:": FloatTensor"}],parametersDescription:[{anchor:"diffusers.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.convert_model_output.timestep",description:"<strong>timestep</strong> (<code>int</code>) &#x2014; current discrete timestep in the diffusion chain.",name:"timestep"},{anchor:"diffusers.DPMSolverMultistepInverseScheduler.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_multistep_inverse.py#L310",returnDescription:`
<p>the converted model output.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),ee=new z({props:{name:"dpm_solver_first_order_update",anchor:"diffusers.DPMSolverMultistepInverseScheduler.dpm_solver_first_order_update",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"prev_timestep",val:": int"},{name:"sample",val:": FloatTensor"},{name:"noise",val:": typing.Optional[torch.FloatTensor] = None"}],parametersDescription:[{anchor:"diffusers.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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_multistep_inverse.py#L386",returnDescription:`
<p>the sample tensor at the previous timestep.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),oe=new z({props:{name:"multistep_dpm_solver_second_order_update",anchor:"diffusers.DPMSolverMultistepInverseScheduler.multistep_dpm_solver_second_order_update",parameters:[{name:"model_output_list",val:": typing.List[torch.FloatTensor]"},{name:"timestep_list",val:": typing.List[int]"},{name:"prev_timestep",val:": int"},{name:"sample",val:": FloatTensor"},{name:"noise",val:": typing.Optional[torch.FloatTensor] = None"}],parametersDescription:[{anchor:"diffusers.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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.17.1/src/diffusers/schedulers/scheduling_dpmsolver_multistep_inverse.py#L434",returnDescription:`
<p>the sample tensor at the previous timestep.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),se=new z({props:{name:"multistep_dpm_solver_third_order_update",anchor:"diffusers.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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.17.1/src/diffusers/schedulers/scheduling_dpmsolver_multistep_inverse.py#L527",returnDescription:`
<p>the sample tensor at the previous timestep.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),ne=new z({props:{name:"scale_model_input",anchor:"diffusers.DPMSolverMultistepInverseScheduler.scale_model_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.DPMSolverMultistepInverseScheduler.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_multistep_inverse.py#L663",returnDescription:`
<p>scaled input sample</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),ie=new z({props:{name:"set_timesteps",anchor:"diffusers.DPMSolverMultistepInverseScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int = None"},{name:"device",val:": typing.Union[str, torch.device] = None"}],parametersDescription:[{anchor:"diffusers.DPMSolverMultistepInverseScheduler.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.DPMSolverMultistepInverseScheduler.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_multistep_inverse.py#L197"}}),ae=new z({props:{name:"step",anchor:"diffusers.DPMSolverMultistepInverseScheduler.step",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"sample",val:": FloatTensor"},{name:"generator",val:" = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.DPMSolverMultistepInverseScheduler.step.model_output",description:"<strong>model_output</strong> (<code>torch.FloatTensor</code>) &#x2014; direct output from learned diffusion model.",name:"model_output"},{anchor:"diffusers.DPMSolverMultistepInverseScheduler.step.timestep",description:"<strong>timestep</strong> (<code>int</code>) &#x2014; current discrete timestep in the diffusion chain.",name:"timestep"},{anchor:"diffusers.DPMSolverMultistepInverseScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
current instance of sample being created by diffusion process.`,name:"sample"},{anchor:"diffusers.DPMSolverMultistepInverseScheduler.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_multistep_inverse.py#L582",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"),Ce=l(),E=o("h1"),O=o("a"),fe=o("span"),S(J.$$.fragment),Ye=l(),me=o("span"),Xe=i("Inverse Multistep DPM-Solver (DPMSolverMultistepInverse)"),Ne=l(),T=o("h2"),A=o("a"),ve=o("span"),S(Z.$$.fragment),je=l(),_e=o("span"),Qe=i("Overview"),Le=l(),m=o("p"),et=i("This scheduler is the inverted scheduler of "),B=o("a"),tt=i("DPM-Solver: A Fast ODE Solver for Diffusion Probabilistic Model Sampling in Around 10 Steps"),rt=i(" and "),H=o("a"),ot=i("DPM-Solver++: Fast Solver for Guided Sampling of Diffusion Probabilistic Models"),st=i(` by Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu.
The implementation is mostly based on the DDIM inversion definition of `),R=o("a"),nt=i("Null-text Inversion for Editing Real Images using Guided Diffusion Models"),it=i(" and the ad-hoc notebook implementation for DiffEdit latent inversion "),U=o("a"),at=i("here"),dt=i("."),ke=l(),F=o("h2"),C=o("a"),ge=o("span"),S(K.$$.fragment),lt=l(),Se=o("span"),pt=i("DPMSolverMultistepInverseScheduler"),qe=l(),c=o("div"),S(Y.$$.fragment),ct=l(),X=o("p"),ut=i("DPMSolverMultistepInverseScheduler is the reverse scheduler of "),de=o("a"),ht=i("DPMSolverMultistepScheduler"),ft=i("."),mt=l(),g=o("p"),vt=i("We also support the \u201Cdynamic thresholding\u201D method in Imagen ("),j=o("a"),_t=i("https://arxiv.org/abs/2205.11487"),gt=i(`). For pixel-space
diffusion models, you can set both `),be=o("code"),St=i('algorithm_type="dpmsolver++"'),bt=i(" and "),Me=o("code"),Mt=i("thresholding=True"),Dt=i(` to use the dynamic
thresholding. Note that the thresholding method is unsuitable for latent-space diffusion models (such as
stable-diffusion).`),yt=l(),h=o("p"),le=o("a"),Pt=i("~ConfigMixin"),xt=i(" takes care of storing all config attributes that are passed in the scheduler\u2019s "),De=o("code"),$t=i("__init__"),It=i(`
function, such as `),ye=o("code"),wt=i("num_train_timesteps"),Et=i(". They can be accessed via "),Pe=o("code"),Tt=i("scheduler.config.num_train_timesteps"),Ft=i(`.
`),pe=o("a"),Ot=i("SchedulerMixin"),At=i(" provides general loading and saving functionality via the "),ce=o("a"),Ct=i("SchedulerMixin.save_pretrained()"),Nt=i(` and
`),ue=o("a"),Lt=i("from_pretrained()"),kt=i(" functions."),qt=l(),_=o("div"),S(Q.$$.fragment),Vt=l(),xe=o("p"),Gt=i("Convert the model output to the corresponding type that the algorithm (DPM-Solver / DPM-Solver++) needs."),Wt=l(),$e=o("p"),zt=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.`),Jt=l(),Ie=o("p"),Zt=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.`),Bt=l(),x=o("div"),S(ee.$$.fragment),Ht=l(),we=o("p"),Rt=i("One step for the first-order DPM-Solver (equivalent to DDIM)."),Ut=l(),te=o("p"),Kt=i("See "),re=o("a"),Yt=i("https://arxiv.org/abs/2206.00927"),Xt=i(" for the detailed derivation."),jt=l(),N=o("div"),S(oe.$$.fragment),Qt=l(),Ee=o("p"),er=i("One step for the second-order multistep DPM-Solver."),tr=l(),L=o("div"),S(se.$$.fragment),rr=l(),Te=o("p"),or=i("One step for the third-order multistep DPM-Solver."),sr=l(),k=o("div"),S(ne.$$.fragment),nr=l(),Fe=o("p"),ir=i(`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),ar=l(),q=o("div"),S(ie.$$.fragment),dr=l(),Oe=o("p"),lr=i("Sets the timesteps used for the diffusion chain. Supporting function to be run before inference."),pr=l(),V=o("div"),S(ae.$$.fragment),cr=l(),Ae=o("p"),ur=i("Step function propagating the sample with the multistep DPM-Solver."),this.h()},l(r){const v=jr('[data-svelte="svelte-1phssyn"]',document.head);w=s(v,"META",{name:!0,content:!0}),v.forEach(t),Ce=p(r),E=s(r,"H1",{class:!0});var Ge=n(E);O=s(Ge,"A",{id:!0,class:!0,href:!0});var mr=n(O);fe=s(mr,"SPAN",{});var vr=n(fe);b(J.$$.fragment,vr),vr.forEach(t),mr.forEach(t),Ye=p(Ge),me=s(Ge,"SPAN",{});var _r=n(me);Xe=a(_r,"Inverse Multistep DPM-Solver (DPMSolverMultistepInverse)"),_r.forEach(t),Ge.forEach(t),Ne=p(r),T=s(r,"H2",{class:!0});var We=n(T);A=s(We,"A",{id:!0,class:!0,href:!0});var gr=n(A);ve=s(gr,"SPAN",{});var Sr=n(ve);b(Z.$$.fragment,Sr),Sr.forEach(t),gr.forEach(t),je=p(We),_e=s(We,"SPAN",{});var br=n(_e);Qe=a(br,"Overview"),br.forEach(t),We.forEach(t),Le=p(r),m=s(r,"P",{});var $=n(m);et=a($,"This scheduler is the inverted scheduler of "),B=s($,"A",{href:!0,rel:!0});var Mr=n(B);tt=a(Mr,"DPM-Solver: A Fast ODE Solver for Diffusion Probabilistic Model Sampling in Around 10 Steps"),Mr.forEach(t),rt=a($," and "),H=s($,"A",{href:!0,rel:!0});var Dr=n(H);ot=a(Dr,"DPM-Solver++: Fast Solver for Guided Sampling of Diffusion Probabilistic Models"),Dr.forEach(t),st=a($,` by Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu.
The implementation is mostly based on the DDIM inversion definition of `),R=s($,"A",{href:!0,rel:!0});var yr=n(R);nt=a(yr,"Null-text Inversion for Editing Real Images using Guided Diffusion Models"),yr.forEach(t),it=a($," and the ad-hoc notebook implementation for DiffEdit latent inversion "),U=s($,"A",{href:!0,rel:!0});var Pr=n(U);at=a(Pr,"here"),Pr.forEach(t),dt=a($,"."),$.forEach(t),ke=p(r),F=s(r,"H2",{class:!0});var ze=n(F);C=s(ze,"A",{id:!0,class:!0,href:!0});var xr=n(C);ge=s(xr,"SPAN",{});var $r=n(ge);b(K.$$.fragment,$r),$r.forEach(t),xr.forEach(t),lt=p(ze),Se=s(ze,"SPAN",{});var Ir=n(Se);pt=a(Ir,"DPMSolverMultistepInverseScheduler"),Ir.forEach(t),ze.forEach(t),qe=p(r),c=s(r,"DIV",{class:!0});var u=n(c);b(Y.$$.fragment,u),ct=p(u),X=s(u,"P",{});var Je=n(X);ut=a(Je,"DPMSolverMultistepInverseScheduler is the reverse scheduler of "),de=s(Je,"A",{href:!0});var wr=n(de);ht=a(wr,"DPMSolverMultistepScheduler"),wr.forEach(t),ft=a(Je,"."),Je.forEach(t),mt=p(u),g=s(u,"P",{});var G=n(g);vt=a(G,"We also support the \u201Cdynamic thresholding\u201D method in Imagen ("),j=s(G,"A",{href:!0,rel:!0});var Er=n(j);_t=a(Er,"https://arxiv.org/abs/2205.11487"),Er.forEach(t),gt=a(G,`). For pixel-space
diffusion models, you can set both `),be=s(G,"CODE",{});var Tr=n(be);St=a(Tr,'algorithm_type="dpmsolver++"'),Tr.forEach(t),bt=a(G," and "),Me=s(G,"CODE",{});var Fr=n(Me);Mt=a(Fr,"thresholding=True"),Fr.forEach(t),Dt=a(G,` to use the dynamic
thresholding. Note that the thresholding method is unsuitable for latent-space diffusion models (such as
stable-diffusion).`),G.forEach(t),yt=p(u),h=s(u,"P",{});var f=n(h);le=s(f,"A",{href:!0});var Or=n(le);Pt=a(Or,"~ConfigMixin"),Or.forEach(t),xt=a(f," takes care of storing all config attributes that are passed in the scheduler\u2019s "),De=s(f,"CODE",{});var Ar=n(De);$t=a(Ar,"__init__"),Ar.forEach(t),It=a(f,`
function, such as `),ye=s(f,"CODE",{});var Cr=n(ye);wt=a(Cr,"num_train_timesteps"),Cr.forEach(t),Et=a(f,". They can be accessed via "),Pe=s(f,"CODE",{});var Nr=n(Pe);Tt=a(Nr,"scheduler.config.num_train_timesteps"),Nr.forEach(t),Ft=a(f,`.
`),pe=s(f,"A",{href:!0});var Lr=n(pe);Ot=a(Lr,"SchedulerMixin"),Lr.forEach(t),At=a(f," provides general loading and saving functionality via the "),ce=s(f,"A",{href:!0});var kr=n(ce);Ct=a(kr,"SchedulerMixin.save_pretrained()"),kr.forEach(t),Nt=a(f,` and
`),ue=s(f,"A",{href:!0});var qr=n(ue);Lt=a(qr,"from_pretrained()"),qr.forEach(t),kt=a(f," functions."),f.forEach(t),qt=p(u),_=s(u,"DIV",{class:!0});var W=n(_);b(Q.$$.fragment,W),Vt=p(W),xe=s(W,"P",{});var Vr=n(xe);Gt=a(Vr,"Convert the model output to the corresponding type that the algorithm (DPM-Solver / DPM-Solver++) needs."),Vr.forEach(t),Wt=p(W),$e=s(W,"P",{});var Gr=n($e);zt=a(Gr,`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.`),Gr.forEach(t),Jt=p(W),Ie=s(W,"P",{});var Wr=n(Ie);Zt=a(Wr,`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.`),Wr.forEach(t),W.forEach(t),Bt=p(u),x=s(u,"DIV",{class:!0});var he=n(x);b(ee.$$.fragment,he),Ht=p(he),we=s(he,"P",{});var zr=n(we);Rt=a(zr,"One step for the first-order DPM-Solver (equivalent to DDIM)."),zr.forEach(t),Ut=p(he),te=s(he,"P",{});var Ze=n(te);Kt=a(Ze,"See "),re=s(Ze,"A",{href:!0,rel:!0});var Jr=n(re);Yt=a(Jr,"https://arxiv.org/abs/2206.00927"),Jr.forEach(t),Xt=a(Ze," for the detailed derivation."),Ze.forEach(t),he.forEach(t),jt=p(u),N=s(u,"DIV",{class:!0});var Be=n(N);b(oe.$$.fragment,Be),Qt=p(Be),Ee=s(Be,"P",{});var Zr=n(Ee);er=a(Zr,"One step for the second-order multistep DPM-Solver."),Zr.forEach(t),Be.forEach(t),tr=p(u),L=s(u,"DIV",{class:!0});var He=n(L);b(se.$$.fragment,He),rr=p(He),Te=s(He,"P",{});var Br=n(Te);or=a(Br,"One step for the third-order multistep DPM-Solver."),Br.forEach(t),He.forEach(t),sr=p(u),k=s(u,"DIV",{class:!0});var Re=n(k);b(ne.$$.fragment,Re),nr=p(Re),Fe=s(Re,"P",{});var Hr=n(Fe);ir=a(Hr,`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),Hr.forEach(t),Re.forEach(t),ar=p(u),q=s(u,"DIV",{class:!0});var Ue=n(q);b(ie.$$.fragment,Ue),dr=p(Ue),Oe=s(Ue,"P",{});var Rr=n(Oe);lr=a(Rr,"Sets the timesteps used for the diffusion chain. Supporting function to be run before inference."),Rr.forEach(t),Ue.forEach(t),pr=p(u),V=s(u,"DIV",{class:!0});var Ke=n(V);b(ae.$$.fragment,Ke),cr=p(Ke),Ae=s(Ke,"P",{});var Ur=n(Ae);ur=a(Ur,"Step function propagating the sample with the multistep DPM-Solver."),Ur.forEach(t),Ke.forEach(t),u.forEach(t),this.h()},h(){d(w,"name","hf:doc:metadata"),d(w,"content",JSON.stringify(ro)),d(O,"id","inverse-multistep-dpmsolver-dpmsolvermultistepinverse"),d(O,"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(O,"href","#inverse-multistep-dpmsolver-dpmsolvermultistepinverse"),d(E,"class","relative group"),d(A,"id","overview"),d(A,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(A,"href","#overview"),d(T,"class","relative group"),d(B,"href","https://arxiv.org/abs/2206.00927"),d(B,"rel","nofollow"),d(H,"href","https://arxiv.org/abs/2211.01095"),d(H,"rel","nofollow"),d(R,"href","https://arxiv.org/pdf/2211.09794.pdf"),d(R,"rel","nofollow"),d(U,"href","https://github.com/Xiang-cd/DiffEdit-stable-diffusion/blob/main/diffedit.ipynb"),d(U,"rel","nofollow"),d(C,"id","diffusers.DPMSolverMultistepInverseScheduler"),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","#diffusers.DPMSolverMultistepInverseScheduler"),d(F,"class","relative group"),d(de,"href","/docs/diffusers/v0.17.1/en/api/schedulers/multistep_dpm_solver#diffusers.DPMSolverMultistepScheduler"),d(j,"href","https://arxiv.org/abs/2205.11487"),d(j,"rel","nofollow"),d(le,"href","/docs/diffusers/v0.17.1/en/api/configuration#diffusers.ConfigMixin"),d(pe,"href","/docs/diffusers/v0.17.1/en/api/schedulers/overview#diffusers.SchedulerMixin"),d(ce,"href","/docs/diffusers/v0.17.1/en/api/schedulers/overview#diffusers.SchedulerMixin.save_pretrained"),d(ue,"href","/docs/diffusers/v0.17.1/en/api/schedulers/overview#diffusers.SchedulerMixin.from_pretrained"),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(re,"href","https://arxiv.org/abs/2206.00927"),d(re,"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(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(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(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(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(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(r,v){e(document.head,w),I(r,Ce,v),I(r,E,v),e(E,O),e(O,fe),M(J,fe,null),e(E,Ye),e(E,me),e(me,Xe),I(r,Ne,v),I(r,T,v),e(T,A),e(A,ve),M(Z,ve,null),e(T,je),e(T,_e),e(_e,Qe),I(r,Le,v),I(r,m,v),e(m,et),e(m,B),e(B,tt),e(m,rt),e(m,H),e(H,ot),e(m,st),e(m,R),e(R,nt),e(m,it),e(m,U),e(U,at),e(m,dt),I(r,ke,v),I(r,F,v),e(F,C),e(C,ge),M(K,ge,null),e(F,lt),e(F,Se),e(Se,pt),I(r,qe,v),I(r,c,v),M(Y,c,null),e(c,ct),e(c,X),e(X,ut),e(X,de),e(de,ht),e(X,ft),e(c,mt),e(c,g),e(g,vt),e(g,j),e(j,_t),e(g,gt),e(g,be),e(be,St),e(g,bt),e(g,Me),e(Me,Mt),e(g,Dt),e(c,yt),e(c,h),e(h,le),e(le,Pt),e(h,xt),e(h,De),e(De,$t),e(h,It),e(h,ye),e(ye,wt),e(h,Et),e(h,Pe),e(Pe,Tt),e(h,Ft),e(h,pe),e(pe,Ot),e(h,At),e(h,ce),e(ce,Ct),e(h,Nt),e(h,ue),e(ue,Lt),e(h,kt),e(c,qt),e(c,_),M(Q,_,null),e(_,Vt),e(_,xe),e(xe,Gt),e(_,Wt),e(_,$e),e($e,zt),e(_,Jt),e(_,Ie),e(Ie,Zt),e(c,Bt),e(c,x),M(ee,x,null),e(x,Ht),e(x,we),e(we,Rt),e(x,Ut),e(x,te),e(te,Kt),e(te,re),e(re,Yt),e(te,Xt),e(c,jt),e(c,N),M(oe,N,null),e(N,Qt),e(N,Ee),e(Ee,er),e(c,tr),e(c,L),M(se,L,null),e(L,rr),e(L,Te),e(Te,or),e(c,sr),e(c,k),M(ne,k,null),e(k,nr),e(k,Fe),e(Fe,ir),e(c,ar),e(c,q),M(ie,q,null),e(q,dr),e(q,Oe),e(Oe,lr),e(c,pr),e(c,V),M(ae,V,null),e(V,cr),e(V,Ae),e(Ae,ur),Ve=!0},p:Qr,i(r){Ve||(D(J.$$.fragment,r),D(Z.$$.fragment,r),D(K.$$.fragment,r),D(Y.$$.fragment,r),D(Q.$$.fragment,r),D(ee.$$.fragment,r),D(oe.$$.fragment,r),D(se.$$.fragment,r),D(ne.$$.fragment,r),D(ie.$$.fragment,r),D(ae.$$.fragment,r),Ve=!0)},o(r){y(J.$$.fragment,r),y(Z.$$.fragment,r),y(K.$$.fragment,r),y(Y.$$.fragment,r),y(Q.$$.fragment,r),y(ee.$$.fragment,r),y(oe.$$.fragment,r),y(se.$$.fragment,r),y(ne.$$.fragment,r),y(ie.$$.fragment,r),y(ae.$$.fragment,r),Ve=!1},d(r){t(w),r&&t(Ce),r&&t(E),P(J),r&&t(Ne),r&&t(T),P(Z),r&&t(Le),r&&t(m),r&&t(ke),r&&t(F),P(K),r&&t(qe),r&&t(c),P(Y),P(Q),P(ee),P(oe),P(se),P(ne),P(ie),P(ae)}}}const ro={local:"inverse-multistep-dpmsolver-dpmsolvermultistepinverse",sections:[{local:"overview",title:"Overview"},{local:"diffusers.DPMSolverMultistepInverseScheduler",title:"DPMSolverMultistepInverseScheduler"}],title:"Inverse Multistep DPM-Solver (DPMSolverMultistepInverse)"};function oo(fr){return eo(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ao extends Kr{constructor(w){super();Yr(this,w,oo,to,Xr,{})}}export{ao as default,ro as metadata};
