Buckets:
| import"../chunks/DsnmJJEf.js";import{i as E,h as A,C,H as l,D as s,E as F,s as R}from"../chunks/BtE7mKSK.js";import{p as K,o as W,s as e,f as z,a as T,b as H,c as t,d as D,n as r,r as o}from"../chunks/jDjavuwI.js";const U='{"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}';var B=D('<meta name="hf:doc:metadata"/>'),G=D(`<p></p> <!> <!> <p><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>.</p> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p><code>PNDMScheduler</code> uses pseudo numerical methods for diffusion models such as the Runge-Kutta and linear multi-step | |
| method.</p> <p>This model inherits from <a href="/docs/diffusers/pr_14229/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a> and <a href="/docs/diffusers/pr_14229/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.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Add noise to the original samples according to the noise magnitude at each timestep (this is the forward | |
| diffusion process).</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Ensures interchangeability with schedulers that need to scale the denoising model input depending on the | |
| current timestep.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Sets the discrete timesteps used for the diffusion chain (to be run before inference).</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>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_14229/en/api/schedulers/pndm#diffusers.PNDMScheduler.step_prk">step_prk()</a> or <a href="/docs/diffusers/pr_14229/en/api/schedulers/pndm#diffusers.PNDMScheduler.step_plms">step_plms()</a> depending on the internal variable <code>counter</code>.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>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.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>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.</p></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Base class for the output of a scheduler’s <code>step</code> function.</p></div> <!> <p></p>`,1);function Q(P,M){K(M,!1),W(()=>{new URLSearchParams(window.location.search).get("fw")}),E();var h=G();A("g515ra",S=>{var x=B();R(x,"content",U),T(S,x)});var f=e(z(h),2);C(f,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var m=e(f,2);l(m,{title:"PNDMScheduler",local:"pndmscheduler",headingTag:"h1"});var _=e(m,4);l(_,{title:"PNDMScheduler",local:"diffusers.PNDMScheduler",headingTag:"h2"});var n=e(_,2),g=t(n);s(g,{name:"class diffusers.PNDMScheduler",anchor:"diffusers.PNDMScheduler",source:"https://github.com/huggingface/diffusers/blob/vr_14229/src/diffusers/schedulers/scheduling_pndm.py#L80",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:": numpy.ndarray | list[float] | None = None"},{name:"skip_prk_steps",val:": bool = False"},{name:"set_alpha_to_one",val:": bool = False"},{name:"prediction_type",val:": typing.Literal['epsilon', 'v_prediction'] = 'epsilon'"},{name:"timestep_spacing",val:": typing.Literal['linspace', 'leading', 'trailing'] = '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 <code>1000</code>) — | |
| 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 <code>0.0001</code>) — | |
| 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 <code>0.02</code>) — | |
| The final <code>beta</code> value.`,name:"beta_end"},{anchor:"diffusers.PNDMScheduler.beta_schedule",description:`<strong>beta_schedule</strong> (<code>"linear"</code>, <code>"scaled_linear"</code>, or <code>"squaredcos_cap_v2"</code>, defaults to <code>"linear"</code>) — | |
| The beta schedule, a mapping from a beta range to a sequence of betas for stepping the model.`,name:"beta_schedule"},{anchor:"diffusers.PNDMScheduler.trained_betas",description:`<strong>trained_betas</strong> (<code>np.ndarray</code>, <em>optional</em>) — | |
| 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>) — | |
| 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>) — | |
| 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>"epsilon"</code> or <code>"v_prediction"</code>, defaults to <code>"epsilon"</code>) — | |
| 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://huggingface.co/papers/2210.02303" rel="nofollow">Imagen Video</a> paper).`,name:"prediction_type"},{anchor:"diffusers.PNDMScheduler.timestep_spacing",description:`<strong>timestep_spacing</strong> (<code>"linspace"</code>, <code>"leading"</code>, or <code>"trailing"</code>, defaults to <code>"leading"</code>) — | |
| 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 <code>0</code>) — | |
| An offset added to the inference steps, as required by some model families.`,name:"steps_offset"}]});var d=e(g,6),N=t(d);s(N,{name:"add_noise",anchor:"diffusers.PNDMScheduler.add_noise",source:"https://github.com/huggingface/diffusers/blob/vr_14229/src/diffusers/schedulers/scheduling_pndm.py#L461",parameters:[{name:"original_samples",val:": Tensor"},{name:"noise",val:": Tensor"},{name:"timesteps",val:": IntTensor"}],parametersDescription:[{anchor:"diffusers.PNDMScheduler.add_noise.original_samples",description:`<strong>original_samples</strong> (<code>torch.Tensor</code>) — | |
| The original samples to which noise will be added.`,name:"original_samples"},{anchor:"diffusers.PNDMScheduler.add_noise.noise",description:`<strong>noise</strong> (<code>torch.Tensor</code>) — | |
| The noise to add to the samples.`,name:"noise"},{anchor:"diffusers.PNDMScheduler.add_noise.timesteps",description:`<strong>timesteps</strong> (<code>torch.IntTensor</code>) — | |
| The timesteps indicating the noise level for each sample.`,name:"timesteps"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>The noisy samples.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>torch.Tensor</code></p> | |
| `}),r(2),o(d);var i=e(d,2),y=t(i);s(y,{name:"scale_model_input",anchor:"diffusers.PNDMScheduler.scale_model_input",source:"https://github.com/huggingface/diffusers/blob/vr_14229/src/diffusers/schedulers/scheduling_pndm.py#L394",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>) — | |
| The input sample.`,name:"sample"}],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> | |
| `}),r(2),o(i);var a=e(i,2),w=t(a);s(w,{name:"set_timesteps",anchor:"diffusers.PNDMScheduler.set_timesteps",source:"https://github.com/huggingface/diffusers/blob/vr_14229/src/diffusers/schedulers/scheduling_pndm.py#L172",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>) — | |
| 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>) — | |
| The device to which the timesteps should be moved to. If <code>None</code>, the timesteps are not moved.`,name:"device"}]}),r(2),o(a);var c=e(a,2),q=t(c);s(q,{name:"step",anchor:"diffusers.PNDMScheduler.step",source:"https://github.com/huggingface/diffusers/blob/vr_14229/src/diffusers/schedulers/scheduling_pndm.py#L232",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>) — | |
| The direct output from learned diffusion model.`,name:"model_output"},{anchor:"diffusers.PNDMScheduler.step.timestep",description:`<strong>timestep</strong> (<code>int</code>) — | |
| The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.PNDMScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) — | |
| 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>, defaults to <code>True</code>) — | |
| Whether or not to return a <a href="/docs/diffusers/pr_14229/en/api/schedulers/cosine_dpm#diffusers.schedulers.scheduling_utils.SchedulerOutput">SchedulerOutput</a> or <code>tuple</code>.`,name:"return_dict"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If return_dict is <code>True</code>, <a | |
| href="/docs/diffusers/pr_14229/en/api/schedulers/cosine_dpm#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_14229/en/api/schedulers/cosine_dpm#diffusers.schedulers.scheduling_utils.SchedulerOutput" | |
| >SchedulerOutput</a> or <code>tuple</code></p> | |
| `}),r(2),o(c);var u=e(c,2),O=t(u);s(O,{name:"step_plms",anchor:"diffusers.PNDMScheduler.step_plms",source:"https://github.com/huggingface/diffusers/blob/vr_14229/src/diffusers/schedulers/scheduling_pndm.py#L324",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>) — | |
| The direct output from learned diffusion model.`,name:"model_output"},{anchor:"diffusers.PNDMScheduler.step_plms.timestep",description:`<strong>timestep</strong> (<code>int</code>) — | |
| The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.PNDMScheduler.step_plms.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) — | |
| 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>, defaults to <code>True</code>) — | |
| Whether or not to return a <a href="/docs/diffusers/pr_14229/en/api/schedulers/cosine_dpm#diffusers.schedulers.scheduling_utils.SchedulerOutput">SchedulerOutput</a> or tuple.`,name:"return_dict"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If return_dict is <code>True</code>, <a | |
| href="/docs/diffusers/pr_14229/en/api/schedulers/cosine_dpm#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_14229/en/api/schedulers/cosine_dpm#diffusers.schedulers.scheduling_utils.SchedulerOutput" | |
| >SchedulerOutput</a> or <code>tuple</code></p> | |
| `}),r(2),o(u);var b=e(u,2),k=t(b);s(k,{name:"step_prk",anchor:"diffusers.PNDMScheduler.step_prk",source:"https://github.com/huggingface/diffusers/blob/vr_14229/src/diffusers/schedulers/scheduling_pndm.py#L265",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>) — | |
| The direct output from learned diffusion model.`,name:"model_output"},{anchor:"diffusers.PNDMScheduler.step_prk.timestep",description:`<strong>timestep</strong> (<code>int</code>) — | |
| The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.PNDMScheduler.step_prk.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) — | |
| 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>, defaults to <code>True</code>) — | |
| Whether or not to return a <a href="/docs/diffusers/pr_14229/en/api/schedulers/cosine_dpm#diffusers.schedulers.scheduling_utils.SchedulerOutput">SchedulerOutput</a> or tuple.`,name:"return_dict"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If return_dict is <code>True</code>, <a | |
| href="/docs/diffusers/pr_14229/en/api/schedulers/cosine_dpm#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_14229/en/api/schedulers/cosine_dpm#diffusers.schedulers.scheduling_utils.SchedulerOutput" | |
| >SchedulerOutput</a> or <code>tuple</code></p> | |
| `}),r(2),o(b),o(n);var v=e(n,2);l(v,{title:"SchedulerOutput",local:"diffusers.schedulers.scheduling_utils.SchedulerOutput",headingTag:"h2"});var p=e(v,2),L=t(p);s(L,{name:"class diffusers.schedulers.scheduling_utils.SchedulerOutput",anchor:"diffusers.schedulers.scheduling_utils.SchedulerOutput",source:"https://github.com/huggingface/diffusers/blob/vr_14229/src/diffusers/schedulers/scheduling_utils.py#L61",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) — | |
| 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"}]}),r(2),o(p);var I=e(p,2);F(I,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/schedulers/pndm.md"}),r(2),T(P,h),H()}export{Q as component}; | |
Xet Storage Details
- Size:
- 18.1 kB
- Xet hash:
- 8f5dcbdb198d2df74e244f7153eb26afb6dfed3b11e7880413f8f10a68283e5b
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.