import{s as qe,n as He,o as Ae}from"../chunks/scheduler.8c3d61f6.js";import{S as Ve,i as Fe,g as i,s as r,r as l,A as Re,h as a,f as s,c as n,j as v,u as p,x as $,k as x,y as t,a as c,v as f,d as h,t as m,w as g}from"../chunks/index.da70eac4.js";import{D as V}from"../chunks/Docstring.6b390b9a.js";import{H as Te,E as Ke}from"../chunks/EditOnGithub.1e64e623.js";function We(Me){let _,Q,G,X,N,Y,w,Ne='<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>.',Z,y,ee,o,k,pe,F,we=`<code>PNDMScheduler</code> uses pseudo numerical methods for diffusion models such as the Runge-Kutta and linear multi-step
method.`,fe,R,ye=`This model inherits from <a href="/docs/diffusers/pr_7790/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a> and <a href="/docs/diffusers/pr_7790/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.`,he,S,O,me,K,ke=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`,ge,D,C,_e,W,Oe="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",be,P,L,ve,z,Ce=`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/pr_7790/en/api/schedulers/pndm#diffusers.PNDMScheduler.step_prk">step_prk()</a>
or <a href="/docs/diffusers/pr_7790/en/api/schedulers/pndm#diffusers.PNDMScheduler.step_plms">step_plms()</a> depending on the internal variable <code>counter</code>.`,$e,T,E,xe,U,Le=`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.`,Se,M,I,De,j,Ee=`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.`,te,q,se,b,H,Pe,B,Ie="Base class for the output of a scheduler’s <code>step</code> function.",re,A,ne,J,oe;return N=new Te({props:{title:"PNDMScheduler",local:"pndmscheduler",headingTag:"h1"}}),y=new Te({props:{title:"PNDMScheduler",local:"diffusers.PNDMScheduler",headingTag:"h2"}}),k=new V({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/vr_7790/src/diffusers/schedulers/scheduling_pndm.py#L72"}}),O=new V({props:{name:"scale_model_input",anchor:"diffusers.PNDMScheduler.scale_model_input",parameters:[{name:"sample",val:": Tensor"},{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.PNDMScheduler.scale_model_input.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
The input sample.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/vr_7790/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.Tensor</code></p>
`}}),C=new V({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/vr_7790/src/diffusers/schedulers/scheduling_pndm.py#L166"}}),L=new V({props:{name:"step",anchor:"diffusers.PNDMScheduler.step",parameters:[{name:"model_output",val:": Tensor"},{name:"timestep",val:": int"},{name:"sample",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.PNDMScheduler.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.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.Tensor</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/pr_7790/en/api/schedulers/deis#diffusers.schedulers.scheduling_utils.SchedulerOutput">SchedulerOutput</a> or <code>tuple</code>.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_7790/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/pr_7790/en/api/schedulers/deis#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/pr_7790/en/api/schedulers/deis#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> or <code>tuple</code></p>
`}}),E=new V({props:{name:"step_plms",anchor:"diffusers.PNDMScheduler.step_plms",parameters:[{name:"model_output",val:": Tensor"},{name:"timestep",val:": int"},{name:"sample",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.PNDMScheduler.step_plms.model_output",description:`<strong>model_output</strong> (<code>torch.Tensor</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.Tensor</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/pr_7790/en/api/schedulers/deis#diffusers.schedulers.scheduling_utils.SchedulerOutput">SchedulerOutput</a> or tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_7790/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/pr_7790/en/api/schedulers/deis#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/pr_7790/en/api/schedulers/deis#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> or <code>tuple</code></p>
`}}),I=new V({props:{name:"step_prk",anchor:"diffusers.PNDMScheduler.step_prk",parameters:[{name:"model_output",val:": Tensor"},{name:"timestep",val:": int"},{name:"sample",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.PNDMScheduler.step_prk.model_output",description:`<strong>model_output</strong> (<code>torch.Tensor</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.Tensor</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/pr_7790/en/api/schedulers/deis#diffusers.schedulers.scheduling_utils.SchedulerOutput">SchedulerOutput</a> or tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_7790/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/pr_7790/en/api/schedulers/deis#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/pr_7790/en/api/schedulers/deis#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> or <code>tuple</code></p>
`}}),q=new Te({props:{title:"SchedulerOutput",local:"diffusers.schedulers.scheduling_utils.SchedulerOutput",headingTag:"h2"}}),H=new V({props:{name:"class diffusers.schedulers.scheduling_utils.SchedulerOutput",anchor:"diffusers.schedulers.scheduling_utils.SchedulerOutput",parameters:[{name:"prev_sample",val:": Tensor"}],parametersDescription:[{anchor:"diffusers.schedulers.scheduling_utils.SchedulerOutput.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"}],source:"https://github.com/huggingface/diffusers/blob/vr_7790/src/diffusers/schedulers/scheduling_utils.py#L60"}}),A=new Ke({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/schedulers/pndm.md"}}),{c(){_=i("meta"),Q=r(),G=i("p"),X=r(),l(N.$$.fragment),Y=r(),w=i("p"),w.innerHTML=Ne,Z=r(),l(y.$$.fragment),ee=r(),o=i("div"),l(k.$$.fragment),pe=r(),F=i("p"),F.innerHTML=we,fe=r(),R=i("p"),R.innerHTML=ye,he=r(),S=i("div"),l(O.$$.fragment),me=r(),K=i("p"),K.textContent=ke,ge=r(),D=i("div"),l(C.$$.fragment),_e=r(),W=i("p"),W.textContent=Oe,be=r(),P=i("div"),l(L.$$.fragment),ve=r(),z=i("p"),z.innerHTML=Ce,$e=r(),T=i("div"),l(E.$$.fragment),xe=r(),U=i("p"),U.textContent=Le,Se=r(),M=i("div"),l(I.$$.fragment),De=r(),j=i("p"),j.textContent=Ee,te=r(),l(q.$$.fragment),se=r(),b=i("div"),l(H.$$.fragment),Pe=r(),B=i("p"),B.innerHTML=Ie,re=r(),l(A.$$.fragment),ne=r(),J=i("p"),this.h()},l(e){const d=Re("svelte-u9bgzb",document.head);_=a(d,"META",{name:!0,content:!0}),d.forEach(s),Q=n(e),G=a(e,"P",{}),v(G).forEach(s),X=n(e),p(N.$$.fragment,e),Y=n(e),w=a(e,"P",{"data-svelte-h":!0}),$(w)!=="svelte-yw9fdh"&&(w.innerHTML=Ne),Z=n(e),p(y.$$.fragment,e),ee=n(e),o=a(e,"DIV",{class:!0});var u=v(o);p(k.$$.fragment,u),pe=n(u),F=a(u,"P",{"data-svelte-h":!0}),$(F)!=="svelte-1he8ugl"&&(F.innerHTML=we),fe=n(u),R=a(u,"P",{"data-svelte-h":!0}),$(R)!=="svelte-kd4as1"&&(R.innerHTML=ye),he=n(u),S=a(u,"DIV",{class:!0});var de=v(S);p(O.$$.fragment,de),me=n(de),K=a(de,"P",{"data-svelte-h":!0}),$(K)!=="svelte-1rkfgpx"&&(K.textContent=ke),de.forEach(s),ge=n(u),D=a(u,"DIV",{class:!0});var ie=v(D);p(C.$$.fragment,ie),_e=n(ie),W=a(ie,"P",{"data-svelte-h":!0}),$(W)!=="svelte-1vzm9q"&&(W.textContent=Oe),ie.forEach(s),be=n(u),P=a(u,"DIV",{class:!0});var ae=v(P);p(L.$$.fragment,ae),ve=n(ae),z=a(ae,"P",{"data-svelte-h":!0}),$(z)!=="svelte-c1xksk"&&(z.innerHTML=Ce),ae.forEach(s),$e=n(u),T=a(u,"DIV",{class:!0});var ue=v(T);p(E.$$.fragment,ue),xe=n(ue),U=a(ue,"P",{"data-svelte-h":!0}),$(U)!=="svelte-1n4l8et"&&(U.textContent=Le),ue.forEach(s),Se=n(u),M=a(u,"DIV",{class:!0});var ce=v(M);p(I.$$.fragment,ce),De=n(ce),j=a(ce,"P",{"data-svelte-h":!0}),$(j)!=="svelte-1bmmr5f"&&(j.textContent=Ee),ce.forEach(s),u.forEach(s),te=n(e),p(q.$$.fragment,e),se=n(e),b=a(e,"DIV",{class:!0});var le=v(b);p(H.$$.fragment,le),Pe=n(le),B=a(le,"P",{"data-svelte-h":!0}),$(B)!=="svelte-6ojmkw"&&(B.innerHTML=Ie),le.forEach(s),re=n(e),p(A.$$.fragment,e),ne=n(e),J=a(e,"P",{}),v(J).forEach(s),this.h()},h(){x(_,"name","hf:doc:metadata"),x(_,"content",ze),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(o,"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,d){t(document.head,_),c(e,Q,d),c(e,G,d),c(e,X,d),f(N,e,d),c(e,Y,d),c(e,w,d),c(e,Z,d),f(y,e,d),c(e,ee,d),c(e,o,d),f(k,o,null),t(o,pe),t(o,F),t(o,fe),t(o,R),t(o,he),t(o,S),f(O,S,null),t(S,me),t(S,K),t(o,ge),t(o,D),f(C,D,null),t(D,_e),t(D,W),t(o,be),t(o,P),f(L,P,null),t(P,ve),t(P,z),t(o,$e),t(o,T),f(E,T,null),t(T,xe),t(T,U),t(o,Se),t(o,M),f(I,M,null),t(M,De),t(M,j),c(e,te,d),f(q,e,d),c(e,se,d),c(e,b,d),f(H,b,null),t(b,Pe),t(b,B),c(e,re,d),f(A,e,d),c(e,ne,d),c(e,J,d),oe=!0},p:He,i(e){oe||(h(N.$$.fragment,e),h(y.$$.fragment,e),h(k.$$.fragment,e),h(O.$$.fragment,e),h(C.$$.fragment,e),h(L.$$.fragment,e),h(E.$$.fragment,e),h(I.$$.fragment,e),h(q.$$.fragment,e),h(H.$$.fragment,e),h(A.$$.fragment,e),oe=!0)},o(e){m(N.$$.fragment,e),m(y.$$.fragment,e),m(k.$$.fragment,e),m(O.$$.fragment,e),m(C.$$.fragment,e),m(L.$$.fragment,e),m(E.$$.fragment,e),m(I.$$.fragment,e),m(q.$$.fragment,e),m(H.$$.fragment,e),m(A.$$.fragment,e),oe=!1},d(e){e&&(s(Q),s(G),s(X),s(Y),s(w),s(Z),s(ee),s(o),s(te),s(se),s(b),s(re),s(ne),s(J)),s(_),g(N,e),g(y,e),g(k),g(O),g(C),g(L),g(E),g(I),g(q,e),g(H),g(A,e)}}}const ze='{"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 Ue(Me){return Ae(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Qe extends Ve{constructor(_){super(),Fe(this,_,Ue,We,qe,{})}}export{Qe as component};
