import{S as zr,i as Gr,s as Jr,e as o,k as c,w as b,t as i,M as Rr,c as n,d as r,m as p,a as s,x as y,h as a,b as d,G as e,g as _,y as x,L as jr,q as P,o as C,B as U,v as Kr}from"../../../chunks/vendor-hf-doc-builder.js";import{D as te}from"../../../chunks/Docstring-hf-doc-builder.js";import{I as lr}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function Qr(cr){let w,De,$,T,pe,W,Ke,ue,Qe,Fe,S,D,he,q,Xe,fe,Ye,Ae,re,Ze,Oe,v,et,B,tt,rt,H,ot,nt,ke,oe,st,Ie,M,F,me,z,it,_e,at,Ne,l,G,dt,ge,lt,ct,ne,pt,J,ut,ht,E,ft,ve,mt,_t,be,gt,vt,bt,g,yt,R,xt,Pt,ye,Ct,Ut,xe,wt,$t,St,h,se,Mt,Et,Pe,Tt,Dt,Ce,Ft,At,Ue,Ot,kt,ie,It,Nt,ae,Lt,Vt,de,Wt,qt,Bt,A,j,Ht,we,zt,Gt,O,K,Jt,$e,Rt,jt,k,Q,Kt,X,Qt,Se,Xt,Yt,Zt,I,Y,er,Me,tr,rr,N,Z,or,Ee,nr,sr,L,ee,ir,Te,ar,Le;return W=new lr({}),q=new lr({}),z=new lr({}),G=new te({props:{name:"class diffusers.UniPCMultistepScheduler",anchor:"diffusers.UniPCMultistepScheduler",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:"predict_x0",val:": bool = True"},{name:"solver_type",val:": str = 'bh2'"},{name:"lower_order_final",val:": bool = True"},{name:"disable_corrector",val:": typing.List[int] = []"},{name:"solver_p",val:": SchedulerMixin = None"}],parametersDescription:[{anchor:"diffusers.UniPCMultistepScheduler.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.UniPCMultistepScheduler.beta_start",description:"<strong>beta_start</strong> (<code>float</code>) &#x2014; the starting <code>beta</code> value of inference.",name:"beta_start"},{anchor:"diffusers.UniPCMultistepScheduler.beta_end",description:"<strong>beta_end</strong> (<code>float</code>) &#x2014; the final <code>beta</code> value.",name:"beta_end"},{anchor:"diffusers.UniPCMultistepScheduler.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.UniPCMultistepScheduler.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.UniPCMultistepScheduler.solver_order",description:`<strong>solver_order</strong> (<code>int</code>, default <code>2</code>) &#x2014;
the order of UniPC, also the p in UniPC-p; can be any positive integer. Note that the effective order of
accuracy is <code>solver_order + 1</code> due to the UniC. 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.UniPCMultistepScheduler.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.UniPCMultistepScheduler.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>predict_x0=True</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.UniPCMultistepScheduler.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.UniPCMultistepScheduler.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>predict_x0=True</code>.`,name:"sample_max_value"},{anchor:"diffusers.UniPCMultistepScheduler.predict_x0",description:`<strong>predict_x0</strong> (<code>bool</code>, default <code>True</code>) &#x2014;
whether to use the updating algrithm on the predicted x0. See <a href="https://arxiv.org/abs/2211.01095" rel="nofollow">https://arxiv.org/abs/2211.01095</a> for details`,name:"predict_x0"},{anchor:"diffusers.UniPCMultistepScheduler.solver_type",description:`<strong>solver_type</strong> (<code>str</code>, default <code>bh2</code>) &#x2014;
the solver type of UniPC. We recommend use <code>bh1</code> for unconditional sampling when steps &lt; 10, and use <code>bh2</code>
otherwise.`,name:"solver_type"},{anchor:"diffusers.UniPCMultistepScheduler.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.UniPCMultistepScheduler.disable_corrector",description:`<strong>disable_corrector</strong> (<code>list</code>, default <code>[]</code>) &#x2014;
decide which step to disable the corrector. For large guidance scale, the misalignment between the
<code>epsilon_theta(x_t, c)</code>and <code>epsilon_theta(x_t^c, c)</code> might influence the convergence. This can be mitigated
by disable the corrector at the first few steps (e.g., disable_corrector=[0])`,name:"disable_corrector"},{anchor:"diffusers.UniPCMultistepScheduler.solver_p",description:`<strong>solver_p</strong> (<code>SchedulerMixin</code>, default <code>None</code>) &#x2014;
can be any other scheduler. If specified, the algorithm will become solver_p + UniC.`,name:"solver_p"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_unipc_multistep.py#L57"}}),j=new te({props:{name:"convert_model_output",anchor:"diffusers.UniPCMultistepScheduler.convert_model_output",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"sample",val:": FloatTensor"}],parametersDescription:[{anchor:"diffusers.UniPCMultistepScheduler.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.UniPCMultistepScheduler.convert_model_output.timestep",description:"<strong>timestep</strong> (<code>int</code>) &#x2014; current discrete timestep in the diffusion chain.",name:"timestep"},{anchor:"diffusers.UniPCMultistepScheduler.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/main/src/diffusers/schedulers/scheduling_unipc_multistep.py#L213",returnDescription:`
<p>the converted model output.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),K=new te({props:{name:"multistep_uni_c_bh_update",anchor:"diffusers.UniPCMultistepScheduler.multistep_uni_c_bh_update",parameters:[{name:"this_model_output",val:": FloatTensor"},{name:"this_timestep",val:": int"},{name:"last_sample",val:": FloatTensor"},{name:"this_sample",val:": FloatTensor"},{name:"order",val:": int"}],parametersDescription:[{anchor:"diffusers.UniPCMultistepScheduler.multistep_uni_c_bh_update.this_model_output",description:"<strong>this_model_output</strong> (<code>torch.FloatTensor</code>) &#x2014; the model outputs at <code>x_t</code>",name:"this_model_output"},{anchor:"diffusers.UniPCMultistepScheduler.multistep_uni_c_bh_update.this_timestep",description:"<strong>this_timestep</strong> (<code>int</code>) &#x2014; the current timestep <code>t</code>",name:"this_timestep"},{anchor:"diffusers.UniPCMultistepScheduler.multistep_uni_c_bh_update.last_sample",description:"<strong>last_sample</strong> (<code>torch.FloatTensor</code>) &#x2014; the generated sample before the last predictor: <code>x_{t-1}</code>",name:"last_sample"},{anchor:"diffusers.UniPCMultistepScheduler.multistep_uni_c_bh_update.this_sample",description:"<strong>this_sample</strong> (<code>torch.FloatTensor</code>) &#x2014; the generated sample after the last predictor: <code>x_{t}</code>",name:"this_sample"},{anchor:"diffusers.UniPCMultistepScheduler.multistep_uni_c_bh_update.order",description:`<strong>order</strong> (<code>int</code>) &#x2014; the <code>p</code> of UniC-p at this step. Note that the effective order of accuracy
should be order + 1`,name:"order"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_unipc_multistep.py#L380",returnDescription:`
<p>the corrected sample tensor at the current timestep.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),Q=new te({props:{name:"multistep_uni_p_bh_update",anchor:"diffusers.UniPCMultistepScheduler.multistep_uni_p_bh_update",parameters:[{name:"model_output",val:": FloatTensor"},{name:"prev_timestep",val:": int"},{name:"sample",val:": FloatTensor"},{name:"order",val:": int"}],parametersDescription:[{anchor:"diffusers.UniPCMultistepScheduler.multistep_uni_p_bh_update.model_output",description:`<strong>model_output</strong> (<code>torch.FloatTensor</code>) &#x2014;
direct outputs from learned diffusion model at the current timestep.`,name:"model_output"},{anchor:"diffusers.UniPCMultistepScheduler.multistep_uni_p_bh_update.prev_timestep",description:"<strong>prev_timestep</strong> (<code>int</code>) &#x2014; previous discrete timestep in the diffusion chain.",name:"prev_timestep"},{anchor:"diffusers.UniPCMultistepScheduler.multistep_uni_p_bh_update.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
current instance of sample being created by diffusion process.`,name:"sample"},{anchor:"diffusers.UniPCMultistepScheduler.multistep_uni_p_bh_update.order",description:"<strong>order</strong> (<code>int</code>) &#x2014; the order of UniP at this step, also the p in UniPC-p.",name:"order"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_unipc_multistep.py#L275",returnDescription:`
<p>the sample tensor at the previous timestep.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),Y=new te({props:{name:"scale_model_input",anchor:"diffusers.UniPCMultistepScheduler.scale_model_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.UniPCMultistepScheduler.scale_model_input.sample",description:"<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014; input sample",name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_unipc_multistep.py#L570",returnDescription:`
<p>scaled input sample</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),Z=new te({props:{name:"set_timesteps",anchor:"diffusers.UniPCMultistepScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": typing.Union[str, torch.device] = None"}],parametersDescription:[{anchor:"diffusers.UniPCMultistepScheduler.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.UniPCMultistepScheduler.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/main/src/diffusers/schedulers/scheduling_unipc_multistep.py#L187"}}),ee=new te({props:{name:"step",anchor:"diffusers.UniPCMultistepScheduler.step",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"sample",val:": FloatTensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.UniPCMultistepScheduler.step.model_output",description:"<strong>model_output</strong> (<code>torch.FloatTensor</code>) &#x2014; direct output from learned diffusion model.",name:"model_output"},{anchor:"diffusers.UniPCMultistepScheduler.step.timestep",description:"<strong>timestep</strong> (<code>int</code>) &#x2014; current discrete timestep in the diffusion chain.",name:"timestep"},{anchor:"diffusers.UniPCMultistepScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
current instance of sample being created by diffusion process.`,name:"sample"},{anchor:"diffusers.UniPCMultistepScheduler.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/main/src/diffusers/schedulers/scheduling_unipc_multistep.py#L486",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"),De=c(),$=o("h1"),T=o("a"),pe=o("span"),b(W.$$.fragment),Ke=c(),ue=o("span"),Qe=i("UniPC"),Fe=c(),S=o("h2"),D=o("a"),he=o("span"),b(q.$$.fragment),Xe=c(),fe=o("span"),Ye=i("Overview"),Ae=c(),re=o("p"),Ze=i("UniPC is a training-free framework designed for the fast sampling of diffusion models, which consists of a corrector (UniC) and a predictor (UniP) that share a unified analytical form and support arbitrary orders."),Oe=c(),v=o("p"),et=i("For more details about the method, please refer to the "),B=o("a"),tt=i("[paper]"),rt=i(" and the "),H=o("a"),ot=i("[code]"),nt=i("."),ke=c(),oe=o("p"),st=i("Fast Sampling of Diffusion Models with Exponential Integrator."),Ie=c(),M=o("h2"),F=o("a"),me=o("span"),b(z.$$.fragment),it=c(),_e=o("span"),at=i("UniPCMultistepScheduler"),Ne=c(),l=o("div"),b(G.$$.fragment),dt=c(),ge=o("p"),lt=i(`UniPC is a training-free framework designed for the fast sampling of diffusion models, which consists of a
corrector (UniC) and a predictor (UniP) that share a unified analytical form and support arbitrary orders. UniPC is
by desinged model-agnostic, supporting pixel-space/latent-space DPMs on unconditional/conditional sampling. It can
also be applied to both noise prediction model and data prediction model. The corrector UniC can be also applied
after any off-the-shelf solvers to increase the order of accuracy.`),ct=c(),ne=o("p"),pt=i("For more details, see the original paper: "),J=o("a"),ut=i("https://arxiv.org/abs/2302.04867"),ht=c(),E=o("p"),ft=i(`Currently, we support the multistep UniPC for both noise prediction models and data prediction models. We recommend
to use `),ve=o("code"),mt=i("solver_order=2"),_t=i(" for guided sampling, and "),be=o("code"),gt=i("solver_order=3"),vt=i(" for unconditional sampling."),bt=c(),g=o("p"),yt=i("We also support the \u201Cdynamic thresholding\u201D method in Imagen ("),R=o("a"),xt=i("https://arxiv.org/abs/2205.11487"),Pt=i(`). For pixel-space
diffusion models, you can set both `),ye=o("code"),Ct=i("predict_x0=True"),Ut=i(" and "),xe=o("code"),wt=i("thresholding=True"),$t=i(` to use the dynamic thresholding. Note
that the thresholding method is unsuitable for latent-space diffusion models (such as stable-diffusion).`),St=c(),h=o("p"),se=o("a"),Mt=i("~ConfigMixin"),Et=i(" takes care of storing all config attributes that are passed in the scheduler\u2019s "),Pe=o("code"),Tt=i("__init__"),Dt=i(`
function, such as `),Ce=o("code"),Ft=i("num_train_timesteps"),At=i(". They can be accessed via "),Ue=o("code"),Ot=i("scheduler.config.num_train_timesteps"),kt=i(`.
`),ie=o("a"),It=i("SchedulerMixin"),Nt=i(" provides general loading and saving functionality via the "),ae=o("a"),Lt=i("SchedulerMixin.save_pretrained()"),Vt=i(` and
`),de=o("a"),Wt=i("from_pretrained()"),qt=i(" functions."),Bt=c(),A=o("div"),b(j.$$.fragment),Ht=c(),we=o("p"),zt=i("Convert the model output to the corresponding type that the algorithm PC needs."),Gt=c(),O=o("div"),b(K.$$.fragment),Jt=c(),$e=o("p"),Rt=i("One step for the UniC (B(h) version)."),jt=c(),k=o("div"),b(Q.$$.fragment),Kt=c(),X=o("p"),Qt=i("One step for the UniP (B(h) version). Alternatively, "),Se=o("code"),Xt=i("self.solver_p"),Yt=i(" is used if is specified."),Zt=c(),I=o("div"),b(Y.$$.fragment),er=c(),Me=o("p"),tr=i(`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),rr=c(),N=o("div"),b(Z.$$.fragment),or=c(),Ee=o("p"),nr=i("Sets the timesteps used for the diffusion chain. Supporting function to be run before inference."),sr=c(),L=o("div"),b(ee.$$.fragment),ir=c(),Te=o("p"),ar=i("Step function propagating the sample with the multistep UniPC."),this.h()},l(t){const f=Rr('[data-svelte="svelte-1phssyn"]',document.head);w=n(f,"META",{name:!0,content:!0}),f.forEach(r),De=p(t),$=n(t,"H1",{class:!0});var Ve=s($);T=n(Ve,"A",{id:!0,class:!0,href:!0});var pr=s(T);pe=n(pr,"SPAN",{});var ur=s(pe);y(W.$$.fragment,ur),ur.forEach(r),pr.forEach(r),Ke=p(Ve),ue=n(Ve,"SPAN",{});var hr=s(ue);Qe=a(hr,"UniPC"),hr.forEach(r),Ve.forEach(r),Fe=p(t),S=n(t,"H2",{class:!0});var We=s(S);D=n(We,"A",{id:!0,class:!0,href:!0});var fr=s(D);he=n(fr,"SPAN",{});var mr=s(he);y(q.$$.fragment,mr),mr.forEach(r),fr.forEach(r),Xe=p(We),fe=n(We,"SPAN",{});var _r=s(fe);Ye=a(_r,"Overview"),_r.forEach(r),We.forEach(r),Ae=p(t),re=n(t,"P",{});var gr=s(re);Ze=a(gr,"UniPC is a training-free framework designed for the fast sampling of diffusion models, which consists of a corrector (UniC) and a predictor (UniP) that share a unified analytical form and support arbitrary orders."),gr.forEach(r),Oe=p(t),v=n(t,"P",{});var le=s(v);et=a(le,"For more details about the method, please refer to the "),B=n(le,"A",{href:!0,rel:!0});var vr=s(B);tt=a(vr,"[paper]"),vr.forEach(r),rt=a(le," and the "),H=n(le,"A",{href:!0,rel:!0});var br=s(H);ot=a(br,"[code]"),br.forEach(r),nt=a(le,"."),le.forEach(r),ke=p(t),oe=n(t,"P",{});var yr=s(oe);st=a(yr,"Fast Sampling of Diffusion Models with Exponential Integrator."),yr.forEach(r),Ie=p(t),M=n(t,"H2",{class:!0});var qe=s(M);F=n(qe,"A",{id:!0,class:!0,href:!0});var xr=s(F);me=n(xr,"SPAN",{});var Pr=s(me);y(z.$$.fragment,Pr),Pr.forEach(r),xr.forEach(r),it=p(qe),_e=n(qe,"SPAN",{});var Cr=s(_e);at=a(Cr,"UniPCMultistepScheduler"),Cr.forEach(r),qe.forEach(r),Ne=p(t),l=n(t,"DIV",{class:!0});var u=s(l);y(G.$$.fragment,u),dt=p(u),ge=n(u,"P",{});var Ur=s(ge);lt=a(Ur,`UniPC is a training-free framework designed for the fast sampling of diffusion models, which consists of a
corrector (UniC) and a predictor (UniP) that share a unified analytical form and support arbitrary orders. UniPC is
by desinged model-agnostic, supporting pixel-space/latent-space DPMs on unconditional/conditional sampling. It can
also be applied to both noise prediction model and data prediction model. The corrector UniC can be also applied
after any off-the-shelf solvers to increase the order of accuracy.`),Ur.forEach(r),ct=p(u),ne=n(u,"P",{});var dr=s(ne);pt=a(dr,"For more details, see the original paper: "),J=n(dr,"A",{href:!0,rel:!0});var wr=s(J);ut=a(wr,"https://arxiv.org/abs/2302.04867"),wr.forEach(r),dr.forEach(r),ht=p(u),E=n(u,"P",{});var ce=s(E);ft=a(ce,`Currently, we support the multistep UniPC for both noise prediction models and data prediction models. We recommend
to use `),ve=n(ce,"CODE",{});var $r=s(ve);mt=a($r,"solver_order=2"),$r.forEach(r),_t=a(ce," for guided sampling, and "),be=n(ce,"CODE",{});var Sr=s(be);gt=a(Sr,"solver_order=3"),Sr.forEach(r),vt=a(ce," for unconditional sampling."),ce.forEach(r),bt=p(u),g=n(u,"P",{});var V=s(g);yt=a(V,"We also support the \u201Cdynamic thresholding\u201D method in Imagen ("),R=n(V,"A",{href:!0,rel:!0});var Mr=s(R);xt=a(Mr,"https://arxiv.org/abs/2205.11487"),Mr.forEach(r),Pt=a(V,`). For pixel-space
diffusion models, you can set both `),ye=n(V,"CODE",{});var Er=s(ye);Ct=a(Er,"predict_x0=True"),Er.forEach(r),Ut=a(V," and "),xe=n(V,"CODE",{});var Tr=s(xe);wt=a(Tr,"thresholding=True"),Tr.forEach(r),$t=a(V,` to use the dynamic thresholding. Note
that the thresholding method is unsuitable for latent-space diffusion models (such as stable-diffusion).`),V.forEach(r),St=p(u),h=n(u,"P",{});var m=s(h);se=n(m,"A",{href:!0});var Dr=s(se);Mt=a(Dr,"~ConfigMixin"),Dr.forEach(r),Et=a(m," takes care of storing all config attributes that are passed in the scheduler\u2019s "),Pe=n(m,"CODE",{});var Fr=s(Pe);Tt=a(Fr,"__init__"),Fr.forEach(r),Dt=a(m,`
function, such as `),Ce=n(m,"CODE",{});var Ar=s(Ce);Ft=a(Ar,"num_train_timesteps"),Ar.forEach(r),At=a(m,". They can be accessed via "),Ue=n(m,"CODE",{});var Or=s(Ue);Ot=a(Or,"scheduler.config.num_train_timesteps"),Or.forEach(r),kt=a(m,`.
`),ie=n(m,"A",{href:!0});var kr=s(ie);It=a(kr,"SchedulerMixin"),kr.forEach(r),Nt=a(m," provides general loading and saving functionality via the "),ae=n(m,"A",{href:!0});var Ir=s(ae);Lt=a(Ir,"SchedulerMixin.save_pretrained()"),Ir.forEach(r),Vt=a(m,` and
`),de=n(m,"A",{href:!0});var Nr=s(de);Wt=a(Nr,"from_pretrained()"),Nr.forEach(r),qt=a(m," functions."),m.forEach(r),Bt=p(u),A=n(u,"DIV",{class:!0});var Be=s(A);y(j.$$.fragment,Be),Ht=p(Be),we=n(Be,"P",{});var Lr=s(we);zt=a(Lr,"Convert the model output to the corresponding type that the algorithm PC needs."),Lr.forEach(r),Be.forEach(r),Gt=p(u),O=n(u,"DIV",{class:!0});var He=s(O);y(K.$$.fragment,He),Jt=p(He),$e=n(He,"P",{});var Vr=s($e);Rt=a(Vr,"One step for the UniC (B(h) version)."),Vr.forEach(r),He.forEach(r),jt=p(u),k=n(u,"DIV",{class:!0});var ze=s(k);y(Q.$$.fragment,ze),Kt=p(ze),X=n(ze,"P",{});var Ge=s(X);Qt=a(Ge,"One step for the UniP (B(h) version). Alternatively, "),Se=n(Ge,"CODE",{});var Wr=s(Se);Xt=a(Wr,"self.solver_p"),Wr.forEach(r),Yt=a(Ge," is used if is specified."),Ge.forEach(r),ze.forEach(r),Zt=p(u),I=n(u,"DIV",{class:!0});var Je=s(I);y(Y.$$.fragment,Je),er=p(Je),Me=n(Je,"P",{});var qr=s(Me);tr=a(qr,`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),qr.forEach(r),Je.forEach(r),rr=p(u),N=n(u,"DIV",{class:!0});var Re=s(N);y(Z.$$.fragment,Re),or=p(Re),Ee=n(Re,"P",{});var Br=s(Ee);nr=a(Br,"Sets the timesteps used for the diffusion chain. Supporting function to be run before inference."),Br.forEach(r),Re.forEach(r),sr=p(u),L=n(u,"DIV",{class:!0});var je=s(L);y(ee.$$.fragment,je),ir=p(je),Te=n(je,"P",{});var Hr=s(Te);ar=a(Hr,"Step function propagating the sample with the multistep UniPC."),Hr.forEach(r),je.forEach(r),u.forEach(r),this.h()},h(){d(w,"name","hf:doc:metadata"),d(w,"content",JSON.stringify(Xr)),d(T,"id","unipc"),d(T,"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(T,"href","#unipc"),d($,"class","relative group"),d(D,"id","overview"),d(D,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(D,"href","#overview"),d(S,"class","relative group"),d(B,"href","https://arxiv.org/abs/2302.04867"),d(B,"rel","nofollow"),d(H,"href","https://github.com/wl-zhao/UniPC"),d(H,"rel","nofollow"),d(F,"id","diffusers.UniPCMultistepScheduler"),d(F,"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(F,"href","#diffusers.UniPCMultistepScheduler"),d(M,"class","relative group"),d(J,"href","https://arxiv.org/abs/2302.04867"),d(J,"rel","nofollow"),d(R,"href","https://arxiv.org/abs/2205.11487"),d(R,"rel","nofollow"),d(se,"href","/docs/diffusers/main/en/api/configuration#diffusers.ConfigMixin"),d(ie,"href","/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin"),d(ae,"href","/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin.save_pretrained"),d(de,"href","/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin.from_pretrained"),d(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(O,"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(I,"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(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(t,f){e(document.head,w),_(t,De,f),_(t,$,f),e($,T),e(T,pe),x(W,pe,null),e($,Ke),e($,ue),e(ue,Qe),_(t,Fe,f),_(t,S,f),e(S,D),e(D,he),x(q,he,null),e(S,Xe),e(S,fe),e(fe,Ye),_(t,Ae,f),_(t,re,f),e(re,Ze),_(t,Oe,f),_(t,v,f),e(v,et),e(v,B),e(B,tt),e(v,rt),e(v,H),e(H,ot),e(v,nt),_(t,ke,f),_(t,oe,f),e(oe,st),_(t,Ie,f),_(t,M,f),e(M,F),e(F,me),x(z,me,null),e(M,it),e(M,_e),e(_e,at),_(t,Ne,f),_(t,l,f),x(G,l,null),e(l,dt),e(l,ge),e(ge,lt),e(l,ct),e(l,ne),e(ne,pt),e(ne,J),e(J,ut),e(l,ht),e(l,E),e(E,ft),e(E,ve),e(ve,mt),e(E,_t),e(E,be),e(be,gt),e(E,vt),e(l,bt),e(l,g),e(g,yt),e(g,R),e(R,xt),e(g,Pt),e(g,ye),e(ye,Ct),e(g,Ut),e(g,xe),e(xe,wt),e(g,$t),e(l,St),e(l,h),e(h,se),e(se,Mt),e(h,Et),e(h,Pe),e(Pe,Tt),e(h,Dt),e(h,Ce),e(Ce,Ft),e(h,At),e(h,Ue),e(Ue,Ot),e(h,kt),e(h,ie),e(ie,It),e(h,Nt),e(h,ae),e(ae,Lt),e(h,Vt),e(h,de),e(de,Wt),e(h,qt),e(l,Bt),e(l,A),x(j,A,null),e(A,Ht),e(A,we),e(we,zt),e(l,Gt),e(l,O),x(K,O,null),e(O,Jt),e(O,$e),e($e,Rt),e(l,jt),e(l,k),x(Q,k,null),e(k,Kt),e(k,X),e(X,Qt),e(X,Se),e(Se,Xt),e(X,Yt),e(l,Zt),e(l,I),x(Y,I,null),e(I,er),e(I,Me),e(Me,tr),e(l,rr),e(l,N),x(Z,N,null),e(N,or),e(N,Ee),e(Ee,nr),e(l,sr),e(l,L),x(ee,L,null),e(L,ir),e(L,Te),e(Te,ar),Le=!0},p:jr,i(t){Le||(P(W.$$.fragment,t),P(q.$$.fragment,t),P(z.$$.fragment,t),P(G.$$.fragment,t),P(j.$$.fragment,t),P(K.$$.fragment,t),P(Q.$$.fragment,t),P(Y.$$.fragment,t),P(Z.$$.fragment,t),P(ee.$$.fragment,t),Le=!0)},o(t){C(W.$$.fragment,t),C(q.$$.fragment,t),C(z.$$.fragment,t),C(G.$$.fragment,t),C(j.$$.fragment,t),C(K.$$.fragment,t),C(Q.$$.fragment,t),C(Y.$$.fragment,t),C(Z.$$.fragment,t),C(ee.$$.fragment,t),Le=!1},d(t){r(w),t&&r(De),t&&r($),U(W),t&&r(Fe),t&&r(S),U(q),t&&r(Ae),t&&r(re),t&&r(Oe),t&&r(v),t&&r(ke),t&&r(oe),t&&r(Ie),t&&r(M),U(z),t&&r(Ne),t&&r(l),U(G),U(j),U(K),U(Q),U(Y),U(Z),U(ee)}}}const Xr={local:"unipc",sections:[{local:"overview",title:"Overview"},{local:"diffusers.UniPCMultistepScheduler",title:"UniPCMultistepScheduler"}],title:"UniPC"};function Yr(cr){return Kr(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ro extends zr{constructor(w){super();Gr(this,w,Yr,Qr,Jr,{})}}export{ro as default,Xr as metadata};
