import{s as Ve,n as Ae,o as Fe}from"../chunks/scheduler.53228c21.js";import{S as Re,i as ze,e as i,s as n,c as l,h as Ke,a,d as s,b as o,f as b,g as p,j as $,k as x,l as t,m as c,n as m,t as f,o as h,p as g}from"../chunks/index.100fac89.js";import{C as We}from"../chunks/CopyLLMTxtMenu.4f0519ef.js";import{D as F}from"../chunks/Docstring.d02a9fa5.js";import{H as ye,E as Ue}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.62dbb7c4.js";function je(Ne){let _,X,J,Y,y,Z,N,ee,w,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>.',te,k,se,d,O,fe,R,ke=`<code>PNDMScheduler</code> uses pseudo numerical methods for diffusion models such as the Runge-Kutta and linear multi-step
method.`,he,z,Oe=`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.`,ge,S,C,_e,K,Ce=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`,ve,D,L,be,W,Le="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",$e,T,E,xe,U,Ee=`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>.`,Se,P,I,De,j,Ie=`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.`,Te,M,q,Pe,B,qe=`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.`,re,H,ne,v,V,Me,G,He="Base class for the output of a scheduler’s <code>step</code> function.",oe,A,de,Q,ie;return y=new We({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),N=new ye({props:{title:"PNDMScheduler",local:"pndmscheduler",headingTag:"h1"}}),k=new ye({props:{title:"PNDMScheduler",local:"diffusers.PNDMScheduler",headingTag:"h2"}}),O=new F({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"}}),C=new F({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>
`}}),L=new F({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"}}),E=new F({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/edm_multistep_dpm_solver#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/edm_multistep_dpm_solver#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/edm_multistep_dpm_solver#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> or <code>tuple</code></p>
`}}),I=new F({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/edm_multistep_dpm_solver#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/edm_multistep_dpm_solver#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/edm_multistep_dpm_solver#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> or <code>tuple</code></p>
`}}),q=new F({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/edm_multistep_dpm_solver#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/edm_multistep_dpm_solver#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/edm_multistep_dpm_solver#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> or <code>tuple</code></p>
`}}),H=new ye({props:{title:"SchedulerOutput",local:"diffusers.schedulers.scheduling_utils.SchedulerOutput",headingTag:"h2"}}),V=new F({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#L62"}}),A=new Ue({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/schedulers/pndm.md"}}),{c(){_=i("meta"),X=n(),J=i("p"),Y=n(),l(y.$$.fragment),Z=n(),l(N.$$.fragment),ee=n(),w=i("p"),w.innerHTML=we,te=n(),l(k.$$.fragment),se=n(),d=i("div"),l(O.$$.fragment),fe=n(),R=i("p"),R.innerHTML=ke,he=n(),z=i("p"),z.innerHTML=Oe,ge=n(),S=i("div"),l(C.$$.fragment),_e=n(),K=i("p"),K.textContent=Ce,ve=n(),D=i("div"),l(L.$$.fragment),be=n(),W=i("p"),W.textContent=Le,$e=n(),T=i("div"),l(E.$$.fragment),xe=n(),U=i("p"),U.innerHTML=Ee,Se=n(),P=i("div"),l(I.$$.fragment),De=n(),j=i("p"),j.textContent=Ie,Te=n(),M=i("div"),l(q.$$.fragment),Pe=n(),B=i("p"),B.textContent=qe,re=n(),l(H.$$.fragment),ne=n(),v=i("div"),l(V.$$.fragment),Me=n(),G=i("p"),G.innerHTML=He,oe=n(),l(A.$$.fragment),de=n(),Q=i("p"),this.h()},l(e){const r=Ke("svelte-u9bgzb",document.head);_=a(r,"META",{name:!0,content:!0}),r.forEach(s),X=o(e),J=a(e,"P",{}),b(J).forEach(s),Y=o(e),p(y.$$.fragment,e),Z=o(e),p(N.$$.fragment,e),ee=o(e),w=a(e,"P",{"data-svelte-h":!0}),$(w)!=="svelte-yw9fdh"&&(w.innerHTML=we),te=o(e),p(k.$$.fragment,e),se=o(e),d=a(e,"DIV",{class:!0});var u=b(d);p(O.$$.fragment,u),fe=o(u),R=a(u,"P",{"data-svelte-h":!0}),$(R)!=="svelte-1he8ugl"&&(R.innerHTML=ke),he=o(u),z=a(u,"P",{"data-svelte-h":!0}),$(z)!=="svelte-linuuh"&&(z.innerHTML=Oe),ge=o(u),S=a(u,"DIV",{class:!0});var ae=b(S);p(C.$$.fragment,ae),_e=o(ae),K=a(ae,"P",{"data-svelte-h":!0}),$(K)!=="svelte-1rkfgpx"&&(K.textContent=Ce),ae.forEach(s),ve=o(u),D=a(u,"DIV",{class:!0});var ue=b(D);p(L.$$.fragment,ue),be=o(ue),W=a(ue,"P",{"data-svelte-h":!0}),$(W)!=="svelte-1vzm9q"&&(W.textContent=Le),ue.forEach(s),$e=o(u),T=a(u,"DIV",{class:!0});var ce=b(T);p(E.$$.fragment,ce),xe=o(ce),U=a(ce,"P",{"data-svelte-h":!0}),$(U)!=="svelte-1uyc1pw"&&(U.innerHTML=Ee),ce.forEach(s),Se=o(u),P=a(u,"DIV",{class:!0});var le=b(P);p(I.$$.fragment,le),De=o(le),j=a(le,"P",{"data-svelte-h":!0}),$(j)!=="svelte-1n4l8et"&&(j.textContent=Ie),le.forEach(s),Te=o(u),M=a(u,"DIV",{class:!0});var pe=b(M);p(q.$$.fragment,pe),Pe=o(pe),B=a(pe,"P",{"data-svelte-h":!0}),$(B)!=="svelte-1bmmr5f"&&(B.textContent=qe),pe.forEach(s),u.forEach(s),re=o(e),p(H.$$.fragment,e),ne=o(e),v=a(e,"DIV",{class:!0});var me=b(v);p(V.$$.fragment,me),Me=o(me),G=a(me,"P",{"data-svelte-h":!0}),$(G)!=="svelte-6ojmkw"&&(G.innerHTML=He),me.forEach(s),oe=o(e),p(A.$$.fragment,e),de=o(e),Q=a(e,"P",{}),b(Q).forEach(s),this.h()},h(){x(_,"name","hf:doc:metadata"),x(_,"content",Be),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(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(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(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(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(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,r){t(document.head,_),c(e,X,r),c(e,J,r),c(e,Y,r),m(y,e,r),c(e,Z,r),m(N,e,r),c(e,ee,r),c(e,w,r),c(e,te,r),m(k,e,r),c(e,se,r),c(e,d,r),m(O,d,null),t(d,fe),t(d,R),t(d,he),t(d,z),t(d,ge),t(d,S),m(C,S,null),t(S,_e),t(S,K),t(d,ve),t(d,D),m(L,D,null),t(D,be),t(D,W),t(d,$e),t(d,T),m(E,T,null),t(T,xe),t(T,U),t(d,Se),t(d,P),m(I,P,null),t(P,De),t(P,j),t(d,Te),t(d,M),m(q,M,null),t(M,Pe),t(M,B),c(e,re,r),m(H,e,r),c(e,ne,r),c(e,v,r),m(V,v,null),t(v,Me),t(v,G),c(e,oe,r),m(A,e,r),c(e,de,r),c(e,Q,r),ie=!0},p:Ae,i(e){ie||(f(y.$$.fragment,e),f(N.$$.fragment,e),f(k.$$.fragment,e),f(O.$$.fragment,e),f(C.$$.fragment,e),f(L.$$.fragment,e),f(E.$$.fragment,e),f(I.$$.fragment,e),f(q.$$.fragment,e),f(H.$$.fragment,e),f(V.$$.fragment,e),f(A.$$.fragment,e),ie=!0)},o(e){h(y.$$.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(V.$$.fragment,e),h(A.$$.fragment,e),ie=!1},d(e){e&&(s(X),s(J),s(Y),s(Z),s(ee),s(w),s(te),s(se),s(d),s(re),s(ne),s(v),s(oe),s(de),s(Q)),s(_),g(y,e),g(N,e),g(k,e),g(O),g(C),g(L),g(E),g(I),g(q),g(H,e),g(V),g(A,e)}}}const Be='{"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 Ge(Ne){return Fe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class et extends Re{constructor(_){super(),ze(this,_,Ge,je,Ve,{})}}export{et as component};
