import{s as Ne,n as Ge,o as Ue}from"../chunks/scheduler.53228c21.js";import{S as je,i as Be,e as i,s,c as p,h as We,a as d,d as r,b as a,f as b,g as u,j as _,k as v,l as t,m as l,n as m,t as h,o as f,p as g}from"../chunks/index.100fac89.js";import{C as Fe}from"../chunks/CopyLLMTxtMenu.9360b11d.js";import{D as N}from"../chunks/Docstring.22cc8849.js";import{H as we,E as Qe}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.c9001d7a.js";function Re(Ce){let x,Y,J,Z,D,ee,y,te,w,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.',re,C,se,n,k,fe,G,Ee="A stochastic scheduler tailored to variance-expanding models.",ge,U,Le=`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.`,_e,E,Me=`<p>&gt; For more details on the parameters, see <a href="https://huggingface.co/papers/2206.00364" rel="nofollow">Appendix E</a>. The grid
search &gt; 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 &gt; the paper.</p>`,ve,T,L,xe,j,Pe=`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,V,M,be,B,He=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`,Te,S,P,Ve,W,Ie="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",Se,K,H,Ke,F,Ae=`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).`,Oe,O,I,De,Q,ze="Corrects the predicted sample based on the <code>model_output</code> of the network.",ae,A,ne,$,z,ye,R,qe="Output class for the scheduler’s step function output.",oe,q,ie,X,de;return D=new Fe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),y=new we({props:{title:"KarrasVeScheduler",local:"karrasvescheduler",headingTag:"h1"}}),C=new we({props:{title:"KarrasVeScheduler",local:"diffusers.KarrasVeScheduler",headingTag:"h2"}}),k=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"}}),L=new N({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:": typing.Optional[torch._C.Generator] = 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/main/src/diffusers/schedulers/deprecated/scheduling_karras_ve.py#L135"}}),M=new N({props:{name:"scale_model_input",anchor:"diffusers.KarrasVeScheduler.scale_model_input",parameters:[{name:"sample",val:": Tensor"},{name:"timestep",val:": typing.Optional[int] = 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/main/src/diffusers/schedulers/deprecated/scheduling_karras_ve.py#L96",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>
`}}),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#L113"}}),H=new N({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/main/src/diffusers/schedulers/deprecated/scheduling_karras_ve.py#L161",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 N({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/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#L200",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>
`}}),A=new we({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:": Tensor"},{name:"derivative",val:": Tensor"},{name:"pred_original_sample",val:": typing.Optional[torch.Tensor] = 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/main/src/diffusers/schedulers/deprecated/scheduling_karras_ve.py#L29"}}),q=new Qe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/schedulers/stochastic_karras_ve.md"}}),{c(){x=i("meta"),Y=s(),J=i("p"),Z=s(),p(D.$$.fragment),ee=s(),p(y.$$.fragment),te=s(),w=i("p"),w.innerHTML=ke,re=s(),p(C.$$.fragment),se=s(),n=i("div"),p(k.$$.fragment),fe=s(),G=i("p"),G.textContent=Ee,ge=s(),U=i("p"),U.innerHTML=Le,_e=s(),E=i("blockquote"),E.innerHTML=Me,ve=s(),T=i("div"),p(L.$$.fragment),xe=s(),j=i("p"),j.innerHTML=Pe,$e=s(),V=i("div"),p(M.$$.fragment),be=s(),B=i("p"),B.textContent=He,Te=s(),S=i("div"),p(P.$$.fragment),Ve=s(),W=i("p"),W.textContent=Ie,Se=s(),K=i("div"),p(H.$$.fragment),Ke=s(),F=i("p"),F.textContent=Ae,Oe=s(),O=i("div"),p(I.$$.fragment),De=s(),Q=i("p"),Q.innerHTML=ze,ae=s(),p(A.$$.fragment),ne=s(),$=i("div"),p(z.$$.fragment),ye=s(),R=i("p"),R.textContent=qe,oe=s(),p(q.$$.fragment),ie=s(),X=i("p"),this.h()},l(e){const o=We("svelte-u9bgzb",document.head);x=d(o,"META",{name:!0,content:!0}),o.forEach(r),Y=a(e),J=d(e,"P",{}),b(J).forEach(r),Z=a(e),u(D.$$.fragment,e),ee=a(e),u(y.$$.fragment,e),te=a(e),w=d(e,"P",{"data-svelte-h":!0}),_(w)!=="svelte-16ihd05"&&(w.innerHTML=ke),re=a(e),u(C.$$.fragment,e),se=a(e),n=d(e,"DIV",{class:!0});var c=b(n);u(k.$$.fragment,c),fe=a(c),G=d(c,"P",{"data-svelte-h":!0}),_(G)!=="svelte-177z870"&&(G.textContent=Ee),ge=a(c),U=d(c,"P",{"data-svelte-h":!0}),_(U)!=="svelte-linuuh"&&(U.innerHTML=Le),_e=a(c),E=d(c,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),_(E)!=="svelte-1mmbj36"&&(E.innerHTML=Me),ve=a(c),T=d(c,"DIV",{class:!0});var ce=b(T);u(L.$$.fragment,ce),xe=a(ce),j=d(ce,"P",{"data-svelte-h":!0}),_(j)!=="svelte-8x1g23"&&(j.innerHTML=Pe),ce.forEach(r),$e=a(c),V=d(c,"DIV",{class:!0});var le=b(V);u(M.$$.fragment,le),be=a(le),B=d(le,"P",{"data-svelte-h":!0}),_(B)!=="svelte-1rkfgpx"&&(B.textContent=He),le.forEach(r),Te=a(c),S=d(c,"DIV",{class:!0});var pe=b(S);u(P.$$.fragment,pe),Ve=a(pe),W=d(pe,"P",{"data-svelte-h":!0}),_(W)!=="svelte-1vzm9q"&&(W.textContent=Ie),pe.forEach(r),Se=a(c),K=d(c,"DIV",{class:!0});var ue=b(K);u(H.$$.fragment,ue),Ke=a(ue),F=d(ue,"P",{"data-svelte-h":!0}),_(F)!=="svelte-hi84tp"&&(F.textContent=Ae),ue.forEach(r),Oe=a(c),O=d(c,"DIV",{class:!0});var me=b(O);u(I.$$.fragment,me),De=a(me),Q=d(me,"P",{"data-svelte-h":!0}),_(Q)!=="svelte-1h4yget"&&(Q.innerHTML=ze),me.forEach(r),c.forEach(r),ae=a(e),u(A.$$.fragment,e),ne=a(e),$=d(e,"DIV",{class:!0});var he=b($);u(z.$$.fragment,he),ye=a(he),R=d(he,"P",{"data-svelte-h":!0}),_(R)!=="svelte-7snghh"&&(R.textContent=qe),he.forEach(r),oe=a(e),u(q.$$.fragment,e),ie=a(e),X=d(e,"P",{}),b(X).forEach(r),this.h()},h(){v(x,"name","hf:doc:metadata"),v(x,"content",Je),v(E,"class","tip"),v(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(n,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v($,"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,o){t(document.head,x),l(e,Y,o),l(e,J,o),l(e,Z,o),m(D,e,o),l(e,ee,o),m(y,e,o),l(e,te,o),l(e,w,o),l(e,re,o),m(C,e,o),l(e,se,o),l(e,n,o),m(k,n,null),t(n,fe),t(n,G),t(n,ge),t(n,U),t(n,_e),t(n,E),t(n,ve),t(n,T),m(L,T,null),t(T,xe),t(T,j),t(n,$e),t(n,V),m(M,V,null),t(V,be),t(V,B),t(n,Te),t(n,S),m(P,S,null),t(S,Ve),t(S,W),t(n,Se),t(n,K),m(H,K,null),t(K,Ke),t(K,F),t(n,Oe),t(n,O),m(I,O,null),t(O,De),t(O,Q),l(e,ae,o),m(A,e,o),l(e,ne,o),l(e,$,o),m(z,$,null),t($,ye),t($,R),l(e,oe,o),m(q,e,o),l(e,ie,o),l(e,X,o),de=!0},p:Ge,i(e){de||(h(D.$$.fragment,e),h(y.$$.fragment,e),h(C.$$.fragment,e),h(k.$$.fragment,e),h(L.$$.fragment,e),h(M.$$.fragment,e),h(P.$$.fragment,e),h(H.$$.fragment,e),h(I.$$.fragment,e),h(A.$$.fragment,e),h(z.$$.fragment,e),h(q.$$.fragment,e),de=!0)},o(e){f(D.$$.fragment,e),f(y.$$.fragment,e),f(C.$$.fragment,e),f(k.$$.fragment,e),f(L.$$.fragment,e),f(M.$$.fragment,e),f(P.$$.fragment,e),f(H.$$.fragment,e),f(I.$$.fragment,e),f(A.$$.fragment,e),f(z.$$.fragment,e),f(q.$$.fragment,e),de=!1},d(e){e&&(r(Y),r(J),r(Z),r(ee),r(te),r(w),r(re),r(se),r(n),r(ae),r(ne),r($),r(oe),r(ie),r(X)),r(x),g(D,e),g(y,e),g(C,e),g(k),g(L),g(M),g(P),g(H),g(I),g(A,e),g(z),g(q,e)}}}const Je='{"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 Xe(Ce){return Ue(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class st extends je{constructor(x){super(),Be(this,x,Xe,Re,Ne,{})}}export{st as component};
