import{s as Se,n as Me,o as Pe}from"../chunks/scheduler.182ea377.js";import{S as Te,i as ye,g as a,s as n,r as g,A as we,h as d,f as t,c as o,j as O,u as _,x as v,k as E,y as r,a as c,v as b,d as D,t as $,w as x}from"../chunks/index.abf12888.js";import{D as z}from"../chunks/Docstring.93f6f462.js";import{H as fe}from"../chunks/Heading.16916d63.js";function Ke(me){let u,B,V,j,S,G,M,he='The <code>KDPM2DiscreteScheduler</code> 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>.',R,P,ge='The original codebase can be found at <a href="https://github.com/crowsonkb/k-diffusion" rel="nofollow">crowsonkb/k-diffusion</a>.',W,T,Y,i,y,ne,H,_e=`KDPM2DiscreteScheduler 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.`,oe,F,ve=`This model inherits from <a href="/docs/diffusers/v0.26.3/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a> and <a href="/docs/diffusers/v0.26.3/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.`,ie,f,w,ae,q,be=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`,de,m,K,ce,I,De="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",le,h,C,ue,U,$e=`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).`,J,k,Q,p,L,pe,A,xe="Base class for the output of a scheduler’s <code>step</code> function.",X,N,Z;return S=new fe({props:{title:"KDPM2DiscreteScheduler",local:"kdpm2discretescheduler",headingTag:"h1"}}),T=new fe({props:{title:"KDPM2DiscreteScheduler",local:"diffusers.KDPM2DiscreteScheduler",headingTag:"h2"}}),y=new z({props:{name:"class diffusers.KDPM2DiscreteScheduler",anchor:"diffusers.KDPM2DiscreteScheduler",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:": Union = None"},{name:"use_karras_sigmas",val:": Optional = False"},{name:"prediction_type",val:": str = 'epsilon'"},{name:"timestep_spacing",val:": str = 'linspace'"},{name:"steps_offset",val:": int = 0"}],parametersDescription:[{anchor:"diffusers.KDPM2DiscreteScheduler.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.KDPM2DiscreteScheduler.beta_start",description:`<strong>beta_start</strong> (<code>float</code>, defaults to 0.00085) &#x2014;
The starting <code>beta</code> value of inference.`,name:"beta_start"},{anchor:"diffusers.KDPM2DiscreteScheduler.beta_end",description:`<strong>beta_end</strong> (<code>float</code>, defaults to 0.012) &#x2014;
The final <code>beta</code> value.`,name:"beta_end"},{anchor:"diffusers.KDPM2DiscreteScheduler.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> or <code>scaled_linear</code>.`,name:"beta_schedule"},{anchor:"diffusers.KDPM2DiscreteScheduler.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.KDPM2DiscreteScheduler.use_karras_sigmas",description:`<strong>use_karras_sigmas</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
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 {&#x3C3;i}.`,name:"use_karras_sigmas"},{anchor:"diffusers.KDPM2DiscreteScheduler.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),
<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.KDPM2DiscreteScheduler.timestep_spacing",description:`<strong>timestep_spacing</strong> (<code>str</code>, defaults to <code>&quot;linspace&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.KDPM2DiscreteScheduler.steps_offset",description:`<strong>steps_offset</strong> (<code>int</code>, defaults to 0) &#x2014;
An offset added to the inference steps. You can use a combination of <code>offset=1</code> and
<code>set_alpha_to_one=False</code> to make the last step use step 0 for the previous alpha product like in Stable
Diffusion.`,name:"steps_offset"}],source:"https://github.com/huggingface/diffusers/blob/v0.26.3/src/diffusers/schedulers/scheduling_k_dpm_2_discrete.py#L71"}}),w=new z({props:{name:"scale_model_input",anchor:"diffusers.KDPM2DiscreteScheduler.scale_model_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"timestep",val:": Union"}],parametersDescription:[{anchor:"diffusers.KDPM2DiscreteScheduler.scale_model_input.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
The input sample.`,name:"sample"},{anchor:"diffusers.KDPM2DiscreteScheduler.scale_model_input.timestep",description:`<strong>timestep</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The current timestep in the diffusion chain.`,name:"timestep"}],source:"https://github.com/huggingface/diffusers/blob/v0.26.3/src/diffusers/schedulers/scheduling_k_dpm_2_discrete.py#L179",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.FloatTensor</code></p>
`}}),K=new z({props:{name:"set_timesteps",anchor:"diffusers.KDPM2DiscreteScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": Union = None"},{name:"num_train_timesteps",val:": Optional = None"}],parametersDescription:[{anchor:"diffusers.KDPM2DiscreteScheduler.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.KDPM2DiscreteScheduler.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/v0.26.3/src/diffusers/schedulers/scheduling_k_dpm_2_discrete.py#L209"}}),C=new z({props:{name:"step",anchor:"diffusers.KDPM2DiscreteScheduler.step",parameters:[{name:"model_output",val:": Union"},{name:"timestep",val:": Union"},{name:"sample",val:": Union"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KDPM2DiscreteScheduler.step.model_output",description:`<strong>model_output</strong> (<code>torch.FloatTensor</code>) &#x2014;
The direct output from learned diffusion model.`,name:"model_output"},{anchor:"diffusers.KDPM2DiscreteScheduler.step.timestep",description:`<strong>timestep</strong> (<code>float</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.KDPM2DiscreteScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
A current instance of a sample created by the diffusion process.`,name:"sample"},{anchor:"diffusers.KDPM2DiscreteScheduler.step.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/v0.26.3/en/api/schedulers/dpm_discrete_ancestral#diffusers.schedulers.scheduling_utils.SchedulerOutput">SchedulerOutput</a> or tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.26.3/src/diffusers/schedulers/scheduling_k_dpm_2_discrete.py#L362",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If return_dict is <code>True</code>, <a
  href="/docs/diffusers/v0.26.3/en/api/schedulers/dpm_discrete_ancestral#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/v0.26.3/en/api/schedulers/dpm_discrete_ancestral#diffusers.schedulers.scheduling_utils.SchedulerOutput"
>SchedulerOutput</a> or <code>tuple</code></p>
`}}),k=new fe({props:{title:"SchedulerOutput",local:"diffusers.schedulers.scheduling_utils.SchedulerOutput",headingTag:"h2"}}),L=new z({props:{name:"class diffusers.schedulers.scheduling_utils.SchedulerOutput",anchor:"diffusers.schedulers.scheduling_utils.SchedulerOutput",parameters:[{name:"prev_sample",val:": FloatTensor"}],parametersDescription:[{anchor:"diffusers.schedulers.scheduling_utils.SchedulerOutput.prev_sample",description:`<strong>prev_sample</strong> (<code>torch.FloatTensor</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/v0.26.3/src/diffusers/schedulers/scheduling_utils.py#L50"}}),{c(){u=a("meta"),B=n(),V=a("p"),j=n(),g(S.$$.fragment),G=n(),M=a("p"),M.innerHTML=he,R=n(),P=a("p"),P.innerHTML=ge,W=n(),g(T.$$.fragment),Y=n(),i=a("div"),g(y.$$.fragment),ne=n(),H=a("p"),H.innerHTML=_e,oe=n(),F=a("p"),F.innerHTML=ve,ie=n(),f=a("div"),g(w.$$.fragment),ae=n(),q=a("p"),q.textContent=be,de=n(),m=a("div"),g(K.$$.fragment),ce=n(),I=a("p"),I.textContent=De,le=n(),h=a("div"),g(C.$$.fragment),ue=n(),U=a("p"),U.textContent=$e,J=n(),g(k.$$.fragment),Q=n(),p=a("div"),g(L.$$.fragment),pe=n(),A=a("p"),A.innerHTML=xe,X=n(),N=a("p"),this.h()},l(e){const s=we("svelte-u9bgzb",document.head);u=d(s,"META",{name:!0,content:!0}),s.forEach(t),B=o(e),V=d(e,"P",{}),O(V).forEach(t),j=o(e),_(S.$$.fragment,e),G=o(e),M=d(e,"P",{"data-svelte-h":!0}),v(M)!=="svelte-1r1y5wx"&&(M.innerHTML=he),R=o(e),P=d(e,"P",{"data-svelte-h":!0}),v(P)!=="svelte-loovl7"&&(P.innerHTML=ge),W=o(e),_(T.$$.fragment,e),Y=o(e),i=d(e,"DIV",{class:!0});var l=O(i);_(y.$$.fragment,l),ne=o(l),H=d(l,"P",{"data-svelte-h":!0}),v(H)!=="svelte-iytw69"&&(H.innerHTML=_e),oe=o(l),F=d(l,"P",{"data-svelte-h":!0}),v(F)!=="svelte-1q7naot"&&(F.innerHTML=ve),ie=o(l),f=d(l,"DIV",{class:!0});var ee=O(f);_(w.$$.fragment,ee),ae=o(ee),q=d(ee,"P",{"data-svelte-h":!0}),v(q)!=="svelte-1rkfgpx"&&(q.textContent=be),ee.forEach(t),de=o(l),m=d(l,"DIV",{class:!0});var te=O(m);_(K.$$.fragment,te),ce=o(te),I=d(te,"P",{"data-svelte-h":!0}),v(I)!=="svelte-1vzm9q"&&(I.textContent=De),te.forEach(t),le=o(l),h=d(l,"DIV",{class:!0});var se=O(h);_(C.$$.fragment,se),ue=o(se),U=d(se,"P",{"data-svelte-h":!0}),v(U)!=="svelte-hi84tp"&&(U.textContent=$e),se.forEach(t),l.forEach(t),J=o(e),_(k.$$.fragment,e),Q=o(e),p=d(e,"DIV",{class:!0});var re=O(p);_(L.$$.fragment,re),pe=o(re),A=d(re,"P",{"data-svelte-h":!0}),v(A)!=="svelte-6ojmkw"&&(A.innerHTML=xe),re.forEach(t),X=o(e),N=d(e,"P",{}),O(N).forEach(t),this.h()},h(){E(u,"name","hf:doc:metadata"),E(u,"content",Ce),E(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(h,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(i,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(p,"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,u),c(e,B,s),c(e,V,s),c(e,j,s),b(S,e,s),c(e,G,s),c(e,M,s),c(e,R,s),c(e,P,s),c(e,W,s),b(T,e,s),c(e,Y,s),c(e,i,s),b(y,i,null),r(i,ne),r(i,H),r(i,oe),r(i,F),r(i,ie),r(i,f),b(w,f,null),r(f,ae),r(f,q),r(i,de),r(i,m),b(K,m,null),r(m,ce),r(m,I),r(i,le),r(i,h),b(C,h,null),r(h,ue),r(h,U),c(e,J,s),b(k,e,s),c(e,Q,s),c(e,p,s),b(L,p,null),r(p,pe),r(p,A),c(e,X,s),c(e,N,s),Z=!0},p:Me,i(e){Z||(D(S.$$.fragment,e),D(T.$$.fragment,e),D(y.$$.fragment,e),D(w.$$.fragment,e),D(K.$$.fragment,e),D(C.$$.fragment,e),D(k.$$.fragment,e),D(L.$$.fragment,e),Z=!0)},o(e){$(S.$$.fragment,e),$(T.$$.fragment,e),$(y.$$.fragment,e),$(w.$$.fragment,e),$(K.$$.fragment,e),$(C.$$.fragment,e),$(k.$$.fragment,e),$(L.$$.fragment,e),Z=!1},d(e){e&&(t(B),t(V),t(j),t(G),t(M),t(R),t(P),t(W),t(Y),t(i),t(J),t(Q),t(p),t(X),t(N)),t(u),x(S,e),x(T,e),x(y),x(w),x(K),x(C),x(k,e),x(L)}}}const Ce='{"title":"KDPM2DiscreteScheduler","local":"kdpm2discretescheduler","sections":[{"title":"KDPM2DiscreteScheduler","local":"diffusers.KDPM2DiscreteScheduler","sections":[],"depth":2},{"title":"SchedulerOutput","local":"diffusers.schedulers.scheduling_utils.SchedulerOutput","sections":[],"depth":2}],"depth":1}';function ke(me){return Pe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Fe extends Te{constructor(u){super(),ye(this,u,ke,Ke,Se,{})}}export{Fe as component};
