import{s as Pe,o as He,n as Ae}from"../chunks/scheduler.182ea377.js";import{S as Ie,i as ze,g as d,s as n,r as m,A as Ne,h as c,f as r,c as o,j as b,u as h,x as $,k as T,y as t,a as p,v as f,d as g,t as _,w as v}from"../chunks/index.abf12888.js";import{T as qe}from"../chunks/Tip.230e2334.js";import{D as N}from"../chunks/Docstring.93f6f462.js";import{H as De}from"../chunks/Heading.16916d63.js";function Ge(Y){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(u){l=c(u,"P",{"data-svelte-h":!0}),$(l)!=="svelte-rvbbam"&&(l.innerHTML=y)},m(u,q){p(u,l,q)},p:Ae,d(u){u&&r(l)}}}function Ue(Y){let l,y,u,q,C,Z,k,Oe='<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.',ee,F,te,s,E,ue,G,we="A stochastic scheduler tailored to variance-expanding models.",me,U,ye=`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.`,he,V,fe,S,L,ge,W,Ce=`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,ve,j,ke=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`,$e,D,P,xe,B,Fe="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",be,O,H,Te,R,Ee=`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).`,Ve,w,A,Se,J,Le="Corrects the predicted sample based on the <code>model_output</code> of the network.",re,I,se,x,z,Ke,Q,Me="Output class for the scheduler’s step function output.",ae,X,ne;return C=new De({props:{title:"KarrasVeScheduler",local:"karrasvescheduler",headingTag:"h1"}}),F=new De({props:{title:"KarrasVeScheduler",local:"diffusers.KarrasVeScheduler",headingTag:"h2"}}),E=new N({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 qe({props:{$$slots:{default:[Ge]},$$scope:{ctx:Y}}}),L=new N({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:": typing.Optional[torch._C.Generator] = 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 N({props:{name:"scale_model_input",anchor:"diffusers.KarrasVeScheduler.scale_model_input",parameters:[{name:"sample",val:": FloatTensor"},{name:"timestep",val:": typing.Optional[int] = 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 N({props:{name:"set_timesteps",anchor:"diffusers.KarrasVeScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": typing.Union[str, torch.device] = 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 N({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 N({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 De({props:{title:"KarrasVeOutput",local:"diffusers.schedulers.deprecated.scheduling_karras_ve.KarrasVeOutput",headingTag:"h2"}}),z=new N({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:": typing.Optional[torch.FloatTensor] = 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#L29"}}),{c(){l=d("meta"),y=n(),u=d("p"),q=n(),m(C.$$.fragment),Z=n(),k=d("p"),k.innerHTML=Oe,ee=n(),m(F.$$.fragment),te=n(),s=d("div"),m(E.$$.fragment),ue=n(),G=d("p"),G.textContent=we,me=n(),U=d("p"),U.innerHTML=ye,he=n(),m(V.$$.fragment),fe=n(),S=d("div"),m(L.$$.fragment),ge=n(),W=d("p"),W.innerHTML=Ce,_e=n(),K=d("div"),m(M.$$.fragment),ve=n(),j=d("p"),j.textContent=ke,$e=n(),D=d("div"),m(P.$$.fragment),xe=n(),B=d("p"),B.textContent=Fe,be=n(),O=d("div"),m(H.$$.fragment),Te=n(),R=d("p"),R.textContent=Ee,Ve=n(),w=d("div"),m(A.$$.fragment),Se=n(),J=d("p"),J.innerHTML=Le,re=n(),m(I.$$.fragment),se=n(),x=d("div"),m(z.$$.fragment),Ke=n(),Q=d("p"),Q.textContent=Me,ae=n(),X=d("p"),this.h()},l(e){const a=Ne("svelte-u9bgzb",document.head);l=c(a,"META",{name:!0,content:!0}),a.forEach(r),y=o(e),u=c(e,"P",{}),b(u).forEach(r),q=o(e),h(C.$$.fragment,e),Z=o(e),k=c(e,"P",{"data-svelte-h":!0}),$(k)!=="svelte-16ihd05"&&(k.innerHTML=Oe),ee=o(e),h(F.$$.fragment,e),te=o(e),s=c(e,"DIV",{class:!0});var i=b(s);h(E.$$.fragment,i),ue=o(i),G=c(i,"P",{"data-svelte-h":!0}),$(G)!=="svelte-177z870"&&(G.textContent=we),me=o(i),U=c(i,"P",{"data-svelte-h":!0}),$(U)!=="svelte-linuuh"&&(U.innerHTML=ye),he=o(i),h(V.$$.fragment,i),fe=o(i),S=c(i,"DIV",{class:!0});var oe=b(S);h(L.$$.fragment,oe),ge=o(oe),W=c(oe,"P",{"data-svelte-h":!0}),$(W)!=="svelte-8x1g23"&&(W.innerHTML=Ce),oe.forEach(r),_e=o(i),K=c(i,"DIV",{class:!0});var ie=b(K);h(M.$$.fragment,ie),ve=o(ie),j=c(ie,"P",{"data-svelte-h":!0}),$(j)!=="svelte-1rkfgpx"&&(j.textContent=ke),ie.forEach(r),$e=o(i),D=c(i,"DIV",{class:!0});var de=b(D);h(P.$$.fragment,de),xe=o(de),B=c(de,"P",{"data-svelte-h":!0}),$(B)!=="svelte-1vzm9q"&&(B.textContent=Fe),de.forEach(r),be=o(i),O=c(i,"DIV",{class:!0});var ce=b(O);h(H.$$.fragment,ce),Te=o(ce),R=c(ce,"P",{"data-svelte-h":!0}),$(R)!=="svelte-hi84tp"&&(R.textContent=Ee),ce.forEach(r),Ve=o(i),w=c(i,"DIV",{class:!0});var le=b(w);h(A.$$.fragment,le),Se=o(le),J=c(le,"P",{"data-svelte-h":!0}),$(J)!=="svelte-1h4yget"&&(J.innerHTML=Le),le.forEach(r),i.forEach(r),re=o(e),h(I.$$.fragment,e),se=o(e),x=c(e,"DIV",{class:!0});var pe=b(x);h(z.$$.fragment,pe),Ke=o(pe),Q=c(pe,"P",{"data-svelte-h":!0}),$(Q)!=="svelte-7snghh"&&(Q.textContent=Me),pe.forEach(r),ae=o(e),X=c(e,"P",{}),b(X).forEach(r),this.h()},h(){T(l,"name","hf:doc:metadata"),T(l,"content",We),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(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(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,a){t(document.head,l),p(e,y,a),p(e,u,a),p(e,q,a),f(C,e,a),p(e,Z,a),p(e,k,a),p(e,ee,a),f(F,e,a),p(e,te,a),p(e,s,a),f(E,s,null),t(s,ue),t(s,G),t(s,me),t(s,U),t(s,he),f(V,s,null),t(s,fe),t(s,S),f(L,S,null),t(S,ge),t(S,W),t(s,_e),t(s,K),f(M,K,null),t(K,ve),t(K,j),t(s,$e),t(s,D),f(P,D,null),t(D,xe),t(D,B),t(s,be),t(s,O),f(H,O,null),t(O,Te),t(O,R),t(s,Ve),t(s,w),f(A,w,null),t(w,Se),t(w,J),p(e,re,a),f(I,e,a),p(e,se,a),p(e,x,a),f(z,x,null),t(x,Ke),t(x,Q),p(e,ae,a),p(e,X,a),ne=!0},p(e,[a]){const i={};a&2&&(i.$$scope={dirty:a,ctx:e}),V.$set(i)},i(e){ne||(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),ne=!0)},o(e){_(C.$$.fragment,e),_(F.$$.fragment,e),_(E.$$.fragment,e),_(V.$$.fragment,e),_(L.$$.fragment,e),_(M.$$.fragment,e),_(P.$$.fragment,e),_(H.$$.fragment,e),_(A.$$.fragment,e),_(I.$$.fragment,e),_(z.$$.fragment,e),ne=!1},d(e){e&&(r(y),r(u),r(q),r(Z),r(k),r(ee),r(te),r(s),r(re),r(se),r(x),r(ae),r(X)),r(l),v(C,e),v(F,e),v(E),v(V),v(L),v(M),v(P),v(H),v(A),v(I,e),v(z)}}}const We='{"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(Y){return He(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ye extends Ie{constructor(l){super(),ze(this,l,je,Ue,Pe,{})}}export{Ye as component};
