import{s as Ve,n as Fe,o as Ne}from"../chunks/scheduler.53228c21.js";import{S as Ae,i as Ue,e as d,s as n,c as u,h as We,a,d as s,b as o,f as S,g as p,j as v,k as $,l as t,m as l,n as m,t as f,o as h,p as g}from"../chunks/index.100fac89.js";import{C as Re}from"../chunks/CopyLLMTxtMenu.4f0519ef.js";import{D as N}from"../chunks/Docstring.d02a9fa5.js";import{H as Te,E as je}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.62dbb7c4.js";function Ke(we){let _,Q,Y,X,T,Z,w,ee,C,Ce='<code>LMSDiscreteScheduler</code> is a linear multistep scheduler for discrete beta schedules. The scheduler is ported from and created by <a href="https://github.com/crowsonkb/" rel="nofollow">Katherine Crowson</a>, and the original implementation can be found at <a href="https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L181" rel="nofollow">crowsonkb/k-diffusion</a>.',te,O,se,i,P,fe,A,Oe="A linear multistep scheduler for discrete beta schedules.",he,U,Pe=`This model inherits from <a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a> and <a href="/docs/diffusers/main/en/api/configuration#diffusers.ConfigMixin">ConfigMixin</a>. Check the superclass documentation for the generic
methods the library implements for all schedulers such as loading and saving.`,ge,x,k,_e,W,ke="Compute the linear multistep coefficient.",be,D,E,Se,R,Ee=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`,ve,L,I,$e,j,Ie="Sets the begin index for the scheduler. This function should be run from pipeline before the inference.",xe,M,q,De,K,qe="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",Le,y,z,Me,B,ze=`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).`,re,H,ne,b,V,ye,G,He="Output class for the scheduler’s <code>step</code> function output.",oe,F,ie,J,de;return T=new Re({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),w=new Te({props:{title:"LMSDiscreteScheduler",local:"lmsdiscretescheduler",headingTag:"h1"}}),O=new Te({props:{title:"LMSDiscreteScheduler",local:"diffusers.LMSDiscreteScheduler",headingTag:"h2"}}),P=new N({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:"use_exponential_sigmas",val:": typing.Optional[bool] = False"},{name:"use_beta_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.use_exponential_sigmas",description:`<strong>use_exponential_sigmas</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use exponential sigmas for step sizes in the noise schedule during the sampling process.`,name:"use_exponential_sigmas"},{anchor:"diffusers.LMSDiscreteScheduler.use_beta_sigmas",description:`<strong>use_beta_sigmas</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use beta sigmas for step sizes in the noise schedule during the sampling process. Refer to <a href="https://huggingface.co/papers/2407.12173" rel="nofollow">Beta
Sampling is All You Need</a> for more information.`,name:"use_beta_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, as required by some model families.`,name:"steps_offset"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_lms_discrete.py#L93"}}),k=new N({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#L241"}}),E=new N({props:{name:"scale_model_input",anchor:"diffusers.LMSDiscreteScheduler.scale_model_input",parameters:[{name:"sample",val:": Tensor"},{name:"timestep",val:": typing.Union[float, torch.Tensor]"}],parametersDescription:[{anchor:"diffusers.LMSDiscreteScheduler.scale_model_input.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
The input sample.`,name:"sample"},{anchor:"diffusers.LMSDiscreteScheduler.scale_model_input.timestep",description:`<strong>timestep</strong> (<code>float</code> or <code>torch.Tensor</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#L217",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A scaled input sample.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.Tensor</code></p>
`}}),I=new N({props:{name:"set_begin_index",anchor:"diffusers.LMSDiscreteScheduler.set_begin_index",parameters:[{name:"begin_index",val:": int = 0"}],parametersDescription:[{anchor:"diffusers.LMSDiscreteScheduler.set_begin_index.begin_index",description:`<strong>begin_index</strong> (<code>int</code>) &#x2014;
The begin index for the scheduler.`,name:"begin_index"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_lms_discrete.py#L207"}}),q=new N({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#L263"}}),z=new N({props:{name:"step",anchor:"diffusers.LMSDiscreteScheduler.step",parameters:[{name:"model_output",val:": Tensor"},{name:"timestep",val:": typing.Union[float, torch.Tensor]"},{name:"sample",val:": Tensor"},{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.Tensor</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.Tensor</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.LMSDiscreteScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.Tensor</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/edm_multistep_dpm_solver#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#L437",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If return_dict is <code>True</code>, <a
  href="/docs/diffusers/main/en/api/schedulers/edm_multistep_dpm_solver#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> is returned, otherwise a
tuple is returned where the first element is the sample tensor.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/diffusers/main/en/api/schedulers/edm_multistep_dpm_solver#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> or <code>tuple</code></p>
`}}),H=new Te({props:{title:"LMSDiscreteSchedulerOutput",local:"diffusers.schedulers.scheduling_lms_discrete.LMSDiscreteSchedulerOutput",headingTag:"h2"}}),V=new N({props:{name:"class diffusers.schedulers.scheduling_lms_discrete.LMSDiscreteSchedulerOutput",anchor:"diffusers.schedulers.scheduling_lms_discrete.LMSDiscreteSchedulerOutput",parameters:[{name:"prev_sample",val:": Tensor"},{name:"pred_original_sample",val:": typing.Optional[torch.Tensor] = None"}],parametersDescription:[{anchor:"diffusers.schedulers.scheduling_lms_discrete.LMSDiscreteSchedulerOutput.prev_sample",description:`<strong>prev_sample</strong> (<code>torch.Tensor</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.Tensor</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#L31"}}),F=new je({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/schedulers/lms_discrete.md"}}),{c(){_=d("meta"),Q=n(),Y=d("p"),X=n(),u(T.$$.fragment),Z=n(),u(w.$$.fragment),ee=n(),C=d("p"),C.innerHTML=Ce,te=n(),u(O.$$.fragment),se=n(),i=d("div"),u(P.$$.fragment),fe=n(),A=d("p"),A.textContent=Oe,he=n(),U=d("p"),U.innerHTML=Pe,ge=n(),x=d("div"),u(k.$$.fragment),_e=n(),W=d("p"),W.textContent=ke,be=n(),D=d("div"),u(E.$$.fragment),Se=n(),R=d("p"),R.textContent=Ee,ve=n(),L=d("div"),u(I.$$.fragment),$e=n(),j=d("p"),j.textContent=Ie,xe=n(),M=d("div"),u(q.$$.fragment),De=n(),K=d("p"),K.textContent=qe,Le=n(),y=d("div"),u(z.$$.fragment),Me=n(),B=d("p"),B.textContent=ze,re=n(),u(H.$$.fragment),ne=n(),b=d("div"),u(V.$$.fragment),ye=n(),G=d("p"),G.innerHTML=He,oe=n(),u(F.$$.fragment),ie=n(),J=d("p"),this.h()},l(e){const r=We("svelte-u9bgzb",document.head);_=a(r,"META",{name:!0,content:!0}),r.forEach(s),Q=o(e),Y=a(e,"P",{}),S(Y).forEach(s),X=o(e),p(T.$$.fragment,e),Z=o(e),p(w.$$.fragment,e),ee=o(e),C=a(e,"P",{"data-svelte-h":!0}),v(C)!=="svelte-1otp9cb"&&(C.innerHTML=Ce),te=o(e),p(O.$$.fragment,e),se=o(e),i=a(e,"DIV",{class:!0});var c=S(i);p(P.$$.fragment,c),fe=o(c),A=a(c,"P",{"data-svelte-h":!0}),v(A)!=="svelte-1s0vl92"&&(A.textContent=Oe),he=o(c),U=a(c,"P",{"data-svelte-h":!0}),v(U)!=="svelte-linuuh"&&(U.innerHTML=Pe),ge=o(c),x=a(c,"DIV",{class:!0});var ae=S(x);p(k.$$.fragment,ae),_e=o(ae),W=a(ae,"P",{"data-svelte-h":!0}),v(W)!=="svelte-l6j38t"&&(W.textContent=ke),ae.forEach(s),be=o(c),D=a(c,"DIV",{class:!0});var ce=S(D);p(E.$$.fragment,ce),Se=o(ce),R=a(ce,"P",{"data-svelte-h":!0}),v(R)!=="svelte-1rkfgpx"&&(R.textContent=Ee),ce.forEach(s),ve=o(c),L=a(c,"DIV",{class:!0});var le=S(L);p(I.$$.fragment,le),$e=o(le),j=a(le,"P",{"data-svelte-h":!0}),v(j)!=="svelte-1k141rk"&&(j.textContent=Ie),le.forEach(s),xe=o(c),M=a(c,"DIV",{class:!0});var ue=S(M);p(q.$$.fragment,ue),De=o(ue),K=a(ue,"P",{"data-svelte-h":!0}),v(K)!=="svelte-1vzm9q"&&(K.textContent=qe),ue.forEach(s),Le=o(c),y=a(c,"DIV",{class:!0});var pe=S(y);p(z.$$.fragment,pe),Me=o(pe),B=a(pe,"P",{"data-svelte-h":!0}),v(B)!=="svelte-hi84tp"&&(B.textContent=ze),pe.forEach(s),c.forEach(s),re=o(e),p(H.$$.fragment,e),ne=o(e),b=a(e,"DIV",{class:!0});var me=S(b);p(V.$$.fragment,me),ye=o(me),G=a(me,"P",{"data-svelte-h":!0}),v(G)!=="svelte-id9kic"&&(G.innerHTML=He),me.forEach(s),oe=o(e),p(F.$$.fragment,e),ie=o(e),J=a(e,"P",{}),S(J).forEach(s),this.h()},h(){$(_,"name","hf:doc:metadata"),$(_,"content",Be),$(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,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(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,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(i,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,r){t(document.head,_),l(e,Q,r),l(e,Y,r),l(e,X,r),m(T,e,r),l(e,Z,r),m(w,e,r),l(e,ee,r),l(e,C,r),l(e,te,r),m(O,e,r),l(e,se,r),l(e,i,r),m(P,i,null),t(i,fe),t(i,A),t(i,he),t(i,U),t(i,ge),t(i,x),m(k,x,null),t(x,_e),t(x,W),t(i,be),t(i,D),m(E,D,null),t(D,Se),t(D,R),t(i,ve),t(i,L),m(I,L,null),t(L,$e),t(L,j),t(i,xe),t(i,M),m(q,M,null),t(M,De),t(M,K),t(i,Le),t(i,y),m(z,y,null),t(y,Me),t(y,B),l(e,re,r),m(H,e,r),l(e,ne,r),l(e,b,r),m(V,b,null),t(b,ye),t(b,G),l(e,oe,r),m(F,e,r),l(e,ie,r),l(e,J,r),de=!0},p:Fe,i(e){de||(f(T.$$.fragment,e),f(w.$$.fragment,e),f(O.$$.fragment,e),f(P.$$.fragment,e),f(k.$$.fragment,e),f(E.$$.fragment,e),f(I.$$.fragment,e),f(q.$$.fragment,e),f(z.$$.fragment,e),f(H.$$.fragment,e),f(V.$$.fragment,e),f(F.$$.fragment,e),de=!0)},o(e){h(T.$$.fragment,e),h(w.$$.fragment,e),h(O.$$.fragment,e),h(P.$$.fragment,e),h(k.$$.fragment,e),h(E.$$.fragment,e),h(I.$$.fragment,e),h(q.$$.fragment,e),h(z.$$.fragment,e),h(H.$$.fragment,e),h(V.$$.fragment,e),h(F.$$.fragment,e),de=!1},d(e){e&&(s(Q),s(Y),s(X),s(Z),s(ee),s(C),s(te),s(se),s(i),s(re),s(ne),s(b),s(oe),s(ie),s(J)),s(_),g(T,e),g(w,e),g(O,e),g(P),g(k),g(E),g(I),g(q),g(z),g(H,e),g(V),g(F,e)}}}const Be='{"title":"LMSDiscreteScheduler","local":"lmsdiscretescheduler","sections":[{"title":"LMSDiscreteScheduler","local":"diffusers.LMSDiscreteScheduler","sections":[],"depth":2},{"title":"LMSDiscreteSchedulerOutput","local":"diffusers.schedulers.scheduling_lms_discrete.LMSDiscreteSchedulerOutput","sections":[],"depth":2}],"depth":1}';function Ge(we){return Ne(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class et extends Ae{constructor(_){super(),Ue(this,_,Ge,Ke,Ve,{})}}export{et as component};
