import{s as Ae,o as Ie,n as ze}from"../chunks/scheduler.182ea377.js";import{S as Ne,i as qe,g as d,s as n,r as p,A as Ge,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 u,v as h,d as f,t as g,w as _}from"../chunks/index.abf12888.js";import{T as Ue}from"../chunks/Tip.230e2334.js";import{D as q}from"../chunks/Docstring.81ce6c10.js";import{H as we,E as We}from"../chunks/EditOnGithub.9b8e78e4.js";function je(Z){let l,y=`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=y},l(v){l=c(v,"P",{"data-svelte-h":!0}),$(l)!=="svelte-rvbbam"&&(l.innerHTML=y)},m(v,G){u(v,l,G)},p:ze,d(v){v&&r(l)}}}function Be(Z){let l,y,v,G,C,ee,k,ye='<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,F,re,a,E,he,U,Ce="A stochastic scheduler tailored to variance-expanding models.",fe,W,ke=`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,V,_e,S,L,ve,j,Fe=`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,M,xe,B,Ee=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`,be,D,P,Te,R,Le="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",Ve,O,H,Se,J,Me=`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,A,De,Q,Pe="Corrects the predicted sample based on the <code>model_output</code> of the network.",se,I,ae,x,z,Oe,X,He="Output class for the scheduler’s step function output.",ne,N,oe,Y,ie;return C=new we({props:{title:"KarrasVeScheduler",local:"karrasvescheduler",headingTag:"h1"}}),F=new we({props:{title:"KarrasVeScheduler",local:"diffusers.KarrasVeScheduler",headingTag:"h2"}}),E=new q({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/main/src/diffusers/schedulers/deprecated/scheduling_karras_ve.py#L49"}}),V=new Ue({props:{$$slots:{default:[je]},$$scope:{ctx:Z}}}),L=new q({props:{name:"add_noise_to_input",anchor:"diffusers.KarrasVeScheduler.add_noise_to_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"sigma",val:": float"},{name:"generator",val:": Optional = None"}],parametersDescription:[{anchor:"diffusers.KarrasVeScheduler.add_noise_to_input.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</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/main/src/diffusers/schedulers/deprecated/scheduling_karras_ve.py#L138"}}),M=new q({props:{name:"scale_model_input",anchor:"diffusers.KarrasVeScheduler.scale_model_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"timestep",val:": Optional = None"}],parametersDescription:[{anchor:"diffusers.KarrasVeScheduler.scale_model_input.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</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/main/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.FloatTensor</code></p>
`}}),P=new q({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/main/src/diffusers/schedulers/deprecated/scheduling_karras_ve.py#L116"}}),H=new q({props:{name:"step",anchor:"diffusers.KarrasVeScheduler.step",parameters:[{name:"model_output",val:": FloatTensor"},{name:"sigma_hat",val:": float"},{name:"sigma_prev",val:": float"},{name:"sample_hat",val:": FloatTensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KarrasVeScheduler.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.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.FloatTensor</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/main/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>
`}}),A=new q({props:{name:"step_correct",anchor:"diffusers.KarrasVeScheduler.step_correct",parameters:[{name:"model_output",val:": FloatTensor"},{name:"sigma_hat",val:": float"},{name:"sigma_prev",val:": float"},{name:"sample_hat",val:": FloatTensor"},{name:"sample_prev",val:": FloatTensor"},{name:"derivative",val:": FloatTensor"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KarrasVeScheduler.step_correct.model_output",description:`<strong>model_output</strong> (<code>torch.FloatTensor</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.FloatTensor</code>) &#x2014; TODO",name:"sample_hat"},{anchor:"diffusers.KarrasVeScheduler.step_correct.sample_prev",description:"<strong>sample_prev</strong> (<code>torch.FloatTensor</code>) &#x2014; TODO",name:"sample_prev"},{anchor:"diffusers.KarrasVeScheduler.step_correct.derivative",description:"<strong>derivative</strong> (<code>torch.FloatTensor</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/main/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/main/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>
`}}),I=new we({props:{title:"KarrasVeOutput",local:"diffusers.schedulers.deprecated.scheduling_karras_ve.KarrasVeOutput",headingTag:"h2"}}),z=new q({props:{name:"class diffusers.schedulers.deprecated.scheduling_karras_ve.KarrasVeOutput",anchor:"diffusers.schedulers.deprecated.scheduling_karras_ve.KarrasVeOutput",parameters:[{name:"prev_sample",val:": FloatTensor"},{name:"derivative",val:": FloatTensor"},{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.FloatTensor</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.FloatTensor</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.FloatTensor</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/main/src/diffusers/schedulers/deprecated/scheduling_karras_ve.py#L28"}}),N=new We({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/schedulers/stochastic_karras_ve.md"}}),{c(){l=d("meta"),y=n(),v=d("p"),G=n(),p(C.$$.fragment),ee=n(),k=d("p"),k.innerHTML=ye,te=n(),p(F.$$.fragment),re=n(),a=d("div"),p(E.$$.fragment),he=n(),U=d("p"),U.textContent=Ce,fe=n(),W=d("p"),W.innerHTML=ke,ge=n(),p(V.$$.fragment),_e=n(),S=d("div"),p(L.$$.fragment),ve=n(),j=d("p"),j.innerHTML=Fe,$e=n(),K=d("div"),p(M.$$.fragment),xe=n(),B=d("p"),B.textContent=Ee,be=n(),D=d("div"),p(P.$$.fragment),Te=n(),R=d("p"),R.textContent=Le,Ve=n(),O=d("div"),p(H.$$.fragment),Se=n(),J=d("p"),J.textContent=Me,Ke=n(),w=d("div"),p(A.$$.fragment),De=n(),Q=d("p"),Q.innerHTML=Pe,se=n(),p(I.$$.fragment),ae=n(),x=d("div"),p(z.$$.fragment),Oe=n(),X=d("p"),X.textContent=He,ne=n(),p(N.$$.fragment),oe=n(),Y=d("p"),this.h()},l(e){const s=Ge("svelte-u9bgzb",document.head);l=c(s,"META",{name:!0,content:!0}),s.forEach(r),y=o(e),v=c(e,"P",{}),b(v).forEach(r),G=o(e),m(C.$$.fragment,e),ee=o(e),k=c(e,"P",{"data-svelte-h":!0}),$(k)!=="svelte-16ihd05"&&(k.innerHTML=ye),te=o(e),m(F.$$.fragment,e),re=o(e),a=c(e,"DIV",{class:!0});var i=b(a);m(E.$$.fragment,i),he=o(i),U=c(i,"P",{"data-svelte-h":!0}),$(U)!=="svelte-177z870"&&(U.textContent=Ce),fe=o(i),W=c(i,"P",{"data-svelte-h":!0}),$(W)!=="svelte-linuuh"&&(W.innerHTML=ke),ge=o(i),m(V.$$.fragment,i),_e=o(i),S=c(i,"DIV",{class:!0});var de=b(S);m(L.$$.fragment,de),ve=o(de),j=c(de,"P",{"data-svelte-h":!0}),$(j)!=="svelte-8x1g23"&&(j.innerHTML=Fe),de.forEach(r),$e=o(i),K=c(i,"DIV",{class:!0});var ce=b(K);m(M.$$.fragment,ce),xe=o(ce),B=c(ce,"P",{"data-svelte-h":!0}),$(B)!=="svelte-1rkfgpx"&&(B.textContent=Ee),ce.forEach(r),be=o(i),D=c(i,"DIV",{class:!0});var le=b(D);m(P.$$.fragment,le),Te=o(le),R=c(le,"P",{"data-svelte-h":!0}),$(R)!=="svelte-1vzm9q"&&(R.textContent=Le),le.forEach(r),Ve=o(i),O=c(i,"DIV",{class:!0});var ue=b(O);m(H.$$.fragment,ue),Se=o(ue),J=c(ue,"P",{"data-svelte-h":!0}),$(J)!=="svelte-hi84tp"&&(J.textContent=Me),ue.forEach(r),Ke=o(i),w=c(i,"DIV",{class:!0});var pe=b(w);m(A.$$.fragment,pe),De=o(pe),Q=c(pe,"P",{"data-svelte-h":!0}),$(Q)!=="svelte-1h4yget"&&(Q.innerHTML=Pe),pe.forEach(r),i.forEach(r),se=o(e),m(I.$$.fragment,e),ae=o(e),x=c(e,"DIV",{class:!0});var me=b(x);m(z.$$.fragment,me),Oe=o(me),X=c(me,"P",{"data-svelte-h":!0}),$(X)!=="svelte-7snghh"&&(X.textContent=He),me.forEach(r),ne=o(e),m(N.$$.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),u(e,y,s),u(e,v,s),u(e,G,s),h(C,e,s),u(e,ee,s),u(e,k,s),u(e,te,s),h(F,e,s),u(e,re,s),u(e,a,s),h(E,a,null),t(a,he),t(a,U),t(a,fe),t(a,W),t(a,ge),h(V,a,null),t(a,_e),t(a,S),h(L,S,null),t(S,ve),t(S,j),t(a,$e),t(a,K),h(M,K,null),t(K,xe),t(K,B),t(a,be),t(a,D),h(P,D,null),t(D,Te),t(D,R),t(a,Ve),t(a,O),h(H,O,null),t(O,Se),t(O,J),t(a,Ke),t(a,w),h(A,w,null),t(w,De),t(w,Q),u(e,se,s),h(I,e,s),u(e,ae,s),u(e,x,s),h(z,x,null),t(x,Oe),t(x,X),u(e,ne,s),h(N,e,s),u(e,oe,s),u(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(C.$$.fragment,e),f(F.$$.fragment,e),f(E.$$.fragment,e),f(V.$$.fragment,e),f(L.$$.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),ie=!0)},o(e){g(C.$$.fragment,e),g(F.$$.fragment,e),g(E.$$.fragment,e),g(V.$$.fragment,e),g(L.$$.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),ie=!1},d(e){e&&(r(y),r(v),r(G),r(ee),r(k),r(te),r(re),r(a),r(se),r(ae),r(x),r(ne),r(oe),r(Y)),r(l),_(C,e),_(F,e),_(E),_(V),_(L),_(M),_(P),_(H),_(A),_(I,e),_(z),_(N,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 Ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class tt extends Ne{constructor(l){super(),qe(this,l,Je,Be,Ae,{})}}export{tt as component};
