Buckets:
| import{s as ke,n as Le,o as Ee}from"../chunks/scheduler.8c3d61f6.js";import{S as Oe,i as He,g as a,s as n,r as p,A as Ie,h as c,f as t,c as o,j as y,u,x as v,k as M,y as r,a as d,v as m,d as f,t as h,w as g}from"../chunks/index.da70eac4.js";import{D as B}from"../chunks/Docstring.6b390b9a.js";import{H as $e,E as qe}from"../chunks/EditOnGithub.1e64e623.js";function Ne(xe){let _,j,W,Y,P,J,T,Se='The <code>KDPM2DiscreteScheduler</code> with ancestral sampling is inspired by the <a href="https://huggingface.co/papers/2206.00364" rel="nofollow">Elucidating the Design Space of Diffusion-Based Generative Models</a> paper, and the scheduler is ported from and created by <a href="https://github.com/crowsonkb/" rel="nofollow">Katherine Crowson</a>.',Q,A,ye='The original codebase can be found at <a href="https://github.com/crowsonkb/k-diffusion" rel="nofollow">crowsonkb/k-diffusion</a>.',X,w,Z,i,K,le,q,Me=`KDPM2DiscreteScheduler with ancestral sampling is inspired by the DPMSolver2 and Algorithm 2 from the <a href="https://huggingface.co/papers/2206.00364" rel="nofollow">Elucidating | |
| the Design Space of Diffusion-Based Generative Models</a> paper.`,pe,N,Pe=`This model inherits from <a href="/docs/diffusers/pr_10312/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a> and <a href="/docs/diffusers/pr_10312/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.`,ue,D,C,me,z,Te=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the | |
| current timestep.`,fe,$,k,he,F,Ae="Sets the begin index for the scheduler. This function should be run from pipeline before the inference.",ge,x,L,_e,U,we="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",be,S,E,ve,V,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).`,ee,O,te,b,H,De,G,Ce="Base class for the output of a scheduler’s <code>step</code> function.",se,I,re,R,ne;return P=new $e({props:{title:"KDPM2AncestralDiscreteScheduler",local:"kdpm2ancestraldiscretescheduler",headingTag:"h1"}}),w=new $e({props:{title:"KDPM2AncestralDiscreteScheduler",local:"diffusers.KDPM2AncestralDiscreteScheduler",headingTag:"h2"}}),K=new B({props:{name:"class diffusers.KDPM2AncestralDiscreteScheduler",anchor:"diffusers.KDPM2AncestralDiscreteScheduler",parameters:[{name:"num_train_timesteps",val:": int = 1000"},{name:"beta_start",val:": float = 0.00085"},{name:"beta_end",val:": float = 0.012"},{name:"beta_schedule",val:": str = 'linear'"},{name:"trained_betas",val:": typing.Union[numpy.ndarray, typing.List[float], NoneType] = None"},{name:"use_karras_sigmas",val:": typing.Optional[bool] = False"},{name:"use_exponential_sigmas",val:": typing.Optional[bool] = False"},{name:"use_beta_sigmas",val:": typing.Optional[bool] = False"},{name:"prediction_type",val:": str = 'epsilon'"},{name:"timestep_spacing",val:": str = 'linspace'"},{name:"steps_offset",val:": int = 0"}],parametersDescription:[{anchor:"diffusers.KDPM2AncestralDiscreteScheduler.num_train_timesteps",description:`<strong>num_train_timesteps</strong> (<code>int</code>, defaults to 1000) — | |
| The number of diffusion steps to train the model.`,name:"num_train_timesteps"},{anchor:"diffusers.KDPM2AncestralDiscreteScheduler.beta_start",description:`<strong>beta_start</strong> (<code>float</code>, defaults to 0.00085) — | |
| The starting <code>beta</code> value of inference.`,name:"beta_start"},{anchor:"diffusers.KDPM2AncestralDiscreteScheduler.beta_end",description:`<strong>beta_end</strong> (<code>float</code>, defaults to 0.012) — | |
| The final <code>beta</code> value.`,name:"beta_end"},{anchor:"diffusers.KDPM2AncestralDiscreteScheduler.beta_schedule",description:`<strong>beta_schedule</strong> (<code>str</code>, defaults to <code>"linear"</code>) — | |
| The beta schedule, a mapping from a beta range to a sequence of betas for stepping the model. Choose from | |
| <code>linear</code> or <code>scaled_linear</code>.`,name:"beta_schedule"},{anchor:"diffusers.KDPM2AncestralDiscreteScheduler.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.KDPM2AncestralDiscreteScheduler.use_karras_sigmas",description:`<strong>use_karras_sigmas</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to use Karras sigmas for step sizes in the noise schedule during the sampling process. If <code>True</code>, | |
| the sigmas are determined according to a sequence of noise levels {σi}.`,name:"use_karras_sigmas"},{anchor:"diffusers.KDPM2AncestralDiscreteScheduler.use_exponential_sigmas",description:`<strong>use_exponential_sigmas</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to use exponential sigmas for step sizes in the noise schedule during the sampling process.`,name:"use_exponential_sigmas"},{anchor:"diffusers.KDPM2AncestralDiscreteScheduler.use_beta_sigmas",description:`<strong>use_beta_sigmas</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to use beta sigmas for step sizes in the noise schedule during the sampling process. Refer to <a href="https://huggingface.co/papers/2407.12173" rel="nofollow">Beta | |
| Sampling is All You Need</a> for more information.`,name:"use_beta_sigmas"},{anchor:"diffusers.KDPM2AncestralDiscreteScheduler.prediction_type",description:`<strong>prediction_type</strong> (<code>str</code>, defaults to <code>epsilon</code>, <em>optional</em>) — | |
| Prediction type of the scheduler function; can be <code>epsilon</code> (predicts the noise of the diffusion process), | |
| <code>sample</code> (directly predicts the noisy sample<code>) or </code>v_prediction\` (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.KDPM2AncestralDiscreteScheduler.timestep_spacing",description:`<strong>timestep_spacing</strong> (<code>str</code>, defaults to <code>"linspace"</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.KDPM2AncestralDiscreteScheduler.steps_offset",description:`<strong>steps_offset</strong> (<code>int</code>, defaults to 0) — | |
| An offset added to the inference steps, as required by some model families.`,name:"steps_offset"}],source:"https://github.com/huggingface/diffusers/blob/vr_10312/src/diffusers/schedulers/scheduling_k_dpm_2_ancestral_discrete.py#L96"}}),C=new B({props:{name:"scale_model_input",anchor:"diffusers.KDPM2AncestralDiscreteScheduler.scale_model_input",parameters:[{name:"sample",val:": Tensor"},{name:"timestep",val:": typing.Union[float, torch.Tensor]"}],parametersDescription:[{anchor:"diffusers.KDPM2AncestralDiscreteScheduler.scale_model_input.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) — | |
| The input sample.`,name:"sample"},{anchor:"diffusers.KDPM2AncestralDiscreteScheduler.scale_model_input.timestep",description:`<strong>timestep</strong> (<code>int</code>, <em>optional</em>) — | |
| The current timestep in the diffusion chain.`,name:"timestep"}],source:"https://github.com/huggingface/diffusers/blob/vr_10312/src/diffusers/schedulers/scheduling_k_dpm_2_ancestral_discrete.py#L214",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> | |
| `}}),k=new B({props:{name:"set_begin_index",anchor:"diffusers.KDPM2AncestralDiscreteScheduler.set_begin_index",parameters:[{name:"begin_index",val:": int = 0"}],parametersDescription:[{anchor:"diffusers.KDPM2AncestralDiscreteScheduler.set_begin_index.begin_index",description:`<strong>begin_index</strong> (<code>int</code>) — | |
| The begin index for the scheduler.`,name:"begin_index"}],source:"https://github.com/huggingface/diffusers/blob/vr_10312/src/diffusers/schedulers/scheduling_k_dpm_2_ancestral_discrete.py#L204"}}),L=new B({props:{name:"set_timesteps",anchor:"diffusers.KDPM2AncestralDiscreteScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": typing.Union[str, torch.device] = None"},{name:"num_train_timesteps",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"diffusers.KDPM2AncestralDiscreteScheduler.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.KDPM2AncestralDiscreteScheduler.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"}],source:"https://github.com/huggingface/diffusers/blob/vr_10312/src/diffusers/schedulers/scheduling_k_dpm_2_ancestral_discrete.py#L244"}}),E=new B({props:{name:"step",anchor:"diffusers.KDPM2AncestralDiscreteScheduler.step",parameters:[{name:"model_output",val:": typing.Union[torch.Tensor, numpy.ndarray]"},{name:"timestep",val:": typing.Union[float, torch.Tensor]"},{name:"sample",val:": typing.Union[torch.Tensor, numpy.ndarray]"},{name:"generator",val:": typing.Optional[torch._C.Generator] = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KDPM2AncestralDiscreteScheduler.step.model_output",description:`<strong>model_output</strong> (<code>torch.Tensor</code>) — | |
| The direct output from learned diffusion model.`,name:"model_output"},{anchor:"diffusers.KDPM2AncestralDiscreteScheduler.step.timestep",description:`<strong>timestep</strong> (<code>float</code>) — | |
| The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.KDPM2AncestralDiscreteScheduler.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.KDPM2AncestralDiscreteScheduler.step.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) — | |
| A random number generator.`,name:"generator"},{anchor:"diffusers.KDPM2AncestralDiscreteScheduler.step.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>) — | |
| Whether or not to return a | |
| <code>KDPM2AncestralDiscreteSchedulerOutput</code> or tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_10312/src/diffusers/schedulers/scheduling_k_dpm_2_ancestral_discrete.py#L475",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If return_dict is <code>True</code>, | |
| <code>KDPM2AncestralDiscreteSchedulerOutput</code> 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><code>KDPM2AncestralDiscreteSchedulerOutput</code> or <code>tuple</code></p> | |
| `}}),O=new $e({props:{title:"SchedulerOutput",local:"diffusers.schedulers.scheduling_utils.SchedulerOutput",headingTag:"h2"}}),H=new B({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) — | |
| 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_10312/src/diffusers/schedulers/scheduling_utils.py#L60"}}),I=new qe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/schedulers/dpm_discrete_ancestral.md"}}),{c(){_=a("meta"),j=n(),W=a("p"),Y=n(),p(P.$$.fragment),J=n(),T=a("p"),T.innerHTML=Se,Q=n(),A=a("p"),A.innerHTML=ye,X=n(),p(w.$$.fragment),Z=n(),i=a("div"),p(K.$$.fragment),le=n(),q=a("p"),q.innerHTML=Me,pe=n(),N=a("p"),N.innerHTML=Pe,ue=n(),D=a("div"),p(C.$$.fragment),me=n(),z=a("p"),z.textContent=Te,fe=n(),$=a("div"),p(k.$$.fragment),he=n(),F=a("p"),F.textContent=Ae,ge=n(),x=a("div"),p(L.$$.fragment),_e=n(),U=a("p"),U.textContent=we,be=n(),S=a("div"),p(E.$$.fragment),ve=n(),V=a("p"),V.textContent=Ke,ee=n(),p(O.$$.fragment),te=n(),b=a("div"),p(H.$$.fragment),De=n(),G=a("p"),G.innerHTML=Ce,se=n(),p(I.$$.fragment),re=n(),R=a("p"),this.h()},l(e){const s=Ie("svelte-u9bgzb",document.head);_=c(s,"META",{name:!0,content:!0}),s.forEach(t),j=o(e),W=c(e,"P",{}),y(W).forEach(t),Y=o(e),u(P.$$.fragment,e),J=o(e),T=c(e,"P",{"data-svelte-h":!0}),v(T)!=="svelte-1xsfzct"&&(T.innerHTML=Se),Q=o(e),A=c(e,"P",{"data-svelte-h":!0}),v(A)!=="svelte-loovl7"&&(A.innerHTML=ye),X=o(e),u(w.$$.fragment,e),Z=o(e),i=c(e,"DIV",{class:!0});var l=y(i);u(K.$$.fragment,l),le=o(l),q=c(l,"P",{"data-svelte-h":!0}),v(q)!=="svelte-lafslh"&&(q.innerHTML=Me),pe=o(l),N=c(l,"P",{"data-svelte-h":!0}),v(N)!=="svelte-1oywc2v"&&(N.innerHTML=Pe),ue=o(l),D=c(l,"DIV",{class:!0});var oe=y(D);u(C.$$.fragment,oe),me=o(oe),z=c(oe,"P",{"data-svelte-h":!0}),v(z)!=="svelte-1rkfgpx"&&(z.textContent=Te),oe.forEach(t),fe=o(l),$=c(l,"DIV",{class:!0});var ie=y($);u(k.$$.fragment,ie),he=o(ie),F=c(ie,"P",{"data-svelte-h":!0}),v(F)!=="svelte-1k141rk"&&(F.textContent=Ae),ie.forEach(t),ge=o(l),x=c(l,"DIV",{class:!0});var ae=y(x);u(L.$$.fragment,ae),_e=o(ae),U=c(ae,"P",{"data-svelte-h":!0}),v(U)!=="svelte-1vzm9q"&&(U.textContent=we),ae.forEach(t),be=o(l),S=c(l,"DIV",{class:!0});var ce=y(S);u(E.$$.fragment,ce),ve=o(ce),V=c(ce,"P",{"data-svelte-h":!0}),v(V)!=="svelte-hi84tp"&&(V.textContent=Ke),ce.forEach(t),l.forEach(t),ee=o(e),u(O.$$.fragment,e),te=o(e),b=c(e,"DIV",{class:!0});var de=y(b);u(H.$$.fragment,de),De=o(de),G=c(de,"P",{"data-svelte-h":!0}),v(G)!=="svelte-6ojmkw"&&(G.innerHTML=Ce),de.forEach(t),se=o(e),u(I.$$.fragment,e),re=o(e),R=c(e,"P",{}),y(R).forEach(t),this.h()},h(){M(_,"name","hf:doc:metadata"),M(_,"content",ze),M(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),M($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),M(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),M(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),M(i,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),M(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,s){r(document.head,_),d(e,j,s),d(e,W,s),d(e,Y,s),m(P,e,s),d(e,J,s),d(e,T,s),d(e,Q,s),d(e,A,s),d(e,X,s),m(w,e,s),d(e,Z,s),d(e,i,s),m(K,i,null),r(i,le),r(i,q),r(i,pe),r(i,N),r(i,ue),r(i,D),m(C,D,null),r(D,me),r(D,z),r(i,fe),r(i,$),m(k,$,null),r($,he),r($,F),r(i,ge),r(i,x),m(L,x,null),r(x,_e),r(x,U),r(i,be),r(i,S),m(E,S,null),r(S,ve),r(S,V),d(e,ee,s),m(O,e,s),d(e,te,s),d(e,b,s),m(H,b,null),r(b,De),r(b,G),d(e,se,s),m(I,e,s),d(e,re,s),d(e,R,s),ne=!0},p:Le,i(e){ne||(f(P.$$.fragment,e),f(w.$$.fragment,e),f(K.$$.fragment,e),f(C.$$.fragment,e),f(k.$$.fragment,e),f(L.$$.fragment,e),f(E.$$.fragment,e),f(O.$$.fragment,e),f(H.$$.fragment,e),f(I.$$.fragment,e),ne=!0)},o(e){h(P.$$.fragment,e),h(w.$$.fragment,e),h(K.$$.fragment,e),h(C.$$.fragment,e),h(k.$$.fragment,e),h(L.$$.fragment,e),h(E.$$.fragment,e),h(O.$$.fragment,e),h(H.$$.fragment,e),h(I.$$.fragment,e),ne=!1},d(e){e&&(t(j),t(W),t(Y),t(J),t(T),t(Q),t(A),t(X),t(Z),t(i),t(ee),t(te),t(b),t(se),t(re),t(R)),t(_),g(P,e),g(w,e),g(K),g(C),g(k),g(L),g(E),g(O,e),g(H),g(I,e)}}}const ze='{"title":"KDPM2AncestralDiscreteScheduler","local":"kdpm2ancestraldiscretescheduler","sections":[{"title":"KDPM2AncestralDiscreteScheduler","local":"diffusers.KDPM2AncestralDiscreteScheduler","sections":[],"depth":2},{"title":"SchedulerOutput","local":"diffusers.schedulers.scheduling_utils.SchedulerOutput","sections":[],"depth":2}],"depth":1}';function Fe(xe){return Ee(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class We extends Oe{constructor(_){super(),He(this,_,Fe,Ne,ke,{})}}export{We as component}; | |
Xet Storage Details
- Size:
- 17.2 kB
- Xet hash:
- 7c6b41311170f4b98cd9fa30b6b0c1a3bd6eabc019735dba0d7db1c4883225d0
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.