import{s as qe,n as He,o as Ae}from"../chunks/scheduler.8c3d61f6.js";import{S as Ve,i as Fe,g as d,s as r,r as l,A as Re,h as a,f as s,c as n,j as b,u as p,x as $,k as x,y as t,a as c,v as f,d as m,t as h,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,w,Y,y,we='<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,N,ee,o,k,pe,F,ye=`<code>PNDMScheduler</code> uses pseudo numerical methods for diffusion models such as the Runge-Kutta and linear multi-step
method.`,fe,R,Ne=`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.`,me,S,O,he,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).",ve,P,L,be,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/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>.`,$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,v,H,Pe,B,Ie="Base class for the output of a scheduler’s <code>step</code> function.",re,A,ne,J,oe;return w=new Te({props:{title:"PNDMScheduler",local:"pndmscheduler",headingTag:"h1"}}),N=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:": 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, 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 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/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.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:": 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#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/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>
`}}),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/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>
`}}),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/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>
`}}),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/main/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(){_=d("meta"),Q=r(),G=d("p"),X=r(),l(w.$$.fragment),Y=r(),y=d("p"),y.innerHTML=we,Z=r(),l(N.$$.fragment),ee=r(),o=d("div"),l(k.$$.fragment),pe=r(),F=d("p"),F.innerHTML=ye,fe=r(),R=d("p"),R.innerHTML=Ne,me=r(),S=d("div"),l(O.$$.fragment),he=r(),K=d("p"),K.textContent=ke,ge=r(),D=d("div"),l(C.$$.fragment),_e=r(),W=d("p"),W.textContent=Oe,ve=r(),P=d("div"),l(L.$$.fragment),be=r(),z=d("p"),z.innerHTML=Ce,$e=r(),T=d("div"),l(E.$$.fragment),xe=r(),U=d("p"),U.textContent=Le,Se=r(),M=d("div"),l(I.$$.fragment),De=r(),j=d("p"),j.textContent=Ee,te=r(),l(q.$$.fragment),se=r(),v=d("div"),l(H.$$.fragment),Pe=r(),B=d("p"),B.innerHTML=Ie,re=r(),l(A.$$.fragment),ne=r(),J=d("p"),this.h()},l(e){const i=Re("svelte-u9bgzb",document.head);_=a(i,"META",{name:!0,content:!0}),i.forEach(s),Q=n(e),G=a(e,"P",{}),b(G).forEach(s),X=n(e),p(w.$$.fragment,e),Y=n(e),y=a(e,"P",{"data-svelte-h":!0}),$(y)!=="svelte-yw9fdh"&&(y.innerHTML=we),Z=n(e),p(N.$$.fragment,e),ee=n(e),o=a(e,"DIV",{class:!0});var u=b(o);p(k.$$.fragment,u),pe=n(u),F=a(u,"P",{"data-svelte-h":!0}),$(F)!=="svelte-1he8ugl"&&(F.innerHTML=ye),fe=n(u),R=a(u,"P",{"data-svelte-h":!0}),$(R)!=="svelte-linuuh"&&(R.innerHTML=Ne),me=n(u),S=a(u,"DIV",{class:!0});var ie=b(S);p(O.$$.fragment,ie),he=n(ie),K=a(ie,"P",{"data-svelte-h":!0}),$(K)!=="svelte-1rkfgpx"&&(K.textContent=ke),ie.forEach(s),ge=n(u),D=a(u,"DIV",{class:!0});var de=b(D);p(C.$$.fragment,de),_e=n(de),W=a(de,"P",{"data-svelte-h":!0}),$(W)!=="svelte-1vzm9q"&&(W.textContent=Oe),de.forEach(s),ve=n(u),P=a(u,"DIV",{class:!0});var ae=b(P);p(L.$$.fragment,ae),be=n(ae),z=a(ae,"P",{"data-svelte-h":!0}),$(z)!=="svelte-1uyc1pw"&&(z.innerHTML=Ce),ae.forEach(s),$e=n(u),T=a(u,"DIV",{class:!0});var ue=b(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=b(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),v=a(e,"DIV",{class:!0});var le=b(v);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",{}),b(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(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,i){t(document.head,_),c(e,Q,i),c(e,G,i),c(e,X,i),f(w,e,i),c(e,Y,i),c(e,y,i),c(e,Z,i),f(N,e,i),c(e,ee,i),c(e,o,i),f(k,o,null),t(o,pe),t(o,F),t(o,fe),t(o,R),t(o,me),t(o,S),f(O,S,null),t(S,he),t(S,K),t(o,ge),t(o,D),f(C,D,null),t(D,_e),t(D,W),t(o,ve),t(o,P),f(L,P,null),t(P,be),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,i),f(q,e,i),c(e,se,i),c(e,v,i),f(H,v,null),t(v,Pe),t(v,B),c(e,re,i),f(A,e,i),c(e,ne,i),c(e,J,i),oe=!0},p:He,i(e){oe||(m(w.$$.fragment,e),m(N.$$.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=!0)},o(e){h(w.$$.fragment,e),h(N.$$.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=!1},d(e){e&&(s(Q),s(G),s(X),s(Y),s(y),s(Z),s(ee),s(o),s(te),s(se),s(v),s(re),s(ne),s(J)),s(_),g(w,e),g(N,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};
