import{s as he,n as ge,o as _e}from"../chunks/scheduler.53228c21.js";import{S as be,i as ve,e as d,s as r,c as h,h as xe,a,d as t,b as i,f as F,g,j as O,k as q,l as n,m as l,n as _,t as b,o as v,p as x}from"../chunks/index.100fac89.js";import{C as De}from"../chunks/CopyLLMTxtMenu.9360b11d.js";import{D as Y}from"../chunks/Docstring.22cc8849.js";import{H as fe,E as $e}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.c9001d7a.js";function Me(de){let p,A,z,H,D,k,$,U,M,ae='<code>CogVideoXDPMScheduler</code> is based on <a href="https://huggingface.co/papers/2206.00927" rel="nofollow">DPM-Solver: A Fast ODE Solver for Diffusion Probabilistic Model Sampling in Around 10 Steps</a> and <a href="https://huggingface.co/papers/2211.01095" rel="nofollow">DPM-Solver++: Fast Solver for Guided Sampling of Diffusion Probabilistic Models</a>, specifically for CogVideoX models.',W,S,G,s,C,Z,X,ce=`<code>DDIMScheduler</code> extends the denoising procedure introduced in denoising diffusion probabilistic models (DDPMs) with
non-Markovian guidance.`,ee,w,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.`,te,u,y,oe,L,pe=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`,se,m,P,ne,I,ue="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",re,f,T,ie,E,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).`,R,V,j,N,B;return D=new De({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),$=new fe({props:{title:"CogVideoXDPMScheduler",local:"cogvideoxdpmscheduler",headingTag:"h1"}}),S=new fe({props:{title:"CogVideoXDPMScheduler",local:"diffusers.CogVideoXDPMScheduler",headingTag:"h2"}}),C=new Y({props:{name:"class diffusers.CogVideoXDPMScheduler",anchor:"diffusers.CogVideoXDPMScheduler",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.CogVideoXDPMScheduler.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.CogVideoXDPMScheduler.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.CogVideoXDPMScheduler.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.CogVideoXDPMScheduler.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.CogVideoXDPMScheduler.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.CogVideoXDPMScheduler.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.CogVideoXDPMScheduler.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.CogVideoXDPMScheduler.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.CogVideoXDPMScheduler.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.CogVideoXDPMScheduler.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://imagen.research.google/video/paper.pdf" rel="nofollow">Imagen
Video</a> paper).`,name:"prediction_type"},{anchor:"diffusers.CogVideoXDPMScheduler.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.CogVideoXDPMScheduler.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.CogVideoXDPMScheduler.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.CogVideoXDPMScheduler.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.CogVideoXDPMScheduler.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_dpm_cogvideox.py#L127"}}),y=new Y({props:{name:"scale_model_input",anchor:"diffusers.CogVideoXDPMScheduler.scale_model_input",parameters:[{name:"sample",val:": Tensor"},{name:"timestep",val:": typing.Optional[int] = None"}],parametersDescription:[{anchor:"diffusers.CogVideoXDPMScheduler.scale_model_input.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
The input sample.`,name:"sample"},{anchor:"diffusers.CogVideoXDPMScheduler.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_dpm_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>
`}}),P=new Y({props:{name:"set_timesteps",anchor:"diffusers.CogVideoXDPMScheduler.set_timesteps",parameters:[{name:"num_inference_steps",val:": int"},{name:"device",val:": typing.Union[str, torch.device] = None"}],parametersDescription:[{anchor:"diffusers.CogVideoXDPMScheduler.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_dpm_cogvideox.py#L261"}}),T=new Y({props:{name:"step",anchor:"diffusers.CogVideoXDPMScheduler.step",parameters:[{name:"model_output",val:": Tensor"},{name:"old_pred_original_sample",val:": Tensor"},{name:"timestep",val:": int"},{name:"timestep_back",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 = False"}],parametersDescription:[{anchor:"diffusers.CogVideoXDPMScheduler.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.CogVideoXDPMScheduler.step.timestep",description:`<strong>timestep</strong> (<code>float</code>) &#x2014;
The current discrete timestep in the diffusion chain.`,name:"timestep"},{anchor:"diffusers.CogVideoXDPMScheduler.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.CogVideoXDPMScheduler.step.eta",description:`<strong>eta</strong> (<code>float</code>) &#x2014;
The weight of noise for added noise in diffusion step.`,name:"eta"},{anchor:"diffusers.CogVideoXDPMScheduler.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.CogVideoXDPMScheduler.step.generator",description:`<strong>generator</strong> (<code>torch.Generator</code>, <em>optional</em>) &#x2014;
A random number generator.`,name:"generator"},{anchor:"diffusers.CogVideoXDPMScheduler.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.CogVideoXDPMScheduler.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_dpm_cogvideox.py#L330",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>
`}}),V=new $e({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/schedulers/multistep_dpm_solver_cogvideox.md"}}),{c(){p=d("meta"),A=r(),z=d("p"),H=r(),h(D.$$.fragment),k=r(),h($.$$.fragment),U=r(),M=d("p"),M.innerHTML=ae,W=r(),h(S.$$.fragment),G=r(),s=d("div"),h(C.$$.fragment),Z=r(),X=d("p"),X.innerHTML=ce,ee=r(),w=d("p"),w.innerHTML=le,te=r(),u=d("div"),h(y.$$.fragment),oe=r(),L=d("p"),L.textContent=pe,se=r(),m=d("div"),h(P.$$.fragment),ne=r(),I=d("p"),I.textContent=ue,re=r(),f=d("div"),h(T.$$.fragment),ie=r(),E=d("p"),E.textContent=me,R=r(),h(V.$$.fragment),j=r(),N=d("p"),this.h()},l(e){const o=xe("svelte-u9bgzb",document.head);p=a(o,"META",{name:!0,content:!0}),o.forEach(t),A=i(e),z=a(e,"P",{}),F(z).forEach(t),H=i(e),g(D.$$.fragment,e),k=i(e),g($.$$.fragment,e),U=i(e),M=a(e,"P",{"data-svelte-h":!0}),O(M)!=="svelte-1m0njwz"&&(M.innerHTML=ae),W=i(e),g(S.$$.fragment,e),G=i(e),s=a(e,"DIV",{class:!0});var c=F(s);g(C.$$.fragment,c),Z=i(c),X=a(c,"P",{"data-svelte-h":!0}),O(X)!=="svelte-1wae91k"&&(X.innerHTML=ce),ee=i(c),w=a(c,"P",{"data-svelte-h":!0}),O(w)!=="svelte-linuuh"&&(w.innerHTML=le),te=i(c),u=a(c,"DIV",{class:!0});var J=F(u);g(y.$$.fragment,J),oe=i(J),L=a(J,"P",{"data-svelte-h":!0}),O(L)!=="svelte-1rkfgpx"&&(L.textContent=pe),J.forEach(t),se=i(c),m=a(c,"DIV",{class:!0});var K=F(m);g(P.$$.fragment,K),ne=i(K),I=a(K,"P",{"data-svelte-h":!0}),O(I)!=="svelte-1vzm9q"&&(I.textContent=ue),K.forEach(t),re=i(c),f=a(c,"DIV",{class:!0});var Q=F(f);g(T.$$.fragment,Q),ie=i(Q),E=a(Q,"P",{"data-svelte-h":!0}),O(E)!=="svelte-hi84tp"&&(E.textContent=me),Q.forEach(t),c.forEach(t),R=i(e),g(V.$$.fragment,e),j=i(e),N=a(e,"P",{}),F(N).forEach(t),this.h()},h(){q(p,"name","hf:doc:metadata"),q(p,"content",Se),q(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),q(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),q(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),q(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,o){n(document.head,p),l(e,A,o),l(e,z,o),l(e,H,o),_(D,e,o),l(e,k,o),_($,e,o),l(e,U,o),l(e,M,o),l(e,W,o),_(S,e,o),l(e,G,o),l(e,s,o),_(C,s,null),n(s,Z),n(s,X),n(s,ee),n(s,w),n(s,te),n(s,u),_(y,u,null),n(u,oe),n(u,L),n(s,se),n(s,m),_(P,m,null),n(m,ne),n(m,I),n(s,re),n(s,f),_(T,f,null),n(f,ie),n(f,E),l(e,R,o),_(V,e,o),l(e,j,o),l(e,N,o),B=!0},p:ge,i(e){B||(b(D.$$.fragment,e),b($.$$.fragment,e),b(S.$$.fragment,e),b(C.$$.fragment,e),b(y.$$.fragment,e),b(P.$$.fragment,e),b(T.$$.fragment,e),b(V.$$.fragment,e),B=!0)},o(e){v(D.$$.fragment,e),v($.$$.fragment,e),v(S.$$.fragment,e),v(C.$$.fragment,e),v(y.$$.fragment,e),v(P.$$.fragment,e),v(T.$$.fragment,e),v(V.$$.fragment,e),B=!1},d(e){e&&(t(A),t(z),t(H),t(k),t(U),t(M),t(W),t(G),t(s),t(R),t(j),t(N)),t(p),x(D,e),x($,e),x(S,e),x(C),x(y),x(P),x(T),x(V,e)}}}const Se='{"title":"CogVideoXDPMScheduler","local":"cogvideoxdpmscheduler","sections":[{"title":"CogVideoXDPMScheduler","local":"diffusers.CogVideoXDPMScheduler","sections":[],"depth":2}],"depth":1}';function Ce(de){return _e(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class we extends be{constructor(p){super(),ve(this,p,Ce,Me,he,{})}}export{we as component};
