import{s as Le,n as Ee,o as Ie}from"../chunks/scheduler.182ea377.js";import{S as qe,i as He,g as i,s as n,r as l,A as Ae,h as a,f as s,c as o,j as b,u as p,x as $,k as x,y as t,a as u,v as f,d as h,t as m,w as g}from"../chunks/index.abf12888.js";import{D as H}from"../chunks/Docstring.93f6f462.js";import{H as De}from"../chunks/Heading.16916d63.js";function Ve(Pe){let _,J,B,Q,w,X,N,Te='<code>PNDMScheduler</code>, or pseudo numerical methods for diffusion models, uses more advanced ODE integration techniques like the Runge-Kutta and linear multi-step method. 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,y,Z,r,k,ue,A,Me=`<code>PNDMScheduler</code> uses pseudo numerical methods for diffusion models such as the Runge-Kutta and linear multi-step
method.`,le,V,we=`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.`,pe,S,O,fe,R,Ne=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`,he,D,C,me,K,ye="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",ge,P,F,_e,W,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), and calls <a href="/docs/diffusers/main/en/api/schedulers/pndm#diffusers.PNDMScheduler.step_prk">step_prk()</a>
or <a href="/docs/diffusers/main/en/api/schedulers/pndm#diffusers.PNDMScheduler.step_plms">step_plms()</a> depending on the internal variable <code>counter</code>.`,ve,T,L,be,z,Oe=`Predict the sample from the previous timestep by reversing the SDE. This function propagates the sample with
the linear multistep method. It performs one forward pass multiple times to approximate the solution.`,$e,M,E,xe,U,Ce=`Predict the sample from the previous timestep by reversing the SDE. This function propagates the sample with
the Runge-Kutta method. It performs four forward passes to approximate the solution to the differential
equation.`,ee,I,te,v,q,Se,j,Fe="Base class for the output of a scheduler’s <code>step</code> function.",se,G,re;return w=new De({props:{title:"PNDMScheduler",local:"pndmscheduler",headingTag:"h1"}}),y=new De({props:{title:"PNDMScheduler",local:"diffusers.PNDMScheduler",headingTag:"h2"}}),k=new H({props:{name:"class diffusers.PNDMScheduler",anchor:"diffusers.PNDMScheduler",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:"skip_prk_steps",val:": bool = False"},{name:"set_alpha_to_one",val:": bool = False"},{name:"prediction_type",val:": str = 'epsilon'"},{name:"timestep_spacing",val:": str = 'leading'"},{name:"steps_offset",val:": int = 0"}],parametersDescription:[{anchor:"diffusers.PNDMScheduler.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.PNDMScheduler.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.PNDMScheduler.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.PNDMScheduler.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>, <code>scaled_linear</code>, or <code>squaredcos_cap_v2</code>.`,name:"beta_schedule"},{anchor:"diffusers.PNDMScheduler.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.PNDMScheduler.skip_prk_steps",description:`<strong>skip_prk_steps</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Allows the scheduler to skip the Runge-Kutta steps defined in the original paper as being required before
PLMS steps.`,name:"skip_prk_steps"},{anchor:"diffusers.PNDMScheduler.set_alpha_to_one",description:`<strong>set_alpha_to_one</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Each diffusion step uses the alphas product value at that step and at the previous one. For the final step
there is no previous alpha. When this option is <code>True</code> the previous alpha product is fixed to <code>1</code>,
otherwise it uses the alpha value at step 0.`,name:"set_alpha_to_one"},{anchor:"diffusers.PNDMScheduler.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)
or <code>v_prediction</code> (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.PNDMScheduler.timestep_spacing",description:`<strong>timestep_spacing</strong> (<code>str</code>, defaults to <code>&quot;leading&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.PNDMScheduler.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_pndm.py#L72"}}),O=new H({props:{name:"scale_model_input",anchor:"diffusers.PNDMScheduler.scale_model_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.PNDMScheduler.scale_model_input.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
The input sample.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_pndm.py#L390",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>
`}}),C=new H({props:{name:"set_timesteps",anchor:"diffusers.PNDMScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": Union = None"}],parametersDescription:[{anchor:"diffusers.PNDMScheduler.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.PNDMScheduler.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_pndm.py#L166"}}),F=new H({props:{name:"step",anchor:"diffusers.PNDMScheduler.step",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"sample",val:": FloatTensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.PNDMScheduler.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.PNDMScheduler.step.timestep",description:`<strong>timestep</strong> (<code>int</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.PNDMScheduler.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.PNDMScheduler.step.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.schedulers.scheduling_utils.SchedulerOutput">SchedulerOutput</a> or <code>tuple</code>.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_pndm.py#L226",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/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/main/en/api/schedulers/overview#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> or <code>tuple</code></p>
`}}),L=new H({props:{name:"step_plms",anchor:"diffusers.PNDMScheduler.step_plms",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"sample",val:": FloatTensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.PNDMScheduler.step_plms.model_output",description:`<strong>model_output</strong> (<code>torch.FloatTensor</code>) &#x2014;
The direct output from learned diffusion model.`,name:"model_output"},{anchor:"diffusers.PNDMScheduler.step_plms.timestep",description:`<strong>timestep</strong> (<code>int</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.PNDMScheduler.step_plms.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.PNDMScheduler.step_plms.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.schedulers.scheduling_utils.SchedulerOutput">SchedulerOutput</a> or tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_pndm.py#L319",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/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/main/en/api/schedulers/overview#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> or <code>tuple</code></p>
`}}),E=new H({props:{name:"step_prk",anchor:"diffusers.PNDMScheduler.step_prk",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": int"},{name:"sample",val:": FloatTensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.PNDMScheduler.step_prk.model_output",description:`<strong>model_output</strong> (<code>torch.FloatTensor</code>) &#x2014;
The direct output from learned diffusion model.`,name:"model_output"},{anchor:"diffusers.PNDMScheduler.step_prk.timestep",description:`<strong>timestep</strong> (<code>int</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.PNDMScheduler.step_prk.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.PNDMScheduler.step_prk.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.schedulers.scheduling_utils.SchedulerOutput">SchedulerOutput</a> or tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_pndm.py#L259",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/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/main/en/api/schedulers/overview#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> or <code>tuple</code></p>
`}}),I=new De({props:{title:"SchedulerOutput",local:"diffusers.schedulers.scheduling_utils.SchedulerOutput",headingTag:"h2"}}),q=new H({props:{name:"class diffusers.schedulers.scheduling_utils.SchedulerOutput",anchor:"diffusers.schedulers.scheduling_utils.SchedulerOutput",parameters:[{name:"prev_sample",val:": FloatTensor"}],parametersDescription:[{anchor:"diffusers.schedulers.scheduling_utils.SchedulerOutput.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"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_utils.py#L51"}}),{c(){_=i("meta"),J=n(),B=i("p"),Q=n(),l(w.$$.fragment),X=n(),N=i("p"),N.innerHTML=Te,Y=n(),l(y.$$.fragment),Z=n(),r=i("div"),l(k.$$.fragment),ue=n(),A=i("p"),A.innerHTML=Me,le=n(),V=i("p"),V.innerHTML=we,pe=n(),S=i("div"),l(O.$$.fragment),fe=n(),R=i("p"),R.textContent=Ne,he=n(),D=i("div"),l(C.$$.fragment),me=n(),K=i("p"),K.textContent=ye,ge=n(),P=i("div"),l(F.$$.fragment),_e=n(),W=i("p"),W.innerHTML=ke,ve=n(),T=i("div"),l(L.$$.fragment),be=n(),z=i("p"),z.textContent=Oe,$e=n(),M=i("div"),l(E.$$.fragment),xe=n(),U=i("p"),U.textContent=Ce,ee=n(),l(I.$$.fragment),te=n(),v=i("div"),l(q.$$.fragment),Se=n(),j=i("p"),j.innerHTML=Fe,se=n(),G=i("p"),this.h()},l(e){const d=Ae("svelte-u9bgzb",document.head);_=a(d,"META",{name:!0,content:!0}),d.forEach(s),J=o(e),B=a(e,"P",{}),b(B).forEach(s),Q=o(e),p(w.$$.fragment,e),X=o(e),N=a(e,"P",{"data-svelte-h":!0}),$(N)!=="svelte-yw9fdh"&&(N.innerHTML=Te),Y=o(e),p(y.$$.fragment,e),Z=o(e),r=a(e,"DIV",{class:!0});var c=b(r);p(k.$$.fragment,c),ue=o(c),A=a(c,"P",{"data-svelte-h":!0}),$(A)!=="svelte-1he8ugl"&&(A.innerHTML=Me),le=o(c),V=a(c,"P",{"data-svelte-h":!0}),$(V)!=="svelte-linuuh"&&(V.innerHTML=we),pe=o(c),S=a(c,"DIV",{class:!0});var ne=b(S);p(O.$$.fragment,ne),fe=o(ne),R=a(ne,"P",{"data-svelte-h":!0}),$(R)!=="svelte-1rkfgpx"&&(R.textContent=Ne),ne.forEach(s),he=o(c),D=a(c,"DIV",{class:!0});var oe=b(D);p(C.$$.fragment,oe),me=o(oe),K=a(oe,"P",{"data-svelte-h":!0}),$(K)!=="svelte-1vzm9q"&&(K.textContent=ye),oe.forEach(s),ge=o(c),P=a(c,"DIV",{class:!0});var de=b(P);p(F.$$.fragment,de),_e=o(de),W=a(de,"P",{"data-svelte-h":!0}),$(W)!=="svelte-1uyc1pw"&&(W.innerHTML=ke),de.forEach(s),ve=o(c),T=a(c,"DIV",{class:!0});var ie=b(T);p(L.$$.fragment,ie),be=o(ie),z=a(ie,"P",{"data-svelte-h":!0}),$(z)!=="svelte-1n4l8et"&&(z.textContent=Oe),ie.forEach(s),$e=o(c),M=a(c,"DIV",{class:!0});var ae=b(M);p(E.$$.fragment,ae),xe=o(ae),U=a(ae,"P",{"data-svelte-h":!0}),$(U)!=="svelte-1bmmr5f"&&(U.textContent=Ce),ae.forEach(s),c.forEach(s),ee=o(e),p(I.$$.fragment,e),te=o(e),v=a(e,"DIV",{class:!0});var ce=b(v);p(q.$$.fragment,ce),Se=o(ce),j=a(ce,"P",{"data-svelte-h":!0}),$(j)!=="svelte-6ojmkw"&&(j.innerHTML=Fe),ce.forEach(s),se=o(e),G=a(e,"P",{}),b(G).forEach(s),this.h()},h(){x(_,"name","hf:doc:metadata"),x(_,"content",Re),x(S,"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(P,"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(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(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(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(e,d){t(document.head,_),u(e,J,d),u(e,B,d),u(e,Q,d),f(w,e,d),u(e,X,d),u(e,N,d),u(e,Y,d),f(y,e,d),u(e,Z,d),u(e,r,d),f(k,r,null),t(r,ue),t(r,A),t(r,le),t(r,V),t(r,pe),t(r,S),f(O,S,null),t(S,fe),t(S,R),t(r,he),t(r,D),f(C,D,null),t(D,me),t(D,K),t(r,ge),t(r,P),f(F,P,null),t(P,_e),t(P,W),t(r,ve),t(r,T),f(L,T,null),t(T,be),t(T,z),t(r,$e),t(r,M),f(E,M,null),t(M,xe),t(M,U),u(e,ee,d),f(I,e,d),u(e,te,d),u(e,v,d),f(q,v,null),t(v,Se),t(v,j),u(e,se,d),u(e,G,d),re=!0},p:Ee,i(e){re||(h(w.$$.fragment,e),h(y.$$.fragment,e),h(k.$$.fragment,e),h(O.$$.fragment,e),h(C.$$.fragment,e),h(F.$$.fragment,e),h(L.$$.fragment,e),h(E.$$.fragment,e),h(I.$$.fragment,e),h(q.$$.fragment,e),re=!0)},o(e){m(w.$$.fragment,e),m(y.$$.fragment,e),m(k.$$.fragment,e),m(O.$$.fragment,e),m(C.$$.fragment,e),m(F.$$.fragment,e),m(L.$$.fragment,e),m(E.$$.fragment,e),m(I.$$.fragment,e),m(q.$$.fragment,e),re=!1},d(e){e&&(s(J),s(B),s(Q),s(X),s(N),s(Y),s(Z),s(r),s(ee),s(te),s(v),s(se),s(G)),s(_),g(w,e),g(y,e),g(k),g(O),g(C),g(F),g(L),g(E),g(I,e),g(q)}}}const Re='{"title":"PNDMScheduler","local":"pndmscheduler","sections":[{"title":"PNDMScheduler","local":"diffusers.PNDMScheduler","sections":[],"depth":2},{"title":"SchedulerOutput","local":"diffusers.schedulers.scheduling_utils.SchedulerOutput","sections":[],"depth":2}],"depth":1}';function Ke(Pe){return Ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Be extends qe{constructor(_){super(),He(this,_,Ke,Ve,Le,{})}}export{Be as component};
