import{s as Ve,n as Xe,o as we}from"../chunks/scheduler.53228c21.js";import{S as Ie,i as Le,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.999d3d86.js";import{D as W}from"../chunks/Docstring.46d0934e.js";import{H as Pe,E as Fe}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.d27ae4df.js";function Oe(be){let _,j,G,B,M,J,S,K,P,xe='<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.',Q,V,Y,s,X,de,O,De=`<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,v,w,le,A,Ce=`Add noise to the original samples according to the noise magnitude at each timestep (this is the forward
diffusion process).`,pe,b,I,ue,N,Te="Compute the velocity prediction from the sample and noise according to the velocity formula.",me,x,L,fe,k,ye=`Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.`,he,D,E,ge,H,Me="Sets the discrete timesteps used for the diffusion chain (to be run before inference).",_e,$,q,ve,U,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).`,Z,F,ee,R,te;return M=new qe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),S=new Pe({props:{title:"CogVideoXDPMScheduler",local:"cogvideoxdpmscheduler",headingTag:"h1"}}),V=new Pe({props:{title:"CogVideoXDPMScheduler",local:"diffusers.CogVideoXDPMScheduler",headingTag:"h2"}}),X=new W({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://huggingface.co/papers/2210.02303" 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#L128"}}),w=new W({props:{name:"add_noise",anchor:"diffusers.CogVideoXDPMScheduler.add_noise",parameters:[{name:"original_samples",val:": Tensor"},{name:"noise",val:": Tensor"},{name:"timesteps",val:": IntTensor"}],parametersDescription:[{anchor:"diffusers.CogVideoXDPMScheduler.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.CogVideoXDPMScheduler.add_noise.noise",description:`<strong>noise</strong> (<code>torch.Tensor</code>) &#x2014;
The noise to add to the samples.`,name:"noise"},{anchor:"diffusers.CogVideoXDPMScheduler.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_dpm_cogvideox.py#L443",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>
`}}),I=new W({props:{name:"get_velocity",anchor:"diffusers.CogVideoXDPMScheduler.get_velocity",parameters:[{name:"sample",val:": Tensor"},{name:"noise",val:": Tensor"},{name:"timesteps",val:": IntTensor"}],parametersDescription:[{anchor:"diffusers.CogVideoXDPMScheduler.get_velocity.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code>) &#x2014;
The input sample.`,name:"sample"},{anchor:"diffusers.CogVideoXDPMScheduler.get_velocity.noise",description:`<strong>noise</strong> (<code>torch.Tensor</code>) &#x2014;
The noise tensor.`,name:"noise"},{anchor:"diffusers.CogVideoXDPMScheduler.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_dpm_cogvideox.py#L486",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>
`}}),L=new W({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#L245",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.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#L262"}}),q=new W({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#L331",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>
`}}),F=new Fe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/schedulers/multistep_dpm_solver_cogvideox.md"}}),{c(){_=d("meta"),j=n(),G=d("p"),B=n(),p(M.$$.fragment),J=n(),p(S.$$.fragment),K=n(),P=d("p"),P.innerHTML=xe,Q=n(),p(V.$$.fragment),Y=n(),s=d("div"),p(X.$$.fragment),de=n(),O=d("p"),O.innerHTML=De,ae=n(),z=d("p"),z.innerHTML=$e,ce=n(),v=d("div"),p(w.$$.fragment),le=n(),A=d("p"),A.textContent=Ce,pe=n(),b=d("div"),p(I.$$.fragment),ue=n(),N=d("p"),N.textContent=Te,me=n(),x=d("div"),p(L.$$.fragment),fe=n(),k=d("p"),k.textContent=ye,he=n(),D=d("div"),p(E.$$.fragment),ge=n(),H=d("p"),H.textContent=Me,_e=n(),$=d("div"),p(q.$$.fragment),ve=n(),U=d("p"),U.textContent=Se,Z=n(),p(F.$$.fragment),ee=n(),R=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),G=a(e,"P",{}),C(G).forEach(o),B=r(e),u(M.$$.fragment,e),J=r(e),u(S.$$.fragment,e),K=r(e),P=a(e,"P",{"data-svelte-h":!0}),T(P)!=="svelte-1m0njwz"&&(P.innerHTML=xe),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=De),ae=r(c),z=a(c,"P",{"data-svelte-h":!0}),T(z)!=="svelte-linuuh"&&(z.innerHTML=$e),ce=r(c),v=a(c,"DIV",{class:!0});var oe=C(v);u(w.$$.fragment,oe),le=r(oe),A=a(oe,"P",{"data-svelte-h":!0}),T(A)!=="svelte-hqmiev"&&(A.textContent=Ce),oe.forEach(o),pe=r(c),b=a(c,"DIV",{class:!0});var se=C(b);u(I.$$.fragment,se),ue=r(se),N=a(se,"P",{"data-svelte-h":!0}),T(N)!=="svelte-1aqw5k3"&&(N.textContent=Te),se.forEach(o),me=r(c),x=a(c,"DIV",{class:!0});var ne=C(x);u(L.$$.fragment,ne),fe=r(ne),k=a(ne,"P",{"data-svelte-h":!0}),T(k)!=="svelte-1rkfgpx"&&(k.textContent=ye),ne.forEach(o),he=r(c),D=a(c,"DIV",{class:!0});var re=C(D);u(E.$$.fragment,re),ge=r(re),H=a(re,"P",{"data-svelte-h":!0}),T(H)!=="svelte-1vzm9q"&&(H.textContent=Me),re.forEach(o),_e=r(c),$=a(c,"DIV",{class:!0});var ie=C($);u(q.$$.fragment,ie),ve=r(ie),U=a(ie,"P",{"data-svelte-h":!0}),T(U)!=="svelte-hi84tp"&&(U.textContent=Se),ie.forEach(o),c.forEach(o),Z=r(e),u(F.$$.fragment,e),ee=r(e),R=a(e,"P",{}),C(R).forEach(o),this.h()},h(){y(_,"name","hf:doc:metadata"),y(_,"content",ze),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(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($,"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,G,i),l(e,B,i),m(M,e,i),l(e,J,i),m(S,e,i),l(e,K,i),l(e,P,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,v),m(w,v,null),t(v,le),t(v,A),t(s,pe),t(s,b),m(I,b,null),t(b,ue),t(b,N),t(s,me),t(s,x),m(L,x,null),t(x,fe),t(x,k),t(s,he),t(s,D),m(E,D,null),t(D,ge),t(D,H),t(s,_e),t(s,$),m(q,$,null),t($,ve),t($,U),l(e,Z,i),m(F,e,i),l(e,ee,i),l(e,R,i),te=!0},p:Xe,i(e){te||(f(M.$$.fragment,e),f(S.$$.fragment,e),f(V.$$.fragment,e),f(X.$$.fragment,e),f(w.$$.fragment,e),f(I.$$.fragment,e),f(L.$$.fragment,e),f(E.$$.fragment,e),f(q.$$.fragment,e),f(F.$$.fragment,e),te=!0)},o(e){h(M.$$.fragment,e),h(S.$$.fragment,e),h(V.$$.fragment,e),h(X.$$.fragment,e),h(w.$$.fragment,e),h(I.$$.fragment,e),h(L.$$.fragment,e),h(E.$$.fragment,e),h(q.$$.fragment,e),h(F.$$.fragment,e),te=!1},d(e){e&&(o(j),o(G),o(B),o(J),o(K),o(P),o(Q),o(Y),o(s),o(Z),o(ee),o(R)),o(_),g(M,e),g(S,e),g(V,e),g(X),g(w),g(I),g(L),g(E),g(q),g(F,e)}}}const ze='{"title":"CogVideoXDPMScheduler","local":"cogvideoxdpmscheduler","sections":[{"title":"CogVideoXDPMScheduler","local":"diffusers.CogVideoXDPMScheduler","sections":[],"depth":2}],"depth":1}';function Ae(be){return we(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ge extends Ie{constructor(_){super(),Le(this,_,Ae,Oe,Ve,{})}}export{Ge as component};
