import{s as ne,n as re,o as se}from"../chunks/scheduler.8c3d61f6.js";import{S as ae,i as ie,g as m,s as r,r as v,A as de,h as l,f as t,c as s,j as G,u as M,x as N,k as S,y as Z,a as n,v as y,d as $,t as D,w as C}from"../chunks/index.da70eac4.js";import{D as te}from"../chunks/Docstring.ee4b6913.js";import{C as me}from"../chunks/CodeBlock.00a903b3.js";import{H as Q,E as le}from"../chunks/EditOnGithub.1e64e623.js";function fe(B){let a,z,X,U,f,q,c,F='A Diffusion Transformer model for 3D data from <a href="https://github.com/THUDM/CogVideo" rel="nofollow">CogVideoX</a> was introduced in <a href="https://github.com/THUDM/CogVideo/blob/main/resources/CogVideoX.pdf" rel="nofollow">CogVideoX: Text-to-Video Diffusion Models with An Expert Transformer</a> by Tsinghua University &amp; ZhipuAI.',k,u,K="The model can be loaded with the following code snippet.",E,p,R,h,H,i,g,Y,x,ee='A Transformer model for video-like data in <a href="https://github.com/THUDM/CogVideo" rel="nofollow">CogVideoX</a>.',W,_,O,d,T,J,V,oe='The output of <a href="/docs/diffusers/v0.30.0/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',P,b,j,w,L;return f=new Q({props:{title:"CogVideoXTransformer3DModel",local:"cogvideoxtransformer3dmodel",headingTag:"h1"}}),p=new me({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMENvZ1ZpZGVvWFRyYW5zZm9ybWVyM0RNb2RlbCUwQSUwQXZhZSUyMCUzRCUyMENvZ1ZpZGVvWFRyYW5zZm9ybWVyM0RNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyVEhVRE0lMkZDb2dWaWRlb1gtMmIlMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJ0cmFuc2Zvcm1lciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> CogVideoXTransformer3DModel

vae = CogVideoXTransformer3DModel.from_pretrained(<span class="hljs-string">&quot;THUDM/CogVideoX-2b&quot;</span>, subfolder=<span class="hljs-string">&quot;transformer&quot;</span>, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),h=new Q({props:{title:"CogVideoXTransformer3DModel",local:"diffusers.CogVideoXTransformer3DModel",headingTag:"h2"}}),g=new te({props:{name:"class diffusers.CogVideoXTransformer3DModel",anchor:"diffusers.CogVideoXTransformer3DModel",parameters:[{name:"num_attention_heads",val:": int = 30"},{name:"attention_head_dim",val:": int = 64"},{name:"in_channels",val:": Optional = 16"},{name:"out_channels",val:": Optional = 16"},{name:"flip_sin_to_cos",val:": bool = True"},{name:"freq_shift",val:": int = 0"},{name:"time_embed_dim",val:": int = 512"},{name:"text_embed_dim",val:": int = 4096"},{name:"num_layers",val:": int = 30"},{name:"dropout",val:": float = 0.0"},{name:"attention_bias",val:": bool = True"},{name:"sample_width",val:": int = 90"},{name:"sample_height",val:": int = 60"},{name:"sample_frames",val:": int = 49"},{name:"patch_size",val:": int = 2"},{name:"temporal_compression_ratio",val:": int = 4"},{name:"max_text_seq_length",val:": int = 226"},{name:"activation_fn",val:": str = 'gelu-approximate'"},{name:"timestep_activation_fn",val:": str = 'silu'"},{name:"norm_elementwise_affine",val:": bool = True"},{name:"norm_eps",val:": float = 1e-05"},{name:"spatial_interpolation_scale",val:": float = 1.875"},{name:"temporal_interpolation_scale",val:": float = 1.0"}],parametersDescription:[{anchor:"diffusers.CogVideoXTransformer3DModel.num_attention_heads",description:"<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014; The number of heads to use for multi-head attention.",name:"num_attention_heads"},{anchor:"diffusers.CogVideoXTransformer3DModel.attention_head_dim",description:"<strong>attention_head_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 88) &#x2014; The number of channels in each head.",name:"attention_head_dim"},{anchor:"diffusers.CogVideoXTransformer3DModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of channels in the input.`,name:"in_channels"},{anchor:"diffusers.CogVideoXTransformer3DModel.out_channels",description:`<strong>out_channels</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of channels in the output.`,name:"out_channels"},{anchor:"diffusers.CogVideoXTransformer3DModel.num_layers",description:"<strong>num_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014; The number of layers of Transformer blocks to use.",name:"num_layers"},{anchor:"diffusers.CogVideoXTransformer3DModel.dropout",description:"<strong>dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014; The dropout probability to use.",name:"dropout"},{anchor:"diffusers.CogVideoXTransformer3DModel.cross_attention_dim",description:"<strong>cross_attention_dim</strong> (<code>int</code>, <em>optional</em>) &#x2014; The number of <code>encoder_hidden_states</code> dimensions to use.",name:"cross_attention_dim"},{anchor:"diffusers.CogVideoXTransformer3DModel.attention_bias",description:`<strong>attention_bias</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Configure if the <code>TransformerBlocks</code> attention should contain a bias parameter.`,name:"attention_bias"},{anchor:"diffusers.CogVideoXTransformer3DModel.sample_size",description:`<strong>sample_size</strong> (<code>int</code>, <em>optional</em>) &#x2014; The width of the latent images (specify if the input is <strong>discrete</strong>).
This is fixed during training since it is used to learn a number of position embeddings.`,name:"sample_size"},{anchor:"diffusers.CogVideoXTransformer3DModel.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The size of the patches to use in the patch embedding layer.`,name:"patch_size"},{anchor:"diffusers.CogVideoXTransformer3DModel.activation_fn",description:"<strong>activation_fn</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;geglu&quot;</code>) &#x2014; Activation function to use in feed-forward.",name:"activation_fn"},{anchor:"diffusers.CogVideoXTransformer3DModel.num_embeds_ada_norm",description:`<strong>num_embeds_ada_norm</strong> ( <code>int</code>, <em>optional</em>) &#x2014;
The number of diffusion steps used during training. Pass if at least one of the norm_layers is
<code>AdaLayerNorm</code>. This is fixed during training since it is used to learn a number of embeddings that are
added to the hidden states. During inference, you can denoise for up to but not more steps than
<code>num_embeds_ada_norm</code>.`,name:"num_embeds_ada_norm"},{anchor:"diffusers.CogVideoXTransformer3DModel.norm_type",description:`<strong>norm_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;layer_norm&quot;</code>) &#x2014;
The type of normalization to use. Options are <code>&quot;layer_norm&quot;</code> or <code>&quot;ada_layer_norm&quot;</code>.`,name:"norm_type"},{anchor:"diffusers.CogVideoXTransformer3DModel.norm_elementwise_affine",description:`<strong>norm_elementwise_affine</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to use elementwise affine in normalization layers.`,name:"norm_elementwise_affine"},{anchor:"diffusers.CogVideoXTransformer3DModel.norm_eps",description:"<strong>norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014; The epsilon value to use in normalization layers.",name:"norm_eps"},{anchor:"diffusers.CogVideoXTransformer3DModel.caption_channels",description:`<strong>caption_channels</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of channels in the caption embeddings.`,name:"caption_channels"},{anchor:"diffusers.CogVideoXTransformer3DModel.video_length",description:`<strong>video_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The number of frames in the video-like data.`,name:"video_length"}],source:"https://github.com/huggingface/diffusers/blob/v0.30.0/src/diffusers/models/transformers/cogvideox_transformer_3d.py#L145"}}),_=new Q({props:{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"}}),T=new te({props:{name:"class diffusers.models.modeling_outputs.Transformer2DModelOutput",anchor:"diffusers.models.modeling_outputs.Transformer2DModelOutput",parameters:[{name:"sample",val:": torch.Tensor"}],parametersDescription:[{anchor:"diffusers.models.modeling_outputs.Transformer2DModelOutput.sample",description:`<strong>sample</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code> or <code>(batch size, num_vector_embeds - 1, num_latent_pixels)</code> if <a href="/docs/diffusers/v0.30.0/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a> is discrete) &#x2014;
The hidden states output conditioned on the <code>encoder_hidden_states</code> input. If discrete, returns probability
distributions for the unnoised latent pixels.`,name:"sample"}],source:"https://github.com/huggingface/diffusers/blob/v0.30.0/src/diffusers/models/modeling_outputs.py#L20"}}),b=new le({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/cogvideox_transformer3d.md"}}),{c(){a=m("meta"),z=r(),X=m("p"),U=r(),v(f.$$.fragment),q=r(),c=m("p"),c.innerHTML=F,k=r(),u=m("p"),u.textContent=K,E=r(),v(p.$$.fragment),R=r(),v(h.$$.fragment),H=r(),i=m("div"),v(g.$$.fragment),Y=r(),x=m("p"),x.innerHTML=ee,W=r(),v(_.$$.fragment),O=r(),d=m("div"),v(T.$$.fragment),J=r(),V=m("p"),V.innerHTML=oe,P=r(),v(b.$$.fragment),j=r(),w=m("p"),this.h()},l(e){const o=de("svelte-u9bgzb",document.head);a=l(o,"META",{name:!0,content:!0}),o.forEach(t),z=s(e),X=l(e,"P",{}),G(X).forEach(t),U=s(e),M(f.$$.fragment,e),q=s(e),c=l(e,"P",{"data-svelte-h":!0}),N(c)!=="svelte-2g99jo"&&(c.innerHTML=F),k=s(e),u=l(e,"P",{"data-svelte-h":!0}),N(u)!=="svelte-1vuni30"&&(u.textContent=K),E=s(e),M(p.$$.fragment,e),R=s(e),M(h.$$.fragment,e),H=s(e),i=l(e,"DIV",{class:!0});var I=G(i);M(g.$$.fragment,I),Y=s(I),x=l(I,"P",{"data-svelte-h":!0}),N(x)!=="svelte-98fbmm"&&(x.innerHTML=ee),I.forEach(t),W=s(e),M(_.$$.fragment,e),O=s(e),d=l(e,"DIV",{class:!0});var A=G(d);M(T.$$.fragment,A),J=s(A),V=l(A,"P",{"data-svelte-h":!0}),N(V)!=="svelte-18kg9ry"&&(V.innerHTML=oe),A.forEach(t),P=s(e),M(b.$$.fragment,e),j=s(e),w=l(e,"P",{}),G(w).forEach(t),this.h()},h(){S(a,"name","hf:doc:metadata"),S(a,"content",ce),S(i,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(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(e,o){Z(document.head,a),n(e,z,o),n(e,X,o),n(e,U,o),y(f,e,o),n(e,q,o),n(e,c,o),n(e,k,o),n(e,u,o),n(e,E,o),y(p,e,o),n(e,R,o),y(h,e,o),n(e,H,o),n(e,i,o),y(g,i,null),Z(i,Y),Z(i,x),n(e,W,o),y(_,e,o),n(e,O,o),n(e,d,o),y(T,d,null),Z(d,J),Z(d,V),n(e,P,o),y(b,e,o),n(e,j,o),n(e,w,o),L=!0},p:re,i(e){L||($(f.$$.fragment,e),$(p.$$.fragment,e),$(h.$$.fragment,e),$(g.$$.fragment,e),$(_.$$.fragment,e),$(T.$$.fragment,e),$(b.$$.fragment,e),L=!0)},o(e){D(f.$$.fragment,e),D(p.$$.fragment,e),D(h.$$.fragment,e),D(g.$$.fragment,e),D(_.$$.fragment,e),D(T.$$.fragment,e),D(b.$$.fragment,e),L=!1},d(e){e&&(t(z),t(X),t(U),t(q),t(c),t(k),t(u),t(E),t(R),t(H),t(i),t(W),t(O),t(d),t(P),t(j),t(w)),t(a),C(f,e),C(p,e),C(h,e),C(g),C(_,e),C(T),C(b,e)}}}const ce='{"title":"CogVideoXTransformer3DModel","local":"cogvideoxtransformer3dmodel","sections":[{"title":"CogVideoXTransformer3DModel","local":"diffusers.CogVideoXTransformer3DModel","sections":[],"depth":2},{"title":"Transformer2DModelOutput","local":"diffusers.models.modeling_outputs.Transformer2DModelOutput","sections":[],"depth":2}],"depth":1}';function ue(B){return se(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class be extends ae{constructor(a){super(),ie(this,a,ue,fe,ne,{})}}export{be as component};
