import{s as Ie,o as ze,n as Ne}from"../chunks/scheduler.8c3d61f6.js";import{S as qe,i as Ge,g as d,s as n,r as u,A as Ue,h as c,f as r,c as o,j as b,u as m,x as $,k as T,y as t,a as p,v as h,d as f,t as g,w as _}from"../chunks/index.da70eac4.js";import{T as We}from"../chunks/Tip.1d9b8c37.js";import{D as G}from"../chunks/Docstring.6b390b9a.js";import{H as we,E as je}from"../chunks/EditOnGithub.1e64e623.js";function Be(Z){let l,k=`For more details on the parameters, see <a href="https://arxiv.org/abs/2206.00364" rel="nofollow">Appendix E</a>. The grid search values used
to find the optimal <code>{s_noise, s_churn, s_min, s_max}</code> for a specific model are described in Table 5 of the paper.`;return{c(){l=d("p"),l.innerHTML=k},l(v){l=c(v,"P",{"data-svelte-h":!0}),$(l)!=="svelte-rvbbam"&&(l.innerHTML=k)},m(v,U){p(v,l,U)},p:Ne,d(v){v&&r(l)}}}function Fe(Z){let l,k,v,U,y,ee,C,ke='<code>KarrasVeScheduler</code> is a stochastic sampler tailored to variance-expanding (VE) models. It is based on the <a href="https://huggingface.co/papers/2206.00364" rel="nofollow">Elucidating the Design Space of Diffusion-Based Generative Models</a> and <a href="https://huggingface.co/papers/2011.13456" rel="nofollow">Score-based generative modeling through stochastic differential equations</a> papers.',te,E,re,a,L,he,W,ye="A stochastic scheduler tailored to variance-expanding models.",fe,j,Ce=`This model inherits from <a href="/docs/diffusers/pr_7790/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a> and <a href="/docs/diffusers/pr_7790/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,V,_e,S,M,ve,B,Ee=`Explicit Langevin-like “churn” step of adding noise to the sample according to a <code>gamma_i ≥ 0</code> to reach a
higher noise level <code>sigma_hat = sigma_i + gamma_i*sigma_i</code>.`,$e,K,P,xe,F,Le=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`,be,D,H,Te,R,Me="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",Ve,O,A,Se,J,Pe=`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).`,Ke,w,I,De,Q,He="Corrects the predicted sample based on the <code>model_output</code> of the network.",se,z,ae,x,N,Oe,X,Ae="Output class for the scheduler’s step function output.",ne,q,oe,Y,ie;return y=new we({props:{title:"KarrasVeScheduler",local:"karrasvescheduler",headingTag:"h1"}}),E=new we({props:{title:"KarrasVeScheduler",local:"diffusers.KarrasVeScheduler",headingTag:"h2"}}),L=new G({props:{name:"class diffusers.KarrasVeScheduler",anchor:"diffusers.KarrasVeScheduler",parameters:[{name:"sigma_min",val:": float = 0.02"},{name:"sigma_max",val:": float = 100"},{name:"s_noise",val:": float = 1.007"},{name:"s_churn",val:": float = 80"},{name:"s_min",val:": float = 0.05"},{name:"s_max",val:": float = 50"}],parametersDescription:[{anchor:"diffusers.KarrasVeScheduler.sigma_min",description:`<strong>sigma_min</strong> (<code>float</code>, defaults to 0.02) &#x2014;
The minimum noise magnitude.`,name:"sigma_min"},{anchor:"diffusers.KarrasVeScheduler.sigma_max",description:`<strong>sigma_max</strong> (<code>float</code>, defaults to 100) &#x2014;
The maximum noise magnitude.`,name:"sigma_max"},{anchor:"diffusers.KarrasVeScheduler.s_noise",description:`<strong>s_noise</strong> (<code>float</code>, defaults to 1.007) &#x2014;
The amount of additional noise to counteract loss of detail during sampling. A reasonable range is [1.000,
1.011].`,name:"s_noise"},{anchor:"diffusers.KarrasVeScheduler.s_churn",description:`<strong>s_churn</strong> (<code>float</code>, defaults to 80) &#x2014;
The parameter controlling the overall amount of stochasticity. A reasonable range is [0, 100].`,name:"s_churn"},{anchor:"diffusers.KarrasVeScheduler.s_min",description:`<strong>s_min</strong> (<code>float</code>, defaults to 0.05) &#x2014;
The start value of the sigma range to add noise (enable stochasticity). A reasonable range is [0, 10].`,name:"s_min"},{anchor:"diffusers.KarrasVeScheduler.s_max",description:`<strong>s_max</strong> (<code>float</code>, defaults to 50) &#x2014;
The end value of the sigma range to add noise. A reasonable range is [0.2, 80].`,name:"s_max"}],source:"https://github.com/huggingface/diffusers/blob/vr_7790/src/diffusers/schedulers/deprecated/scheduling_karras_ve.py#L49"}}),V=new We({props:{$$slots:{default:[Be]},$$scope:{ctx:Z}}}),M=new G({props:{name:"add_noise_to_input",anchor:"diffusers.KarrasVeScheduler.add_noise_to_input",parameters:[{name:"sample",val:": Tensor"},{name:"sigma",val:": float"},{name:"generator",val:": Optional = None"}],parametersDescription:[{anchor:"diffusers.KarrasVeScheduler.add_noise_to_input.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
The input sample.`,name:"sample"},{anchor:"diffusers.KarrasVeScheduler.add_noise_to_input.sigma",description:"<strong>sigma</strong> (<code>float</code>) &#x2014;",name:"sigma"},{anchor:"diffusers.KarrasVeScheduler.add_noise_to_input.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
A random number generator.`,name:"generator"}],source:"https://github.com/huggingface/diffusers/blob/vr_7790/src/diffusers/schedulers/deprecated/scheduling_karras_ve.py#L138"}}),P=new G({props:{name:"scale_model_input",anchor:"diffusers.KarrasVeScheduler.scale_model_input",parameters:[{name:"sample",val:": Tensor"},{name:"timestep",val:": Optional = None"}],parametersDescription:[{anchor:"diffusers.KarrasVeScheduler.scale_model_input.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
The input sample.`,name:"sample"},{anchor:"diffusers.KarrasVeScheduler.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/vr_7790/src/diffusers/schedulers/deprecated/scheduling_karras_ve.py#L99",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>
`}}),H=new G({props:{name:"set_timesteps",anchor:"diffusers.KarrasVeScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": Union = None"}],parametersDescription:[{anchor:"diffusers.KarrasVeScheduler.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.KarrasVeScheduler.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/vr_7790/src/diffusers/schedulers/deprecated/scheduling_karras_ve.py#L116"}}),A=new G({props:{name:"step",anchor:"diffusers.KarrasVeScheduler.step",parameters:[{name:"model_output",val:": Tensor"},{name:"sigma_hat",val:": float"},{name:"sigma_prev",val:": float"},{name:"sample_hat",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KarrasVeScheduler.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.KarrasVeScheduler.step.sigma_hat",description:"<strong>sigma_hat</strong> (<code>float</code>) &#x2014;",name:"sigma_hat"},{anchor:"diffusers.KarrasVeScheduler.step.sigma_prev",description:"<strong>sigma_prev</strong> (<code>float</code>) &#x2014;",name:"sigma_prev"},{anchor:"diffusers.KarrasVeScheduler.step.sample_hat",description:"<strong>sample_hat</strong> (<code>torch.Tensor</code>) &#x2014;",name:"sample_hat"},{anchor:"diffusers.KarrasVeScheduler.step.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~schedulers.scheduling_karras_ve.KarrasVESchedulerOutput</code> or <code>tuple</code>.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_7790/src/diffusers/schedulers/deprecated/scheduling_karras_ve.py#L164",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If return_dict is <code>True</code>, <code>~schedulers.scheduling_karras_ve.KarrasVESchedulerOutput</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>~schedulers.scheduling_karras_ve.KarrasVESchedulerOutput</code> or <code>tuple</code></p>
`}}),I=new G({props:{name:"step_correct",anchor:"diffusers.KarrasVeScheduler.step_correct",parameters:[{name:"model_output",val:": Tensor"},{name:"sigma_hat",val:": float"},{name:"sigma_prev",val:": float"},{name:"sample_hat",val:": Tensor"},{name:"sample_prev",val:": Tensor"},{name:"derivative",val:": Tensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KarrasVeScheduler.step_correct.model_output",description:`<strong>model_output</strong> (<code>torch.Tensor</code>) &#x2014;
The direct output from learned diffusion model.`,name:"model_output"},{anchor:"diffusers.KarrasVeScheduler.step_correct.sigma_hat",description:"<strong>sigma_hat</strong> (<code>float</code>) &#x2014; TODO",name:"sigma_hat"},{anchor:"diffusers.KarrasVeScheduler.step_correct.sigma_prev",description:"<strong>sigma_prev</strong> (<code>float</code>) &#x2014; TODO",name:"sigma_prev"},{anchor:"diffusers.KarrasVeScheduler.step_correct.sample_hat",description:"<strong>sample_hat</strong> (<code>torch.Tensor</code>) &#x2014; TODO",name:"sample_hat"},{anchor:"diffusers.KarrasVeScheduler.step_correct.sample_prev",description:"<strong>sample_prev</strong> (<code>torch.Tensor</code>) &#x2014; TODO",name:"sample_prev"},{anchor:"diffusers.KarrasVeScheduler.step_correct.derivative",description:"<strong>derivative</strong> (<code>torch.Tensor</code>) &#x2014; TODO",name:"derivative"},{anchor:"diffusers.KarrasVeScheduler.step_correct.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/pr_7790/en/api/schedulers/ddpm#diffusers.schedulers.scheduling_ddpm.DDPMSchedulerOutput">DDPMSchedulerOutput</a> or <code>tuple</code>.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_7790/src/diffusers/schedulers/deprecated/scheduling_karras_ve.py#L203",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>updated sample in the diffusion chain. derivative (TODO): TODO</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p>prev_sample (TODO)</p>
`}}),z=new we({props:{title:"KarrasVeOutput",local:"diffusers.schedulers.deprecated.scheduling_karras_ve.KarrasVeOutput",headingTag:"h2"}}),N=new G({props:{name:"class diffusers.schedulers.deprecated.scheduling_karras_ve.KarrasVeOutput",anchor:"diffusers.schedulers.deprecated.scheduling_karras_ve.KarrasVeOutput",parameters:[{name:"prev_sample",val:": Tensor"},{name:"derivative",val:": Tensor"},{name:"pred_original_sample",val:": Optional = None"}],parametersDescription:[{anchor:"diffusers.schedulers.deprecated.scheduling_karras_ve.KarrasVeOutput.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 (x_{t-1}) of previous timestep. <code>prev_sample</code> should be used as next model input in the
denoising loop.`,name:"prev_sample"},{anchor:"diffusers.schedulers.deprecated.scheduling_karras_ve.KarrasVeOutput.derivative",description:`<strong>derivative</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code> for images) &#x2014;
Derivative of predicted original image sample (x_0).`,name:"derivative"},{anchor:"diffusers.schedulers.deprecated.scheduling_karras_ve.KarrasVeOutput.pred_original_sample",description:`<strong>pred_original_sample</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code> for images) &#x2014;
The predicted denoised sample (x_{0}) based on the model output from the current timestep.
<code>pred_original_sample</code> can be used to preview progress or for guidance.`,name:"pred_original_sample"}],source:"https://github.com/huggingface/diffusers/blob/vr_7790/src/diffusers/schedulers/deprecated/scheduling_karras_ve.py#L28"}}),q=new je({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/schedulers/stochastic_karras_ve.md"}}),{c(){l=d("meta"),k=n(),v=d("p"),U=n(),u(y.$$.fragment),ee=n(),C=d("p"),C.innerHTML=ke,te=n(),u(E.$$.fragment),re=n(),a=d("div"),u(L.$$.fragment),he=n(),W=d("p"),W.textContent=ye,fe=n(),j=d("p"),j.innerHTML=Ce,ge=n(),u(V.$$.fragment),_e=n(),S=d("div"),u(M.$$.fragment),ve=n(),B=d("p"),B.innerHTML=Ee,$e=n(),K=d("div"),u(P.$$.fragment),xe=n(),F=d("p"),F.textContent=Le,be=n(),D=d("div"),u(H.$$.fragment),Te=n(),R=d("p"),R.textContent=Me,Ve=n(),O=d("div"),u(A.$$.fragment),Se=n(),J=d("p"),J.textContent=Pe,Ke=n(),w=d("div"),u(I.$$.fragment),De=n(),Q=d("p"),Q.innerHTML=He,se=n(),u(z.$$.fragment),ae=n(),x=d("div"),u(N.$$.fragment),Oe=n(),X=d("p"),X.textContent=Ae,ne=n(),u(q.$$.fragment),oe=n(),Y=d("p"),this.h()},l(e){const s=Ue("svelte-u9bgzb",document.head);l=c(s,"META",{name:!0,content:!0}),s.forEach(r),k=o(e),v=c(e,"P",{}),b(v).forEach(r),U=o(e),m(y.$$.fragment,e),ee=o(e),C=c(e,"P",{"data-svelte-h":!0}),$(C)!=="svelte-16ihd05"&&(C.innerHTML=ke),te=o(e),m(E.$$.fragment,e),re=o(e),a=c(e,"DIV",{class:!0});var i=b(a);m(L.$$.fragment,i),he=o(i),W=c(i,"P",{"data-svelte-h":!0}),$(W)!=="svelte-177z870"&&(W.textContent=ye),fe=o(i),j=c(i,"P",{"data-svelte-h":!0}),$(j)!=="svelte-kd4as1"&&(j.innerHTML=Ce),ge=o(i),m(V.$$.fragment,i),_e=o(i),S=c(i,"DIV",{class:!0});var de=b(S);m(M.$$.fragment,de),ve=o(de),B=c(de,"P",{"data-svelte-h":!0}),$(B)!=="svelte-8x1g23"&&(B.innerHTML=Ee),de.forEach(r),$e=o(i),K=c(i,"DIV",{class:!0});var ce=b(K);m(P.$$.fragment,ce),xe=o(ce),F=c(ce,"P",{"data-svelte-h":!0}),$(F)!=="svelte-1rkfgpx"&&(F.textContent=Le),ce.forEach(r),be=o(i),D=c(i,"DIV",{class:!0});var le=b(D);m(H.$$.fragment,le),Te=o(le),R=c(le,"P",{"data-svelte-h":!0}),$(R)!=="svelte-1vzm9q"&&(R.textContent=Me),le.forEach(r),Ve=o(i),O=c(i,"DIV",{class:!0});var pe=b(O);m(A.$$.fragment,pe),Se=o(pe),J=c(pe,"P",{"data-svelte-h":!0}),$(J)!=="svelte-hi84tp"&&(J.textContent=Pe),pe.forEach(r),Ke=o(i),w=c(i,"DIV",{class:!0});var ue=b(w);m(I.$$.fragment,ue),De=o(ue),Q=c(ue,"P",{"data-svelte-h":!0}),$(Q)!=="svelte-1h4yget"&&(Q.innerHTML=He),ue.forEach(r),i.forEach(r),se=o(e),m(z.$$.fragment,e),ae=o(e),x=c(e,"DIV",{class:!0});var me=b(x);m(N.$$.fragment,me),Oe=o(me),X=c(me,"P",{"data-svelte-h":!0}),$(X)!=="svelte-7snghh"&&(X.textContent=Ae),me.forEach(r),ne=o(e),m(q.$$.fragment,e),oe=o(e),Y=c(e,"P",{}),b(Y).forEach(r),this.h()},h(){T(l,"name","hf:doc:metadata"),T(l,"content",Re),T(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(a,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(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(e,s){t(document.head,l),p(e,k,s),p(e,v,s),p(e,U,s),h(y,e,s),p(e,ee,s),p(e,C,s),p(e,te,s),h(E,e,s),p(e,re,s),p(e,a,s),h(L,a,null),t(a,he),t(a,W),t(a,fe),t(a,j),t(a,ge),h(V,a,null),t(a,_e),t(a,S),h(M,S,null),t(S,ve),t(S,B),t(a,$e),t(a,K),h(P,K,null),t(K,xe),t(K,F),t(a,be),t(a,D),h(H,D,null),t(D,Te),t(D,R),t(a,Ve),t(a,O),h(A,O,null),t(O,Se),t(O,J),t(a,Ke),t(a,w),h(I,w,null),t(w,De),t(w,Q),p(e,se,s),h(z,e,s),p(e,ae,s),p(e,x,s),h(N,x,null),t(x,Oe),t(x,X),p(e,ne,s),h(q,e,s),p(e,oe,s),p(e,Y,s),ie=!0},p(e,[s]){const i={};s&2&&(i.$$scope={dirty:s,ctx:e}),V.$set(i)},i(e){ie||(f(y.$$.fragment,e),f(E.$$.fragment,e),f(L.$$.fragment,e),f(V.$$.fragment,e),f(M.$$.fragment,e),f(P.$$.fragment,e),f(H.$$.fragment,e),f(A.$$.fragment,e),f(I.$$.fragment,e),f(z.$$.fragment,e),f(N.$$.fragment,e),f(q.$$.fragment,e),ie=!0)},o(e){g(y.$$.fragment,e),g(E.$$.fragment,e),g(L.$$.fragment,e),g(V.$$.fragment,e),g(M.$$.fragment,e),g(P.$$.fragment,e),g(H.$$.fragment,e),g(A.$$.fragment,e),g(I.$$.fragment,e),g(z.$$.fragment,e),g(N.$$.fragment,e),g(q.$$.fragment,e),ie=!1},d(e){e&&(r(k),r(v),r(U),r(ee),r(C),r(te),r(re),r(a),r(se),r(ae),r(x),r(ne),r(oe),r(Y)),r(l),_(y,e),_(E,e),_(L),_(V),_(M),_(P),_(H),_(A),_(I),_(z,e),_(N),_(q,e)}}}const Re='{"title":"KarrasVeScheduler","local":"karrasvescheduler","sections":[{"title":"KarrasVeScheduler","local":"diffusers.KarrasVeScheduler","sections":[],"depth":2},{"title":"KarrasVeOutput","local":"diffusers.schedulers.deprecated.scheduling_karras_ve.KarrasVeOutput","sections":[],"depth":2}],"depth":1}';function Je(Z){return ze(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class tt extends qe{constructor(l){super(),Ge(this,l,Je,Fe,Ie,{})}}export{tt as component};
