import{S as Ot,i as Pt,s as At,e as s,k as d,w as D,t as a,M as Ft,c as o,d as r,m as l,a as n,x as y,h as c,b as i,G as e,g as f,y as L,L as Ct,q as M,o as w,B as x,v as Nt}from"../../../chunks/vendor-hf-doc-builder.js";import{D as Q}from"../../../chunks/Docstring-hf-doc-builder.js";import{I as dt}from"../../../chunks/IconCopyLink-hf-doc-builder.js";function It(lt){let g,ue,_,T,X,C,xe,Z,Te,pe,m,ee,Ee,ke,N,Oe,Pe,I,Ae,Fe,he,v,E,te,q,Ce,re,Ne,fe,u,V,Ie,se,qe,Ve,S,Ue,J,ze,He,Y,Ke,Re,We,k,U,Be,oe,Ge,Je,O,z,Ye,ne,je,Qe,P,H,Xe,ie,Ze,et,A,K,tt,ae,rt,me,b,F,ce,R,st,de,ot,ge,$,W,nt,B,it,le,at,ct,_e;return C=new dt({}),q=new dt({}),V=new Q({props:{name:"class diffusers.LMSDiscreteScheduler",anchor:"diffusers.LMSDiscreteScheduler",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:"use_karras_sigmas",val:": typing.Optional[bool] = False"},{name:"prediction_type",val:": str = 'epsilon'"},{name:"timestep_spacing",val:": str = 'linspace'"},{name:"steps_offset",val:": int = 0"}],parametersDescription:[{anchor:"diffusers.LMSDiscreteScheduler.num_train_timesteps",description:`<strong>num_train_timesteps</strong> (<code>int</code>, defaults to 1000) &#x2014;
The number of diffusion steps to train the model.`,name:"num_train_timesteps"},{anchor:"diffusers.LMSDiscreteScheduler.beta_start",description:`<strong>beta_start</strong> (<code>float</code>, defaults to 0.0001) &#x2014;
The starting <code>beta</code> value of inference.`,name:"beta_start"},{anchor:"diffusers.LMSDiscreteScheduler.beta_end",description:`<strong>beta_end</strong> (<code>float</code>, defaults to 0.02) &#x2014;
The final <code>beta</code> value.`,name:"beta_end"},{anchor:"diffusers.LMSDiscreteScheduler.beta_schedule",description:`<strong>beta_schedule</strong> (<code>str</code>, defaults to <code>&quot;linear&quot;</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> or <code>scaled_linear</code>.`,name:"beta_schedule"},{anchor:"diffusers.LMSDiscreteScheduler.trained_betas",description:`<strong>trained_betas</strong> (<code>np.ndarray</code>, <em>optional</em>) &#x2014;
Pass an array of betas directly to the constructor to bypass <code>beta_start</code> and <code>beta_end</code>.`,name:"trained_betas"},{anchor:"diffusers.LMSDiscreteScheduler.use_karras_sigmas",description:`<strong>use_karras_sigmas</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use Karras sigmas for step sizes in the noise schedule during the sampling process. If <code>True</code>,
the sigmas are determined according to a sequence of noise levels {&#x3C3;i}.`,name:"use_karras_sigmas"},{anchor:"diffusers.LMSDiscreteScheduler.prediction_type",description:`<strong>prediction_type</strong> (<code>str</code>, defaults to <code>epsilon</code>, <em>optional</em>) &#x2014;
Prediction type of the scheduler function; can be <code>epsilon</code> (predicts the noise of the diffusion process),
<code>sample</code> (directly predicts the noisy sample<code>) or </code>v_prediction\` (see section 2.4 of <a href="https://imagen.research.google/video/paper.pdf" rel="nofollow">Imagen
Video</a> paper).`,name:"prediction_type"},{anchor:"diffusers.LMSDiscreteScheduler.timestep_spacing",description:`<strong>timestep_spacing</strong> (<code>str</code>, defaults to <code>&quot;linspace&quot;</code>) &#x2014;
The way the timesteps should be scaled. Refer to Table 2 of the <a href="https://huggingface.co/papers/2305.08891" rel="nofollow">Common Diffusion Noise Schedules and
Sample Steps are Flawed</a> for more information.`,name:"timestep_spacing"},{anchor:"diffusers.LMSDiscreteScheduler.steps_offset",description:`<strong>steps_offset</strong> (<code>int</code>, defaults to 0) &#x2014;
An offset added to the inference steps. You can use a combination of <code>offset=1</code> and
<code>set_alpha_to_one=False</code> to make the last step use step 0 for the previous alpha product like in Stable
Diffusion.`,name:"steps_offset"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_lms_discrete.py#L92"}}),U=new Q({props:{name:"get_lms_coefficient",anchor:"diffusers.LMSDiscreteScheduler.get_lms_coefficient",parameters:[{name:"order",val:""},{name:"t",val:""},{name:"current_order",val:""}],parametersDescription:[{anchor:"diffusers.LMSDiscreteScheduler.get_lms_coefficient.order",description:"<strong>order</strong> () &#x2014;",name:"order"},{anchor:"diffusers.LMSDiscreteScheduler.get_lms_coefficient.t",description:"<strong>t</strong> () &#x2014;",name:"t"},{anchor:"diffusers.LMSDiscreteScheduler.get_lms_coefficient.current_order",description:"<strong>current_order</strong> () &#x2014;",name:"current_order"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_lms_discrete.py#L205"}}),z=new Q({props:{name:"scale_model_input",anchor:"diffusers.LMSDiscreteScheduler.scale_model_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"timestep",val:": typing.Union[float, torch.FloatTensor]"}],parametersDescription:[{anchor:"diffusers.LMSDiscreteScheduler.scale_model_input.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
The input sample.`,name:"sample"},{anchor:"diffusers.LMSDiscreteScheduler.scale_model_input.timestep",description:`<strong>timestep</strong> (<code>float</code> or <code>torch.FloatTensor</code>) &#x2014;
The current timestep in the diffusion chain.`,name:"timestep"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_lms_discrete.py#L180",returnDescription:`
<p>A scaled input sample.</p>
`,returnType:`
<p><code>torch.FloatTensor</code></p>
`}}),H=new Q({props:{name:"set_timesteps",anchor:"diffusers.LMSDiscreteScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": typing.Union[str, torch.device] = None"}],parametersDescription:[{anchor:"diffusers.LMSDiscreteScheduler.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.LMSDiscreteScheduler.set_timesteps.device",description:`<strong>device</strong> (<code>str</code> or <code>torch.device</code>, <em>optional</em>) &#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_lms_discrete.py#L227"}}),K=new Q({props:{name:"step",anchor:"diffusers.LMSDiscreteScheduler.step",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": typing.Union[float, torch.FloatTensor]"},{name:"sample",val:": FloatTensor"},{name:"order",val:": int = 4"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.LMSDiscreteScheduler.step.model_output",description:`<strong>model_output</strong> (<code>torch.FloatTensor</code>) &#x2014;
The direct output from learned diffusion model.`,name:"model_output"},{anchor:"diffusers.LMSDiscreteScheduler.step.timestep",description:`<strong>timestep</strong> (<code>float</code> or <code>torch.FloatTensor</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.LMSDiscreteScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
A current instance of a sample created by the diffusion process.`,name:"sample"},{anchor:"diffusers.LMSDiscreteScheduler.step.order",description:`<strong>order</strong> (<code>int</code>, defaults to 4) &#x2014;
The order of the linear multistep method.`,name:"order"},{anchor:"diffusers.LMSDiscreteScheduler.step.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/main/en/api/schedulers/dpm_discrete#diffusers.schedulers.scheduling_utils.SchedulerOutput">SchedulerOutput</a> or tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_lms_discrete.py#L318",returnDescription:`
<p>If return_dict is <code>True</code>, <a
  href="/docs/diffusers/main/en/api/schedulers/dpm_discrete#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> is returned, otherwise a
tuple is returned where the first element is the sample tensor.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/main/en/api/schedulers/dpm_discrete#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> or <code>tuple</code></p>
`}}),R=new dt({}),W=new Q({props:{name:"class diffusers.schedulers.scheduling_lms_discrete.LMSDiscreteSchedulerOutput",anchor:"diffusers.schedulers.scheduling_lms_discrete.LMSDiscreteSchedulerOutput",parameters:[{name:"prev_sample",val:": FloatTensor"},{name:"pred_original_sample",val:": typing.Optional[torch.FloatTensor] = None"}],parametersDescription:[{anchor:"diffusers.schedulers.scheduling_lms_discrete.LMSDiscreteSchedulerOutput.prev_sample",description:`<strong>prev_sample</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code> for images) &#x2014;
Computed sample <code>(x_{t-1})</code> of previous timestep. <code>prev_sample</code> should be used as next model input in the
denoising loop.`,name:"prev_sample"},{anchor:"diffusers.schedulers.scheduling_lms_discrete.LMSDiscreteSchedulerOutput.pred_original_sample",description:`<strong>pred_original_sample</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code> for images) &#x2014;
The predicted denoised sample <code>(x_{0})</code> based on the model output from the current timestep.
<code>pred_original_sample</code> can be used to preview progress or for guidance.`,name:"pred_original_sample"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_lms_discrete.py#L30"}}),{c(){g=s("meta"),ue=d(),_=s("h1"),T=s("a"),X=s("span"),D(C.$$.fragment),xe=d(),Z=s("span"),Te=a("LMSDiscreteScheduler"),pe=d(),m=s("p"),ee=s("code"),Ee=a("LMSDiscreteScheduler"),ke=a(" is a linear multistep scheduler for discrete beta schedules. The scheduler is ported from and created by "),N=s("a"),Oe=a("Katherine Crowson"),Pe=a(", and the original implementation can be found at "),I=s("a"),Ae=a("crowsonkb/k-diffusion"),Fe=a("."),he=d(),v=s("h2"),E=s("a"),te=s("span"),D(q.$$.fragment),Ce=d(),re=s("span"),Ne=a("LMSDiscreteScheduler"),fe=d(),u=s("div"),D(V.$$.fragment),Ie=d(),se=s("p"),qe=a("A linear multistep scheduler for discrete beta schedules."),Ve=d(),S=s("p"),Ue=a("This model inherits from "),J=s("a"),ze=a("SchedulerMixin"),He=a(" and "),Y=s("a"),Ke=a("ConfigMixin"),Re=a(`. Check the superclass documentation for the generic
methods the library implements for all schedulers such as loading and saving.`),We=d(),k=s("div"),D(U.$$.fragment),Be=d(),oe=s("p"),Ge=a("Compute the linear multistep coefficient."),Je=d(),O=s("div"),D(z.$$.fragment),Ye=d(),ne=s("p"),je=a(`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),Qe=d(),P=s("div"),D(H.$$.fragment),Xe=d(),ie=s("p"),Ze=a("Sets the discrete timesteps used for the diffusion chain (to be run before inference)."),et=d(),A=s("div"),D(K.$$.fragment),tt=d(),ae=s("p"),rt=a(`Predict the sample from the previous timestep by reversing the SDE. This function propagates the diffusion
process from the learned model outputs (most often the predicted noise).`),me=d(),b=s("h2"),F=s("a"),ce=s("span"),D(R.$$.fragment),st=d(),de=s("span"),ot=a("LMSDiscreteSchedulerOutput"),ge=d(),$=s("div"),D(W.$$.fragment),nt=d(),B=s("p"),it=a("Output class for the scheduler\u2019s "),le=s("code"),at=a("step"),ct=a(" function output."),this.h()},l(t){const p=Ft('[data-svelte="svelte-1phssyn"]',document.head);g=o(p,"META",{name:!0,content:!0}),p.forEach(r),ue=l(t),_=o(t,"H1",{class:!0});var ve=n(_);T=o(ve,"A",{id:!0,class:!0,href:!0});var ut=n(T);X=o(ut,"SPAN",{});var pt=n(X);y(C.$$.fragment,pt),pt.forEach(r),ut.forEach(r),xe=l(ve),Z=o(ve,"SPAN",{});var ht=n(Z);Te=c(ht,"LMSDiscreteScheduler"),ht.forEach(r),ve.forEach(r),pe=l(t),m=o(t,"P",{});var G=n(m);ee=o(G,"CODE",{});var ft=n(ee);Ee=c(ft,"LMSDiscreteScheduler"),ft.forEach(r),ke=c(G," is a linear multistep scheduler for discrete beta schedules. The scheduler is ported from and created by "),N=o(G,"A",{href:!0,rel:!0});var mt=n(N);Oe=c(mt,"Katherine Crowson"),mt.forEach(r),Pe=c(G,", and the original implementation can be found at "),I=o(G,"A",{href:!0,rel:!0});var gt=n(I);Ae=c(gt,"crowsonkb/k-diffusion"),gt.forEach(r),Fe=c(G,"."),G.forEach(r),he=l(t),v=o(t,"H2",{class:!0});var Se=n(v);E=o(Se,"A",{id:!0,class:!0,href:!0});var _t=n(E);te=o(_t,"SPAN",{});var vt=n(te);y(q.$$.fragment,vt),vt.forEach(r),_t.forEach(r),Ce=l(Se),re=o(Se,"SPAN",{});var St=n(re);Ne=c(St,"LMSDiscreteScheduler"),St.forEach(r),Se.forEach(r),fe=l(t),u=o(t,"DIV",{class:!0});var h=n(u);y(V.$$.fragment,h),Ie=l(h),se=o(h,"P",{});var bt=n(se);qe=c(bt,"A linear multistep scheduler for discrete beta schedules."),bt.forEach(r),Ve=l(h),S=o(h,"P",{});var j=n(S);Ue=c(j,"This model inherits from "),J=o(j,"A",{href:!0});var $t=n(J);ze=c($t,"SchedulerMixin"),$t.forEach(r),He=c(j," and "),Y=o(j,"A",{href:!0});var Dt=n(Y);Ke=c(Dt,"ConfigMixin"),Dt.forEach(r),Re=c(j,`. Check the superclass documentation for the generic
methods the library implements for all schedulers such as loading and saving.`),j.forEach(r),We=l(h),k=o(h,"DIV",{class:!0});var be=n(k);y(U.$$.fragment,be),Be=l(be),oe=o(be,"P",{});var yt=n(oe);Ge=c(yt,"Compute the linear multistep coefficient."),yt.forEach(r),be.forEach(r),Je=l(h),O=o(h,"DIV",{class:!0});var $e=n(O);y(z.$$.fragment,$e),Ye=l($e),ne=o($e,"P",{});var Lt=n(ne);je=c(Lt,`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`),Lt.forEach(r),$e.forEach(r),Qe=l(h),P=o(h,"DIV",{class:!0});var De=n(P);y(H.$$.fragment,De),Xe=l(De),ie=o(De,"P",{});var Mt=n(ie);Ze=c(Mt,"Sets the discrete timesteps used for the diffusion chain (to be run before inference)."),Mt.forEach(r),De.forEach(r),et=l(h),A=o(h,"DIV",{class:!0});var ye=n(A);y(K.$$.fragment,ye),tt=l(ye),ae=o(ye,"P",{});var wt=n(ae);rt=c(wt,`Predict the sample from the previous timestep by reversing the SDE. This function propagates the diffusion
process from the learned model outputs (most often the predicted noise).`),wt.forEach(r),ye.forEach(r),h.forEach(r),me=l(t),b=o(t,"H2",{class:!0});var Le=n(b);F=o(Le,"A",{id:!0,class:!0,href:!0});var xt=n(F);ce=o(xt,"SPAN",{});var Tt=n(ce);y(R.$$.fragment,Tt),Tt.forEach(r),xt.forEach(r),st=l(Le),de=o(Le,"SPAN",{});var Et=n(de);ot=c(Et,"LMSDiscreteSchedulerOutput"),Et.forEach(r),Le.forEach(r),ge=l(t),$=o(t,"DIV",{class:!0});var Me=n($);y(W.$$.fragment,Me),nt=l(Me),B=o(Me,"P",{});var we=n(B);it=c(we,"Output class for the scheduler\u2019s "),le=o(we,"CODE",{});var kt=n(le);at=c(kt,"step"),kt.forEach(r),ct=c(we," function output."),we.forEach(r),Me.forEach(r),this.h()},h(){i(g,"name","hf:doc:metadata"),i(g,"content",JSON.stringify(qt)),i(T,"id","lmsdiscretescheduler"),i(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"),i(T,"href","#lmsdiscretescheduler"),i(_,"class","relative group"),i(N,"href","https://github.com/crowsonkb/"),i(N,"rel","nofollow"),i(I,"href","https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L181"),i(I,"rel","nofollow"),i(E,"id","diffusers.LMSDiscreteScheduler"),i(E,"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"),i(E,"href","#diffusers.LMSDiscreteScheduler"),i(v,"class","relative group"),i(J,"href","/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin"),i(Y,"href","/docs/diffusers/main/en/api/configuration#diffusers.ConfigMixin"),i(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(F,"id","diffusers.schedulers.scheduling_lms_discrete.LMSDiscreteSchedulerOutput"),i(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"),i(F,"href","#diffusers.schedulers.scheduling_lms_discrete.LMSDiscreteSchedulerOutput"),i(b,"class","relative group"),i($,"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,p){e(document.head,g),f(t,ue,p),f(t,_,p),e(_,T),e(T,X),L(C,X,null),e(_,xe),e(_,Z),e(Z,Te),f(t,pe,p),f(t,m,p),e(m,ee),e(ee,Ee),e(m,ke),e(m,N),e(N,Oe),e(m,Pe),e(m,I),e(I,Ae),e(m,Fe),f(t,he,p),f(t,v,p),e(v,E),e(E,te),L(q,te,null),e(v,Ce),e(v,re),e(re,Ne),f(t,fe,p),f(t,u,p),L(V,u,null),e(u,Ie),e(u,se),e(se,qe),e(u,Ve),e(u,S),e(S,Ue),e(S,J),e(J,ze),e(S,He),e(S,Y),e(Y,Ke),e(S,Re),e(u,We),e(u,k),L(U,k,null),e(k,Be),e(k,oe),e(oe,Ge),e(u,Je),e(u,O),L(z,O,null),e(O,Ye),e(O,ne),e(ne,je),e(u,Qe),e(u,P),L(H,P,null),e(P,Xe),e(P,ie),e(ie,Ze),e(u,et),e(u,A),L(K,A,null),e(A,tt),e(A,ae),e(ae,rt),f(t,me,p),f(t,b,p),e(b,F),e(F,ce),L(R,ce,null),e(b,st),e(b,de),e(de,ot),f(t,ge,p),f(t,$,p),L(W,$,null),e($,nt),e($,B),e(B,it),e(B,le),e(le,at),e(B,ct),_e=!0},p:Ct,i(t){_e||(M(C.$$.fragment,t),M(q.$$.fragment,t),M(V.$$.fragment,t),M(U.$$.fragment,t),M(z.$$.fragment,t),M(H.$$.fragment,t),M(K.$$.fragment,t),M(R.$$.fragment,t),M(W.$$.fragment,t),_e=!0)},o(t){w(C.$$.fragment,t),w(q.$$.fragment,t),w(V.$$.fragment,t),w(U.$$.fragment,t),w(z.$$.fragment,t),w(H.$$.fragment,t),w(K.$$.fragment,t),w(R.$$.fragment,t),w(W.$$.fragment,t),_e=!1},d(t){r(g),t&&r(ue),t&&r(_),x(C),t&&r(pe),t&&r(m),t&&r(he),t&&r(v),x(q),t&&r(fe),t&&r(u),x(V),x(U),x(z),x(H),x(K),t&&r(me),t&&r(b),x(R),t&&r(ge),t&&r($),x(W)}}}const qt={local:"lmsdiscretescheduler",sections:[{local:"diffusers.LMSDiscreteScheduler",title:"LMSDiscreteScheduler"},{local:"diffusers.schedulers.scheduling_lms_discrete.LMSDiscreteSchedulerOutput",title:"LMSDiscreteSchedulerOutput"}],title:"LMSDiscreteScheduler"};function Vt(lt){return Nt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Kt extends Ot{constructor(g){super();Pt(this,g,Vt,It,At,{})}}export{Kt as default,qt as metadata};
