import{s as Oe,n as Pe,o as ke}from"../chunks/scheduler.53228c21.js";import{S as qe,i as Ne,e as a,s as r,c as m,h as Ie,a as l,d as s,b as o,f as F,g as h,j as b,k as M,l as t,m as d,n as f,t as p,o as g,p as _}from"../chunks/index.100fac89.js";import{C as He}from"../chunks/CopyLLMTxtMenu.b0ff86f3.js";import{D as R}from"../chunks/Docstring.db856a1e.js";import{H as Le,E as Ve}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.136ef3fd.js";function ze(we){let x,B,X,J,E,Q,y,Y,S,$e='<code>FlowMatchEulerDiscreteScheduler</code> is based on the flow-matching sampling introduced in <a href="https://huggingface.co/papers/2403.03206" rel="nofollow">Stable Diffusion 3</a>.',Z,T,ee,n,C,le,I,De="Euler scheduler.",ce,H,Fe=`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.`,de,v,L,ue,V,Me="Forward process in flow-matching",me,w,O,he,z,Ee="Sets the begin index for the scheduler. This function should be run from pipeline before the inference.",fe,$,P,pe,W,ye="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",ge,D,k,_e,A,Se=`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).`,xe,u,q,be,U,Te=`Stretches and shifts the timestep schedule to ensure it terminates at the configured <code>shift_terminal</code> config
value.`,ve,j,Ce=`Reference:
<a href="https://github.com/Lightricks/LTX-Video/blob/a01a171f8fe3d99dce2728d60a73fecf4d4238ae/ltx_video/schedulers/rf.py#L51" rel="nofollow">https://github.com/Lightricks/LTX-Video/blob/a01a171f8fe3d99dce2728d60a73fecf4d4238ae/ltx_video/schedulers/rf.py#L51</a>`,te,N,se,K,ne;return E=new He({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),y=new Le({props:{title:"FlowMatchEulerDiscreteScheduler",local:"flowmatcheulerdiscretescheduler",headingTag:"h1"}}),T=new Le({props:{title:"FlowMatchEulerDiscreteScheduler",local:"diffusers.FlowMatchEulerDiscreteScheduler",headingTag:"h2"}}),C=new R({props:{name:"class diffusers.FlowMatchEulerDiscreteScheduler",anchor:"diffusers.FlowMatchEulerDiscreteScheduler",parameters:[{name:"num_train_timesteps",val:": int = 1000"},{name:"shift",val:": float = 1.0"},{name:"use_dynamic_shifting",val:": bool = False"},{name:"base_shift",val:": typing.Optional[float] = 0.5"},{name:"max_shift",val:": typing.Optional[float] = 1.15"},{name:"base_image_seq_len",val:": typing.Optional[int] = 256"},{name:"max_image_seq_len",val:": typing.Optional[int] = 4096"},{name:"invert_sigmas",val:": bool = False"},{name:"shift_terminal",val:": typing.Optional[float] = None"},{name:"use_karras_sigmas",val:": typing.Optional[bool] = False"},{name:"use_exponential_sigmas",val:": typing.Optional[bool] = False"},{name:"use_beta_sigmas",val:": typing.Optional[bool] = False"},{name:"time_shift_type",val:": str = 'exponential'"},{name:"stochastic_sampling",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.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.FlowMatchEulerDiscreteScheduler.shift",description:`<strong>shift</strong> (<code>float</code>, defaults to 1.0) &#x2014;
The shift value for the timestep schedule.`,name:"shift"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.use_dynamic_shifting",description:`<strong>use_dynamic_shifting</strong> (<code>bool</code>, defaults to False) &#x2014;
Whether to apply timestep shifting on-the-fly based on the image resolution.`,name:"use_dynamic_shifting"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.base_shift",description:`<strong>base_shift</strong> (<code>float</code>, defaults to 0.5) &#x2014;
Value to stabilize image generation. Increasing <code>base_shift</code> reduces variation and image is more consistent
with desired output.`,name:"base_shift"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.max_shift",description:`<strong>max_shift</strong> (<code>float</code>, defaults to 1.15) &#x2014;
Value change allowed to latent vectors. Increasing <code>max_shift</code> encourages more variation and image may be
more exaggerated or stylized.`,name:"max_shift"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.base_image_seq_len",description:`<strong>base_image_seq_len</strong> (<code>int</code>, defaults to 256) &#x2014;
The base image sequence length.`,name:"base_image_seq_len"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.max_image_seq_len",description:`<strong>max_image_seq_len</strong> (<code>int</code>, defaults to 4096) &#x2014;
The maximum image sequence length.`,name:"max_image_seq_len"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.invert_sigmas",description:`<strong>invert_sigmas</strong> (<code>bool</code>, defaults to False) &#x2014;
Whether to invert the sigmas.`,name:"invert_sigmas"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.shift_terminal",description:`<strong>shift_terminal</strong> (<code>float</code>, defaults to None) &#x2014;
The end value of the shifted timestep schedule.`,name:"shift_terminal"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.use_karras_sigmas",description:`<strong>use_karras_sigmas</strong> (<code>bool</code>, defaults to False) &#x2014;
Whether to use Karras sigmas for step sizes in the noise schedule during sampling.`,name:"use_karras_sigmas"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.use_exponential_sigmas",description:`<strong>use_exponential_sigmas</strong> (<code>bool</code>, defaults to False) &#x2014;
Whether to use exponential sigmas for step sizes in the noise schedule during sampling.`,name:"use_exponential_sigmas"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.use_beta_sigmas",description:`<strong>use_beta_sigmas</strong> (<code>bool</code>, defaults to False) &#x2014;
Whether to use beta sigmas for step sizes in the noise schedule during sampling.`,name:"use_beta_sigmas"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.time_shift_type",description:`<strong>time_shift_type</strong> (<code>str</code>, defaults to &#x201C;exponential&#x201D;) &#x2014;
The type of dynamic resolution-dependent timestep shifting to apply. Either &#x201C;exponential&#x201D; or &#x201C;linear&#x201D;.`,name:"time_shift_type"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.stochastic_sampling",description:`<strong>stochastic_sampling</strong> (<code>bool</code>, defaults to False) &#x2014;
Whether to use stochastic sampling.`,name:"stochastic_sampling"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_flow_match_euler_discrete.py#L47"}}),L=new R({props:{name:"scale_noise",anchor:"diffusers.FlowMatchEulerDiscreteScheduler.scale_noise",parameters:[{name:"sample",val:": FloatTensor"},{name:"timestep",val:": typing.Union[float, torch.FloatTensor]"},{name:"noise",val:": typing.Optional[torch.FloatTensor] = None"}],parametersDescription:[{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.scale_noise.sample",description:`<strong>sample</strong> (<code>torch.FloatTensor</code>) &#x2014;
The input sample.`,name:"sample"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.scale_noise.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/scheduling_flow_match_euler_discrete.py#L171",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>
`}}),O=new R({props:{name:"set_begin_index",anchor:"diffusers.FlowMatchEulerDiscreteScheduler.set_begin_index",parameters:[{name:"begin_index",val:": int = 0"}],parametersDescription:[{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.set_begin_index.begin_index",description:`<strong>begin_index</strong> (<code>int</code>) &#x2014;
The begin index for the scheduler.`,name:"begin_index"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_flow_match_euler_discrete.py#L158"}}),P=new R({props:{name:"set_timesteps",anchor:"diffusers.FlowMatchEulerDiscreteScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": typing.Optional[int] = None"},{name:"device",val:": typing.Union[str, torch.device] = None"},{name:"sigmas",val:": typing.Optional[typing.List[float]] = None"},{name:"mu",val:": typing.Optional[float] = None"},{name:"timesteps",val:": typing.Optional[typing.List[float]] = None"}],parametersDescription:[{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.set_timesteps.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of diffusion steps used when generating samples with a pre-trained model.`,name:"num_inference_steps"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.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"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.set_timesteps.sigmas",description:`<strong>sigmas</strong> (<code>List[float]</code>, <em>optional</em>) &#x2014;
Custom values for sigmas to be used for each diffusion step. If <code>None</code>, the sigmas are computed
automatically.`,name:"sigmas"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.set_timesteps.mu",description:`<strong>mu</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Determines the amount of shifting applied to sigmas when performing resolution-dependent timestep
shifting.`,name:"mu"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.set_timesteps.timesteps",description:`<strong>timesteps</strong> (<code>List[float]</code>, <em>optional</em>) &#x2014;
Custom values for timesteps to be used for each diffusion step. If <code>None</code>, the timesteps are computed
automatically.`,name:"timesteps"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_flow_match_euler_discrete.py#L249"}}),k=new R({props:{name:"step",anchor:"diffusers.FlowMatchEulerDiscreteScheduler.step",parameters:[{name:"model_output",val:": FloatTensor"},{name:"timestep",val:": typing.Union[float, torch.FloatTensor]"},{name:"sample",val:": FloatTensor"},{name:"s_churn",val:": float = 0.0"},{name:"s_tmin",val:": float = 0.0"},{name:"s_tmax",val:": float = inf"},{name:"s_noise",val:": float = 1.0"},{name:"generator",val:": typing.Optional[torch._C.Generator] = None"},{name:"per_token_timesteps",val:": typing.Optional[torch.Tensor] = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.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.FlowMatchEulerDiscreteScheduler.step.timestep",description:`<strong>timestep</strong> (<code>float</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.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.FlowMatchEulerDiscreteScheduler.step.s_churn",description:"<strong>s_churn</strong> (<code>float</code>) &#x2014;",name:"s_churn"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.step.s_tmin",description:"<strong>s_tmin</strong>  (<code>float</code>) &#x2014;",name:"s_tmin"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.step.s_tmax",description:"<strong>s_tmax</strong>  (<code>float</code>) &#x2014;",name:"s_tmax"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.step.s_noise",description:`<strong>s_noise</strong> (<code>float</code>, defaults to 1.0) &#x2014;
Scaling factor for noise added to the sample.`,name:"s_noise"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.step.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
A random number generator.`,name:"generator"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.step.per_token_timesteps",description:`<strong>per_token_timesteps</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
The timesteps for each token in the sample.`,name:"per_token_timesteps"},{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.step.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>) &#x2014;
Whether or not to return a
<code>FlowMatchEulerDiscreteSchedulerOutput</code> or tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_flow_match_euler_discrete.py#L373",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If return_dict is <code>True</code>,
<code>FlowMatchEulerDiscreteSchedulerOutput</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>FlowMatchEulerDiscreteSchedulerOutput</code> or <code>tuple</code></p>
`}}),q=new R({props:{name:"stretch_shift_to_terminal",anchor:"diffusers.FlowMatchEulerDiscreteScheduler.stretch_shift_to_terminal",parameters:[{name:"t",val:": Tensor"}],parametersDescription:[{anchor:"diffusers.FlowMatchEulerDiscreteScheduler.stretch_shift_to_terminal.t",description:`<strong>t</strong> (<code>torch.Tensor</code>) &#x2014;
A tensor of timesteps to be stretched and shifted.`,name:"t"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_flow_match_euler_discrete.py#L228",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A tensor of adjusted timesteps such that the final value equals <code>self.config.shift_terminal</code>.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.Tensor</code></p>
`}}),N=new Ve({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/schedulers/flow_match_euler_discrete.md"}}),{c(){x=a("meta"),B=r(),X=a("p"),J=r(),m(E.$$.fragment),Q=r(),m(y.$$.fragment),Y=r(),S=a("p"),S.innerHTML=$e,Z=r(),m(T.$$.fragment),ee=r(),n=a("div"),m(C.$$.fragment),le=r(),I=a("p"),I.textContent=De,ce=r(),H=a("p"),H.innerHTML=Fe,de=r(),v=a("div"),m(L.$$.fragment),ue=r(),V=a("p"),V.textContent=Me,me=r(),w=a("div"),m(O.$$.fragment),he=r(),z=a("p"),z.textContent=Ee,fe=r(),$=a("div"),m(P.$$.fragment),pe=r(),W=a("p"),W.textContent=ye,ge=r(),D=a("div"),m(k.$$.fragment),_e=r(),A=a("p"),A.textContent=Se,xe=r(),u=a("div"),m(q.$$.fragment),be=r(),U=a("p"),U.innerHTML=Te,ve=r(),j=a("p"),j.innerHTML=Ce,te=r(),m(N.$$.fragment),se=r(),K=a("p"),this.h()},l(e){const i=Ie("svelte-u9bgzb",document.head);x=l(i,"META",{name:!0,content:!0}),i.forEach(s),B=o(e),X=l(e,"P",{}),F(X).forEach(s),J=o(e),h(E.$$.fragment,e),Q=o(e),h(y.$$.fragment,e),Y=o(e),S=l(e,"P",{"data-svelte-h":!0}),b(S)!=="svelte-eio0d1"&&(S.innerHTML=$e),Z=o(e),h(T.$$.fragment,e),ee=o(e),n=l(e,"DIV",{class:!0});var c=F(n);h(C.$$.fragment,c),le=o(c),I=l(c,"P",{"data-svelte-h":!0}),b(I)!=="svelte-rqsn3u"&&(I.textContent=De),ce=o(c),H=l(c,"P",{"data-svelte-h":!0}),b(H)!=="svelte-linuuh"&&(H.innerHTML=Fe),de=o(c),v=l(c,"DIV",{class:!0});var re=F(v);h(L.$$.fragment,re),ue=o(re),V=l(re,"P",{"data-svelte-h":!0}),b(V)!=="svelte-1nqwaax"&&(V.textContent=Me),re.forEach(s),me=o(c),w=l(c,"DIV",{class:!0});var oe=F(w);h(O.$$.fragment,oe),he=o(oe),z=l(oe,"P",{"data-svelte-h":!0}),b(z)!=="svelte-1k141rk"&&(z.textContent=Ee),oe.forEach(s),fe=o(c),$=l(c,"DIV",{class:!0});var ie=F($);h(P.$$.fragment,ie),pe=o(ie),W=l(ie,"P",{"data-svelte-h":!0}),b(W)!=="svelte-1vzm9q"&&(W.textContent=ye),ie.forEach(s),ge=o(c),D=l(c,"DIV",{class:!0});var ae=F(D);h(k.$$.fragment,ae),_e=o(ae),A=l(ae,"P",{"data-svelte-h":!0}),b(A)!=="svelte-hi84tp"&&(A.textContent=Se),ae.forEach(s),xe=o(c),u=l(c,"DIV",{class:!0});var G=F(u);h(q.$$.fragment,G),be=o(G),U=l(G,"P",{"data-svelte-h":!0}),b(U)!=="svelte-1mirmbz"&&(U.innerHTML=Te),ve=o(G),j=l(G,"P",{"data-svelte-h":!0}),b(j)!=="svelte-1sj7udg"&&(j.innerHTML=Ce),G.forEach(s),c.forEach(s),te=o(e),h(N.$$.fragment,e),se=o(e),K=l(e,"P",{}),F(K).forEach(s),this.h()},h(){M(x,"name","hf:doc:metadata"),M(x,"content",We),M(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(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),M($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),M(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),M(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),M(n,"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,i){t(document.head,x),d(e,B,i),d(e,X,i),d(e,J,i),f(E,e,i),d(e,Q,i),f(y,e,i),d(e,Y,i),d(e,S,i),d(e,Z,i),f(T,e,i),d(e,ee,i),d(e,n,i),f(C,n,null),t(n,le),t(n,I),t(n,ce),t(n,H),t(n,de),t(n,v),f(L,v,null),t(v,ue),t(v,V),t(n,me),t(n,w),f(O,w,null),t(w,he),t(w,z),t(n,fe),t(n,$),f(P,$,null),t($,pe),t($,W),t(n,ge),t(n,D),f(k,D,null),t(D,_e),t(D,A),t(n,xe),t(n,u),f(q,u,null),t(u,be),t(u,U),t(u,ve),t(u,j),d(e,te,i),f(N,e,i),d(e,se,i),d(e,K,i),ne=!0},p:Pe,i(e){ne||(p(E.$$.fragment,e),p(y.$$.fragment,e),p(T.$$.fragment,e),p(C.$$.fragment,e),p(L.$$.fragment,e),p(O.$$.fragment,e),p(P.$$.fragment,e),p(k.$$.fragment,e),p(q.$$.fragment,e),p(N.$$.fragment,e),ne=!0)},o(e){g(E.$$.fragment,e),g(y.$$.fragment,e),g(T.$$.fragment,e),g(C.$$.fragment,e),g(L.$$.fragment,e),g(O.$$.fragment,e),g(P.$$.fragment,e),g(k.$$.fragment,e),g(q.$$.fragment,e),g(N.$$.fragment,e),ne=!1},d(e){e&&(s(B),s(X),s(J),s(Q),s(Y),s(S),s(Z),s(ee),s(n),s(te),s(se),s(K)),s(x),_(E,e),_(y,e),_(T,e),_(C),_(L),_(O),_(P),_(k),_(q),_(N,e)}}}const We='{"title":"FlowMatchEulerDiscreteScheduler","local":"flowmatcheulerdiscretescheduler","sections":[{"title":"FlowMatchEulerDiscreteScheduler","local":"diffusers.FlowMatchEulerDiscreteScheduler","sections":[],"depth":2}],"depth":1}';function Ae(we){return ke(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ke extends qe{constructor(x){super(),Ne(this,x,Ae,ze,Oe,{})}}export{Ke as component};
