import{s as Ve,n as Xe,o as we}from"../chunks/scheduler.53228c21.js";import{S as Le,i as Pe,e as d,s as n,c as p,h as Ee,a,d as o,b as r,f as C,g as u,j as T,k as y,l as t,m as l,n as m,t as f,o as h,p as g}from"../chunks/index.100fac89.js";import{C as qe}from"../chunks/CopyLLMTxtMenu.20a72e0e.js";import{D as W}from"../chunks/Docstring.49101787.js";import{H as Se,E as Ne}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.4d82655d.js";function Oe(ve){let _,j,R,B,M,J,I,K,S,be='<code>CogVideoXDDIMScheduler</code> is based on <a href="https://huggingface.co/papers/2010.02502" rel="nofollow">Denoising Diffusion Implicit Models</a>, specifically for CogVideoX models.',Q,V,Y,s,X,de,O,xe=`<code>DDIMScheduler</code> extends the denoising procedure introduced in denoising diffusion probabilistic models (DDPMs) with
non-Markovian guidance.`,ae,z,$e=`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.`,ce,D,w,le,H,Ce=`Add noise to the original samples according to the noise magnitude at each timestep (this is the forward
diffusion process).`,pe,v,L,ue,k,Te="Compute the velocity prediction from the sample and noise according to the velocity formula.",me,b,P,fe,A,ye=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`,he,x,E,ge,F,Me="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",_e,$,q,De,U,Ie=`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).`,Z,N,ee,G,te;return M=new qe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),I=new Se({props:{title:"CogVideoXDDIMScheduler",local:"cogvideoxddimscheduler",headingTag:"h1"}}),V=new Se({props:{title:"CogVideoXDDIMScheduler",local:"diffusers.CogVideoXDDIMScheduler",headingTag:"h2"}}),X=new W({props:{name:"class diffusers.CogVideoXDDIMScheduler",anchor:"diffusers.CogVideoXDDIMScheduler",parameters:[{name:"num_train_timesteps",val:": int = 1000"},{name:"beta_start",val:": float = 0.00085"},{name:"beta_end",val:": float = 0.012"},{name:"beta_schedule",val:": str = 'scaled_linear'"},{name:"trained_betas",val:": typing.Union[numpy.ndarray, typing.List[float], NoneType] = None"},{name:"clip_sample",val:": bool = True"},{name:"set_alpha_to_one",val:": bool = True"},{name:"steps_offset",val:": int = 0"},{name:"prediction_type",val:": str = 'epsilon'"},{name:"clip_sample_range",val:": float = 1.0"},{name:"sample_max_value",val:": float = 1.0"},{name:"timestep_spacing",val:": str = 'leading'"},{name:"rescale_betas_zero_snr",val:": bool = False"},{name:"snr_shift_scale",val:": float = 3.0"}],parametersDescription:[{anchor:"diffusers.CogVideoXDDIMScheduler.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.CogVideoXDDIMScheduler.beta_start",description:`<strong>beta_start</strong> (<code>float</code>, defaults to 0.0001) &#x2014;
The starting <code>beta</code> value of inference.`,name:"beta_start"},{anchor:"diffusers.CogVideoXDDIMScheduler.beta_end",description:`<strong>beta_end</strong> (<code>float</code>, defaults to 0.02) &#x2014;
The final <code>beta</code> value.`,name:"beta_end"},{anchor:"diffusers.CogVideoXDDIMScheduler.beta_schedule",description:`<strong>beta_schedule</strong> (<code>str</code>, defaults to <code>&quot;linear&quot;</code>) &#x2014;
The beta schedule, a mapping from a beta range to a sequence of betas for stepping the model. Choose from
<code>linear</code>, <code>scaled_linear</code>, or <code>squaredcos_cap_v2</code>.`,name:"beta_schedule"},{anchor:"diffusers.CogVideoXDDIMScheduler.trained_betas",description:`<strong>trained_betas</strong> (<code>np.ndarray</code>, <em>optional</em>) &#x2014;
Pass an array of betas directly to the constructor to bypass <code>beta_start</code> and <code>beta_end</code>.`,name:"trained_betas"},{anchor:"diffusers.CogVideoXDDIMScheduler.clip_sample",description:`<strong>clip_sample</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Clip the predicted sample for numerical stability.`,name:"clip_sample"},{anchor:"diffusers.CogVideoXDDIMScheduler.clip_sample_range",description:`<strong>clip_sample_range</strong> (<code>float</code>, defaults to 1.0) &#x2014;
The maximum magnitude for sample clipping. Valid only when <code>clip_sample=True</code>.`,name:"clip_sample_range"},{anchor:"diffusers.CogVideoXDDIMScheduler.set_alpha_to_one",description:`<strong>set_alpha_to_one</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Each diffusion step uses the alphas product value at that step and at the previous one. For the final step
there is no previous alpha. When this option is <code>True</code> the previous alpha product is fixed to <code>1</code>,
otherwise it uses the alpha value at step 0.`,name:"set_alpha_to_one"},{anchor:"diffusers.CogVideoXDDIMScheduler.steps_offset",description:`<strong>steps_offset</strong> (<code>int</code>, defaults to 0) &#x2014;
An offset added to the inference steps, as required by some model families.`,name:"steps_offset"},{anchor:"diffusers.CogVideoXDDIMScheduler.prediction_type",description:`<strong>prediction_type</strong> (<code>str</code>, defaults to <code>epsilon</code>, <em>optional</em>) &#x2014;
Prediction type of the scheduler function; can be <code>epsilon</code> (predicts the noise of the diffusion process),
<code>sample</code> (directly predicts the noisy sample<code>) or </code>v_prediction\` (see section 2.4 of <a href="https://huggingface.co/papers/2210.02303" rel="nofollow">Imagen
Video</a> paper).`,name:"prediction_type"},{anchor:"diffusers.CogVideoXDDIMScheduler.thresholding",description:`<strong>thresholding</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Whether to use the &#x201C;dynamic thresholding&#x201D; method. This is unsuitable for latent-space diffusion models such
as Stable Diffusion.`,name:"thresholding"},{anchor:"diffusers.CogVideoXDDIMScheduler.dynamic_thresholding_ratio",description:`<strong>dynamic_thresholding_ratio</strong> (<code>float</code>, defaults to 0.995) &#x2014;
The ratio for the dynamic thresholding method. Valid only when <code>thresholding=True</code>.`,name:"dynamic_thresholding_ratio"},{anchor:"diffusers.CogVideoXDDIMScheduler.sample_max_value",description:`<strong>sample_max_value</strong> (<code>float</code>, defaults to 1.0) &#x2014;
The threshold value for dynamic thresholding. Valid only when <code>thresholding=True</code>.`,name:"sample_max_value"},{anchor:"diffusers.CogVideoXDDIMScheduler.timestep_spacing",description:`<strong>timestep_spacing</strong> (<code>str</code>, defaults to <code>&quot;leading&quot;</code>) &#x2014;
The way the timesteps should be scaled. Refer to Table 2 of the <a href="https://huggingface.co/papers/2305.08891" rel="nofollow">Common Diffusion Noise Schedules and
Sample Steps are Flawed</a> for more information.`,name:"timestep_spacing"},{anchor:"diffusers.CogVideoXDDIMScheduler.rescale_betas_zero_snr",description:`<strong>rescale_betas_zero_snr</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Whether to rescale the betas to have zero terminal SNR. This enables the model to generate very bright and
dark samples instead of limiting it to samples with medium brightness. Loosely related to
<a href="https://github.com/huggingface/diffusers/blob/74fd735eb073eb1d774b1ab4154a0876eb82f055/examples/dreambooth/train_dreambooth.py#L506" rel="nofollow"><code>--offset_noise</code></a>.`,name:"rescale_betas_zero_snr"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_ddim_cogvideox.py#L127"}}),w=new W({props:{name:"add_noise",anchor:"diffusers.CogVideoXDDIMScheduler.add_noise",parameters:[{name:"original_samples",val:": Tensor"},{name:"noise",val:": Tensor"},{name:"timesteps",val:": IntTensor"}],parametersDescription:[{anchor:"diffusers.CogVideoXDDIMScheduler.add_noise.original_samples",description:`<strong>original_samples</strong> (<code>torch.Tensor</code>) &#x2014;
The original samples to which noise will be added.`,name:"original_samples"},{anchor:"diffusers.CogVideoXDDIMScheduler.add_noise.noise",description:`<strong>noise</strong> (<code>torch.Tensor</code>) &#x2014;
The noise to add to the samples.`,name:"noise"},{anchor:"diffusers.CogVideoXDDIMScheduler.add_noise.timesteps",description:`<strong>timesteps</strong> (<code>torch.IntTensor</code>) &#x2014;
The timesteps indicating the noise level for each sample.`,name:"timesteps"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_ddim_cogvideox.py#L406",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The noisy samples.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.Tensor</code></p>
`}}),L=new W({props:{name:"get_velocity",anchor:"diffusers.CogVideoXDDIMScheduler.get_velocity",parameters:[{name:"sample",val:": Tensor"},{name:"noise",val:": Tensor"},{name:"timesteps",val:": IntTensor"}],parametersDescription:[{anchor:"diffusers.CogVideoXDDIMScheduler.get_velocity.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
The input sample.`,name:"sample"},{anchor:"diffusers.CogVideoXDDIMScheduler.get_velocity.noise",description:`<strong>noise</strong> (<code>torch.Tensor</code>) &#x2014;
The noise tensor.`,name:"noise"},{anchor:"diffusers.CogVideoXDDIMScheduler.get_velocity.timesteps",description:`<strong>timesteps</strong> (<code>torch.IntTensor</code>) &#x2014;
The timesteps for velocity computation.`,name:"timesteps"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_ddim_cogvideox.py#L449",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The computed velocity.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.Tensor</code></p>
`}}),P=new W({props:{name:"scale_model_input",anchor:"diffusers.CogVideoXDDIMScheduler.scale_model_input",parameters:[{name:"sample",val:": Tensor"},{name:"timestep",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"diffusers.CogVideoXDDIMScheduler.scale_model_input.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
The input sample.`,name:"sample"},{anchor:"diffusers.CogVideoXDDIMScheduler.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/scheduling_ddim_cogvideox.py#L244",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>
`}}),E=new W({props:{name:"set_timesteps",anchor:"diffusers.CogVideoXDDIMScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": typing.Union[str, torch.device] = None"}],parametersDescription:[{anchor:"diffusers.CogVideoXDDIMScheduler.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"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_ddim_cogvideox.py#L261"}}),q=new W({props:{name:"step",anchor:"diffusers.CogVideoXDDIMScheduler.step",parameters:[{name:"model_output",val:": Tensor"},{name:"timestep",val:": int"},{name:"sample",val:": Tensor"},{name:"eta",val:": float = 0.0"},{name:"use_clipped_model_output",val:": bool = False"},{name:"generator",val:" = None"},{name:"variance_noise",val:": typing.Optional[torch.Tensor] = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.CogVideoXDDIMScheduler.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.CogVideoXDDIMScheduler.step.timestep",description:`<strong>timestep</strong> (<code>float</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.CogVideoXDDIMScheduler.step.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
A current instance of a sample created by the diffusion process.`,name:"sample"},{anchor:"diffusers.CogVideoXDDIMScheduler.step.eta",description:`<strong>eta</strong> (<code>float</code>) &#x2014;
The weight of noise for added noise in diffusion step.`,name:"eta"},{anchor:"diffusers.CogVideoXDDIMScheduler.step.use_clipped_model_output",description:`<strong>use_clipped_model_output</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
If <code>True</code>, computes &#x201C;corrected&#x201D; <code>model_output</code> from the clipped predicted original sample. Necessary
because predicted original sample is clipped to [-1, 1] when <code>self.config.clip_sample</code> is <code>True</code>. If no
clipping has happened, &#x201C;corrected&#x201D; <code>model_output</code> would coincide with the one provided as input and
<code>use_clipped_model_output</code> has no effect.`,name:"use_clipped_model_output"},{anchor:"diffusers.CogVideoXDDIMScheduler.step.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
A random number generator.`,name:"generator"},{anchor:"diffusers.CogVideoXDDIMScheduler.step.variance_noise",description:`<strong>variance_noise</strong> (<code>torch.Tensor</code>) &#x2014;
Alternative to generating noise with <code>generator</code> by directly providing the noise for the variance
itself. Useful for methods such as <code>CycleDiffusion</code>.`,name:"variance_noise"},{anchor:"diffusers.CogVideoXDDIMScheduler.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 <a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.schedulers.scheduling_ddim.DDIMSchedulerOutput">DDIMSchedulerOutput</a> or <code>tuple</code>.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/schedulers/scheduling_ddim_cogvideox.py#L306",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


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