import{s as ye,n as we,o as Ce}from"../chunks/scheduler.182ea377.js";import{S as Fe,i as Oe,g as d,s as o,r as f,A as Pe,h as a,f as t,c as i,j as D,u as m,x as L,k as M,y as s,a as l,v as h,d as g,t as _,w as b}from"../chunks/index.1ea56653.js";import{H as _e,g as ke}from"../chunks/Heading.71ac6e9f.js";import{D as j}from"../chunks/Docstring.59aaf0cd.js";function Ee(be){let u,W,K,G,T,Y,y,Se='<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>.',B,w,J,r,C,ie,q,ve="A linear multistep scheduler for discrete beta schedules.",de,H,$e=`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.`,ae,S,F,ce,V,xe="Compute the linear multistep coefficient.",le,v,O,ue,A,De=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`,pe,$,P,fe,N,Le="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",me,x,k,he,z,Me=`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).`,Q,E,X,p,I,ge,U,Te="Output class for the scheduler’s <code>step</code> function output.",Z,R,ee;return T=new _e({props:{title:"LMSDiscreteScheduler",local:"lmsdiscretescheduler",headingTag:"h1"}}),w=new _e({props:{title:"LMSDiscreteScheduler",local:"diffusers.LMSDiscreteScheduler",headingTag:"h2"}}),C=new j({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"}}),F=new j({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#L215"}}),O=new j({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#L189",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.FloatTensor</code></p>
`}}),P=new j({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#L237"}}),k=new j({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#L343",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/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:`<script context="module">export const metadata = 'undefined';<\/script>


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