import{s as Ee,n as Ie,o as qe}from"../chunks/scheduler.182ea377.js";import{S as He,i as Ve,g as d,s as n,r as u,A as Ae,h as c,f as s,c as o,j as v,u as p,x as S,k as x,y as t,a as l,v as f,d as m,t as h,w as g}from"../chunks/index.abf12888.js";import{D as V}from"../chunks/Docstring.93f6f462.js";import{H as De}from"../chunks/Heading.16916d63.js";function ze(Le){let _,J,B,Q,w,X,y,Me='<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>.',Y,C,Z,r,P,le,A,Te="A linear multistep scheduler for discrete beta schedules.",ue,z,we=`This model inherits from <a href="/docs/diffusers/v0.27.0/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a> and <a href="/docs/diffusers/v0.27.0/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.`,pe,$,O,fe,N,ye="Compute the linear multistep coefficient.",me,D,k,he,U,Ce=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`,ge,L,F,_e,j,Pe="Sets the begin index for the scheduler. This function should be run from pipeline before the inference.",be,M,E,ve,K,Oe="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",Se,T,I,xe,R,ke=`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).`,ee,q,te,b,H,$e,W,Fe="Output class for the scheduler’s <code>step</code> function output.",se,G,re;return w=new De({props:{title:"LMSDiscreteScheduler",local:"lmsdiscretescheduler",headingTag:"h1"}}),C=new De({props:{title:"LMSDiscreteScheduler",local:"diffusers.LMSDiscreteScheduler",headingTag:"h2"}}),P=new V({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:": Union = None"},{name:"use_karras_sigmas",val:": Optional = 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, as required by some model families.`,name:"steps_offset"}],source:"https://github.com/huggingface/diffusers/blob/v0.27.0/src/diffusers/schedulers/scheduling_lms_discrete.py#L92"}}),O=new V({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/v0.27.0/src/diffusers/schedulers/scheduling_lms_discrete.py#L231"}}),k=new V({props:{name:"scale_model_input",anchor:"diffusers.LMSDiscreteScheduler.scale_model_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"timestep",val:": Union"}],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/v0.27.0/src/diffusers/schedulers/scheduling_lms_discrete.py#L205",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>
`}}),F=new V({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/v0.27.0/src/diffusers/schedulers/scheduling_lms_discrete.py#L195"}}),E=new V({props:{name:"set_timesteps",anchor:"diffusers.LMSDiscreteScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": Union = 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/v0.27.0/src/diffusers/schedulers/scheduling_lms_discrete.py#L253"}}),I=new V({props:{name:"step",anchor:"diffusers.LMSDiscreteScheduler.step",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": Union"},{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/v0.27.0/en/api/schedulers/overview#diffusers.schedulers.scheduling_utils.SchedulerOutput">SchedulerOutput</a> or tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.27.0/src/diffusers/schedulers/scheduling_lms_discrete.py#L367",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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