Buckets:
| import{s as ye,n as De,o as Ve}from"../chunks/scheduler.53228c21.js";import{S as we,i as Xe,e as i,s as n,c,h as qe,a as d,d as o,b as s,f as R,g as p,j as x,k as $,l as a,m as r,n as u,t as _,o as g,p as h}from"../chunks/index.100fac89.js";import{C as He}from"../chunks/CopyLLMTxtMenu.67e413d2.js";import{D as ae}from"../chunks/Docstring.60584164.js";import{C as Ue}from"../chunks/CodeBlock.d30a6509.js";import{H as _e,E as je}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.debde53c.js";function ke(ge){let b,S,W,G,M,A,C,Q,y,he='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 & ZhipuAI.',K,D,be="The model can be loaded with the following code snippet.",Y,V,F,w,B,l,X,ie,E,Te='A Transformer model for video-like data in <a href="https://github.com/THUDM/CogVideo" rel="nofollow">CogVideoX</a>.',de,m,q,le,z,ve=`Enables fused QKV projections. For self-attention modules, all projection matrices (i.e., query, key, value) | |
| are fused. For cross-attention modules, key and value projection matrices are fused.`,me,H,xe="<p>> This API is 🧪 experimental.</p>",fe,f,U,ce,I,$e="Disables the fused QKV projection if enabled.",pe,j,Me="<p>> This API is 🧪 experimental.</p>",ee,k,te,T,L,ue,J,Ce='The output of <a href="/docs/diffusers/pr_13331/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',oe,Z,ne,N,se;return M=new He({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),C=new _e({props:{title:"CogVideoXTransformer3DModel",local:"cogvideoxtransformer3dmodel",headingTag:"h1"}}),V=new Ue({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMENvZ1ZpZGVvWFRyYW5zZm9ybWVyM0RNb2RlbCUwQSUwQXRyYW5zZm9ybWVyJTIwJTNEJTIwQ29nVmlkZW9YVHJhbnNmb3JtZXIzRE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJUSFVETSUyRkNvZ1ZpZGVvWC0yYiUyMiUyQyUyMHN1YmZvbGRlciUzRCUyMnRyYW5zZm9ybWVyJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KS50byglMjJjdWRhJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> CogVideoXTransformer3DModel | |
| transformer = CogVideoXTransformer3DModel.from_pretrained(<span class="hljs-string">"THUDM/CogVideoX-2b"</span>, subfolder=<span class="hljs-string">"transformer"</span>, torch_dtype=torch.float16).to(<span class="hljs-string">"cuda"</span>)`,wrap:!1}}),w=new _e({props:{title:"CogVideoXTransformer3DModel",local:"diffusers.CogVideoXTransformer3DModel",headingTag:"h2"}}),X=new ae({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:": int = 16"},{name:"out_channels",val:": int | None = 16"},{name:"flip_sin_to_cos",val:": bool = True"},{name:"freq_shift",val:": int = 0"},{name:"time_embed_dim",val:": int = 512"},{name:"ofs_embed_dim",val:": int | None = None"},{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:"patch_size_t",val:": int | None = None"},{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"},{name:"use_rotary_positional_embeddings",val:": bool = False"},{name:"use_learned_positional_embeddings",val:": bool = False"},{name:"patch_bias",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.CogVideoXTransformer3DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>30</code>) — | |
| 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>, defaults to <code>64</code>) — | |
| The number of channels in each head.`,name:"attention_head_dim"},{anchor:"diffusers.CogVideoXTransformer3DModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, defaults to <code>16</code>) — | |
| 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>, defaults to <code>16</code>) — | |
| The number of channels in the output.`,name:"out_channels"},{anchor:"diffusers.CogVideoXTransformer3DModel.flip_sin_to_cos",description:`<strong>flip_sin_to_cos</strong> (<code>bool</code>, defaults to <code>True</code>) — | |
| Whether to flip the sin to cos in the time embedding.`,name:"flip_sin_to_cos"},{anchor:"diffusers.CogVideoXTransformer3DModel.time_embed_dim",description:`<strong>time_embed_dim</strong> (<code>int</code>, defaults to <code>512</code>) — | |
| Output dimension of timestep embeddings.`,name:"time_embed_dim"},{anchor:"diffusers.CogVideoXTransformer3DModel.ofs_embed_dim",description:`<strong>ofs_embed_dim</strong> (<code>int</code>, defaults to <code>512</code>) — | |
| Output dimension of “ofs” embeddings used in CogVideoX-5b-I2B in version 1.5`,name:"ofs_embed_dim"},{anchor:"diffusers.CogVideoXTransformer3DModel.text_embed_dim",description:`<strong>text_embed_dim</strong> (<code>int</code>, defaults to <code>4096</code>) — | |
| Input dimension of text embeddings from the text encoder.`,name:"text_embed_dim"},{anchor:"diffusers.CogVideoXTransformer3DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to <code>30</code>) — | |
| The number of layers of Transformer blocks to use.`,name:"num_layers"},{anchor:"diffusers.CogVideoXTransformer3DModel.dropout",description:`<strong>dropout</strong> (<code>float</code>, defaults to <code>0.0</code>) — | |
| The dropout probability to use.`,name:"dropout"},{anchor:"diffusers.CogVideoXTransformer3DModel.attention_bias",description:`<strong>attention_bias</strong> (<code>bool</code>, defaults to <code>True</code>) — | |
| Whether to use bias in the attention projection layers.`,name:"attention_bias"},{anchor:"diffusers.CogVideoXTransformer3DModel.sample_width",description:`<strong>sample_width</strong> (<code>int</code>, defaults to <code>90</code>) — | |
| The width of the input latents.`,name:"sample_width"},{anchor:"diffusers.CogVideoXTransformer3DModel.sample_height",description:`<strong>sample_height</strong> (<code>int</code>, defaults to <code>60</code>) — | |
| The height of the input latents.`,name:"sample_height"},{anchor:"diffusers.CogVideoXTransformer3DModel.sample_frames",description:`<strong>sample_frames</strong> (<code>int</code>, defaults to <code>49</code>) — | |
| The number of frames in the input latents. Note that this parameter was incorrectly initialized to 49 | |
| instead of 13 because CogVideoX processed 13 latent frames at once in its default and recommended settings, | |
| but cannot be changed to the correct value to ensure backwards compatibility. To create a transformer with | |
| K latent frames, the correct value to pass here would be: ((K - 1) * temporal_compression_ratio + 1).`,name:"sample_frames"},{anchor:"diffusers.CogVideoXTransformer3DModel.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, defaults to <code>2</code>) — | |
| The size of the patches to use in the patch embedding layer.`,name:"patch_size"},{anchor:"diffusers.CogVideoXTransformer3DModel.temporal_compression_ratio",description:`<strong>temporal_compression_ratio</strong> (<code>int</code>, defaults to <code>4</code>) — | |
| The compression ratio across the temporal dimension. See documentation for <code>sample_frames</code>.`,name:"temporal_compression_ratio"},{anchor:"diffusers.CogVideoXTransformer3DModel.max_text_seq_length",description:`<strong>max_text_seq_length</strong> (<code>int</code>, defaults to <code>226</code>) — | |
| The maximum sequence length of the input text embeddings.`,name:"max_text_seq_length"},{anchor:"diffusers.CogVideoXTransformer3DModel.activation_fn",description:`<strong>activation_fn</strong> (<code>str</code>, defaults to <code>"gelu-approximate"</code>) — | |
| Activation function to use in feed-forward.`,name:"activation_fn"},{anchor:"diffusers.CogVideoXTransformer3DModel.timestep_activation_fn",description:`<strong>timestep_activation_fn</strong> (<code>str</code>, defaults to <code>"silu"</code>) — | |
| Activation function to use when generating the timestep embeddings.`,name:"timestep_activation_fn"},{anchor:"diffusers.CogVideoXTransformer3DModel.norm_elementwise_affine",description:`<strong>norm_elementwise_affine</strong> (<code>bool</code>, defaults to <code>True</code>) — | |
| Whether to use elementwise affine in normalization layers.`,name:"norm_elementwise_affine"},{anchor:"diffusers.CogVideoXTransformer3DModel.norm_eps",description:`<strong>norm_eps</strong> (<code>float</code>, defaults to <code>1e-5</code>) — | |
| The epsilon value to use in normalization layers.`,name:"norm_eps"},{anchor:"diffusers.CogVideoXTransformer3DModel.spatial_interpolation_scale",description:`<strong>spatial_interpolation_scale</strong> (<code>float</code>, defaults to <code>1.875</code>) — | |
| Scaling factor to apply in 3D positional embeddings across spatial dimensions.`,name:"spatial_interpolation_scale"},{anchor:"diffusers.CogVideoXTransformer3DModel.temporal_interpolation_scale",description:`<strong>temporal_interpolation_scale</strong> (<code>float</code>, defaults to <code>1.0</code>) — | |
| Scaling factor to apply in 3D positional embeddings across temporal dimensions.`,name:"temporal_interpolation_scale"}],source:"https://github.com/huggingface/diffusers/blob/vr_13331/src/diffusers/models/transformers/cogvideox_transformer_3d.py#L160"}}),q=new ae({props:{name:"fuse_qkv_projections",anchor:"diffusers.CogVideoXTransformer3DModel.fuse_qkv_projections",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_13331/src/diffusers/models/transformers/cogvideox_transformer_3d.py#L335"}}),U=new ae({props:{name:"unfuse_qkv_projections",anchor:"diffusers.CogVideoXTransformer3DModel.unfuse_qkv_projections",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_13331/src/diffusers/models/transformers/cogvideox_transformer_3d.py#L357"}}),k=new _e({props:{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"}}),L=new ae({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/pr_13331/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a> is discrete) — | |
| 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/vr_13331/src/diffusers/models/modeling_outputs.py#L21"}}),Z=new je({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/cogvideox_transformer3d.md"}}),{c(){b=i("meta"),S=n(),W=i("p"),G=n(),c(M.$$.fragment),A=n(),c(C.$$.fragment),Q=n(),y=i("p"),y.innerHTML=he,K=n(),D=i("p"),D.textContent=be,Y=n(),c(V.$$.fragment),F=n(),c(w.$$.fragment),B=n(),l=i("div"),c(X.$$.fragment),ie=n(),E=i("p"),E.innerHTML=Te,de=n(),m=i("div"),c(q.$$.fragment),le=n(),z=i("p"),z.textContent=ve,me=n(),H=i("blockquote"),H.innerHTML=xe,fe=n(),f=i("div"),c(U.$$.fragment),ce=n(),I=i("p"),I.textContent=$e,pe=n(),j=i("blockquote"),j.innerHTML=Me,ee=n(),c(k.$$.fragment),te=n(),T=i("div"),c(L.$$.fragment),ue=n(),J=i("p"),J.innerHTML=Ce,oe=n(),c(Z.$$.fragment),ne=n(),N=i("p"),this.h()},l(e){const t=qe("svelte-u9bgzb",document.head);b=d(t,"META",{name:!0,content:!0}),t.forEach(o),S=s(e),W=d(e,"P",{}),R(W).forEach(o),G=s(e),p(M.$$.fragment,e),A=s(e),p(C.$$.fragment,e),Q=s(e),y=d(e,"P",{"data-svelte-h":!0}),x(y)!=="svelte-2g99jo"&&(y.innerHTML=he),K=s(e),D=d(e,"P",{"data-svelte-h":!0}),x(D)!=="svelte-1vuni30"&&(D.textContent=be),Y=s(e),p(V.$$.fragment,e),F=s(e),p(w.$$.fragment,e),B=s(e),l=d(e,"DIV",{class:!0});var v=R(l);p(X.$$.fragment,v),ie=s(v),E=d(v,"P",{"data-svelte-h":!0}),x(E)!=="svelte-98fbmm"&&(E.innerHTML=Te),de=s(v),m=d(v,"DIV",{class:!0});var O=R(m);p(q.$$.fragment,O),le=s(O),z=d(O,"P",{"data-svelte-h":!0}),x(z)!=="svelte-1254b9i"&&(z.textContent=ve),me=s(O),H=d(O,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),x(H)!=="svelte-6y4o4y"&&(H.innerHTML=xe),O.forEach(o),fe=s(v),f=d(v,"DIV",{class:!0});var P=R(f);p(U.$$.fragment,P),ce=s(P),I=d(P,"P",{"data-svelte-h":!0}),x(I)!=="svelte-1vhtc74"&&(I.textContent=$e),pe=s(P),j=d(P,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),x(j)!=="svelte-6y4o4y"&&(j.innerHTML=Me),P.forEach(o),v.forEach(o),ee=s(e),p(k.$$.fragment,e),te=s(e),T=d(e,"DIV",{class:!0});var re=R(T);p(L.$$.fragment,re),ue=s(re),J=d(re,"P",{"data-svelte-h":!0}),x(J)!=="svelte-1460eox"&&(J.innerHTML=Ce),re.forEach(o),oe=s(e),p(Z.$$.fragment,e),ne=s(e),N=d(e,"P",{}),R(N).forEach(o),this.h()},h(){$(b,"name","hf:doc:metadata"),$(b,"content",Le),$(H,"class","warning"),$(m,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(j,"class","warning"),$(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(l,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(T,"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,t){a(document.head,b),r(e,S,t),r(e,W,t),r(e,G,t),u(M,e,t),r(e,A,t),u(C,e,t),r(e,Q,t),r(e,y,t),r(e,K,t),r(e,D,t),r(e,Y,t),u(V,e,t),r(e,F,t),u(w,e,t),r(e,B,t),r(e,l,t),u(X,l,null),a(l,ie),a(l,E),a(l,de),a(l,m),u(q,m,null),a(m,le),a(m,z),a(m,me),a(m,H),a(l,fe),a(l,f),u(U,f,null),a(f,ce),a(f,I),a(f,pe),a(f,j),r(e,ee,t),u(k,e,t),r(e,te,t),r(e,T,t),u(L,T,null),a(T,ue),a(T,J),r(e,oe,t),u(Z,e,t),r(e,ne,t),r(e,N,t),se=!0},p:De,i(e){se||(_(M.$$.fragment,e),_(C.$$.fragment,e),_(V.$$.fragment,e),_(w.$$.fragment,e),_(X.$$.fragment,e),_(q.$$.fragment,e),_(U.$$.fragment,e),_(k.$$.fragment,e),_(L.$$.fragment,e),_(Z.$$.fragment,e),se=!0)},o(e){g(M.$$.fragment,e),g(C.$$.fragment,e),g(V.$$.fragment,e),g(w.$$.fragment,e),g(X.$$.fragment,e),g(q.$$.fragment,e),g(U.$$.fragment,e),g(k.$$.fragment,e),g(L.$$.fragment,e),g(Z.$$.fragment,e),se=!1},d(e){e&&(o(S),o(W),o(G),o(A),o(Q),o(y),o(K),o(D),o(Y),o(F),o(B),o(l),o(ee),o(te),o(T),o(oe),o(ne),o(N)),o(b),h(M,e),h(C,e),h(V,e),h(w,e),h(X),h(q),h(U),h(k,e),h(L),h(Z,e)}}}const Le='{"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 Ze(ge){return Ve(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Re extends we{constructor(b){super(),Xe(this,b,Ze,ke,ye,{})}}export{Re as component}; | |
Xet Storage Details
- Size:
- 16.2 kB
- Xet hash:
- 3401738901a06efebdb2cbbae7ad49c760c3dd910d540feb9a101ed33ed9a8db
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.