import{s as Le,n as Ee,o as Ie}from"../chunks/scheduler.182ea377.js";import{S as He,i as qe,g as i,s as n,r as l,A as Ae,h as a,f as s,c as o,j as v,u as p,x as $,k as S,y as t,a as u,v as f,d as m,t as h,w as g}from"../chunks/index.abf12888.js";import{D as q}from"../chunks/Docstring.93f6f462.js";import{H as De}from"../chunks/Heading.16916d63.js";function Ve(Pe){let _,G,B,J,y,Q,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>.',X,w,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,ye=`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,x,O,fe,R,Ne=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`,me,D,C,he,K,we="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>.`,be,T,L,ve,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,Se,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,b,H,xe,j,Fe="Base class for the output of a scheduler’s <code>step</code> function.",se,Y,re;return y=new De({props:{title:"PNDMScheduler",local:"pndmscheduler",headingTag:"h1"}}),w=new De({props:{title:"PNDMScheduler",local:"diffusers.PNDMScheduler",headingTag:"h2"}}),k=new q({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:": typing.Union[numpy.ndarray, typing.List[float], NoneType] = 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. 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_pndm.py#L72"}}),O=new q({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#L392",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 q({props:{name:"set_timesteps",anchor:"diffusers.PNDMScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": typing.Union[str, torch.device] = 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#L168"}}),F=new q({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/dpm_sde#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#L228",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_sde#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_sde#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> or <code>tuple</code></p>
`}}),L=new q({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/dpm_sde#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#L321",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_sde#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_sde#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> or <code>tuple</code></p>
`}}),E=new q({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/dpm_sde#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#L261",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_sde#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_sde#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"}}),H=new q({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"),G=n(),B=i("p"),J=n(),l(y.$$.fragment),Q=n(),N=i("p"),N.innerHTML=Te,X=n(),l(w.$$.fragment),Z=n(),r=i("div"),l(k.$$.fragment),ue=n(),A=i("p"),A.innerHTML=Me,le=n(),V=i("p"),V.innerHTML=ye,pe=n(),x=i("div"),l(O.$$.fragment),fe=n(),R=i("p"),R.textContent=Ne,me=n(),D=i("div"),l(C.$$.fragment),he=n(),K=i("p"),K.textContent=we,ge=n(),P=i("div"),l(F.$$.fragment),_e=n(),W=i("p"),W.innerHTML=ke,be=n(),T=i("div"),l(L.$$.fragment),ve=n(),z=i("p"),z.textContent=Oe,$e=n(),M=i("div"),l(E.$$.fragment),Se=n(),U=i("p"),U.textContent=Ce,ee=n(),l(I.$$.fragment),te=n(),b=i("div"),l(H.$$.fragment),xe=n(),j=i("p"),j.innerHTML=Fe,se=n(),Y=i("p"),this.h()},l(e){const d=Ae("svelte-u9bgzb",document.head);_=a(d,"META",{name:!0,content:!0}),d.forEach(s),G=o(e),B=a(e,"P",{}),v(B).forEach(s),J=o(e),p(y.$$.fragment,e),Q=o(e),N=a(e,"P",{"data-svelte-h":!0}),$(N)!=="svelte-yw9fdh"&&(N.innerHTML=Te),X=o(e),p(w.$$.fragment,e),Z=o(e),r=a(e,"DIV",{class:!0});var c=v(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=ye),pe=o(c),x=a(c,"DIV",{class:!0});var ne=v(x);p(O.$$.fragment,ne),fe=o(ne),R=a(ne,"P",{"data-svelte-h":!0}),$(R)!=="svelte-1rkfgpx"&&(R.textContent=Ne),ne.forEach(s),me=o(c),D=a(c,"DIV",{class:!0});var oe=v(D);p(C.$$.fragment,oe),he=o(oe),K=a(oe,"P",{"data-svelte-h":!0}),$(K)!=="svelte-1vzm9q"&&(K.textContent=we),oe.forEach(s),ge=o(c),P=a(c,"DIV",{class:!0});var de=v(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),be=o(c),T=a(c,"DIV",{class:!0});var ie=v(T);p(L.$$.fragment,ie),ve=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=v(M);p(E.$$.fragment,ae),Se=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),b=a(e,"DIV",{class:!0});var ce=v(b);p(H.$$.fragment,ce),xe=o(ce),j=a(ce,"P",{"data-svelte-h":!0}),$(j)!=="svelte-6ojmkw"&&(j.innerHTML=Fe),ce.forEach(s),se=o(e),Y=a(e,"P",{}),v(Y).forEach(s),this.h()},h(){S(_,"name","hf:doc:metadata"),S(_,"content",Re),S(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(r,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(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,d){t(document.head,_),u(e,G,d),u(e,B,d),u(e,J,d),f(y,e,d),u(e,Q,d),u(e,N,d),u(e,X,d),f(w,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,x),f(O,x,null),t(x,fe),t(x,R),t(r,me),t(r,D),f(C,D,null),t(D,he),t(D,K),t(r,ge),t(r,P),f(F,P,null),t(P,_e),t(P,W),t(r,be),t(r,T),f(L,T,null),t(T,ve),t(T,z),t(r,$e),t(r,M),f(E,M,null),t(M,Se),t(M,U),u(e,ee,d),f(I,e,d),u(e,te,d),u(e,b,d),f(H,b,null),t(b,xe),t(b,j),u(e,se,d),u(e,Y,d),re=!0},p:Ee,i(e){re||(m(y.$$.fragment,e),m(w.$$.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(H.$$.fragment,e),re=!0)},o(e){h(y.$$.fragment,e),h(w.$$.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(H.$$.fragment,e),re=!1},d(e){e&&(s(G),s(B),s(J),s(Q),s(N),s(X),s(Z),s(r),s(ee),s(te),s(b),s(se),s(Y)),s(_),g(y,e),g(w,e),g(k),g(O),g(C),g(F),g(L),g(E),g(I,e),g(H)}}}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 He{constructor(_){super(),qe(this,_,Ke,Ve,Le,{})}}export{Be as component};
