Buckets:

HuggingFaceDocBuilder's picture
download
raw
12 kB
import"../chunks/DsnmJJEf.js";import{i as V,h as w,C as k,H as t,a as z,D as n,E as Z,s as O}from"../chunks/BtE7mKSK.js";import{p as E,o as J,s as e,f as L,a as M,b as U,c as s,d as T,n as d,r as a}from"../chunks/jDjavuwI.js";const q='{"title":"MotifVideoTransformer3DModel","local":"motifvideotransformer3dmodel","sections":[{"title":"MotifVideoTransformer3DModel","local":"diffusers.MotifVideoTransformer3DModel","sections":[],"depth":2},{"title":"Transformer2DModelOutput","local":"diffusers.models.modeling_outputs.Transformer2DModelOutput","sections":[],"depth":2}],"depth":1}';var G=T('<meta name="hf:doc:metadata"/>'),I=T('<p></p> <!> <!> <p>A Diffusion Transformer model for 3D video-like data was introduced in Motif-Video by the Motif Technologies Team.</p> <p>The model uses a three-stage architecture with 12 dual-stream + 16 single-stream + 8 DDT decoder layers and rotary positional embeddings (RoPE) for video generation.</p> <p>The model can be loaded with the following code snippet.</p> <!> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>A Transformer model for video-like data used in the Motif-Video model.</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Forward pass of the MotifVideoTransformer3DModel.</p></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The output of <a href="/docs/diffusers/pr_13966/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.</p></div> <!> <p></p>',1);function F(b,v){E(v,!1),J(()=>{new URLSearchParams(window.location.search).get("fw")}),V();var i=I();w("4to1rs",_=>{var g=G();O(g,"content",q),M(_,g)});var m=e(L(i),2);k(m,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var c=e(m,2);t(c,{title:"MotifVideoTransformer3DModel",local:"motifvideotransformer3dmodel",headingTag:"h1"});var l=e(c,8);z(l,{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyME1vdGlmVmlkZW9UcmFuc2Zvcm1lcjNETW9kZWwlMEElMEF0cmFuc2Zvcm1lciUyMCUzRCUyME1vdGlmVmlkZW9UcmFuc2Zvcm1lcjNETW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMk1vdGlmLVRlY2hub2xvZ2llcyUyRk1vdGlmLVZpZGVvLTJCJTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIydHJhbnNmb3JtZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2KQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> MotifVideoTransformer3DModel
transformer = MotifVideoTransformer3DModel.from_pretrained(<span class="hljs-string">&quot;Motif-Technologies/Motif-Video-2B&quot;</span>, subfolder=<span class="hljs-string">&quot;transformer&quot;</span>, torch_dtype=torch.bfloat16)`,lang:"python",wrap:!1});var f=e(l,2);t(f,{title:"MotifVideoTransformer3DModel",local:"diffusers.MotifVideoTransformer3DModel",headingTag:"h2"});var o=e(f,2),u=s(o);n(u,{name:"class diffusers.MotifVideoTransformer3DModel",anchor:"diffusers.MotifVideoTransformer3DModel",source:"https://github.com/huggingface/diffusers/blob/vr_13966/src/diffusers/models/transformers/transformer_motif_video.py#L730",parameters:[{name:"in_channels",val:": int = 33"},{name:"out_channels",val:": int = 16"},{name:"num_attention_heads",val:": int = 24"},{name:"attention_head_dim",val:": int = 128"},{name:"num_layers",val:": int = 20"},{name:"num_single_layers",val:": int = 40"},{name:"num_decoder_layers",val:": int = 0"},{name:"mlp_ratio",val:": float = 4.0"},{name:"patch_size",val:": int = 2"},{name:"patch_size_t",val:": int = 1"},{name:"qk_norm",val:": str = 'rms_norm'"},{name:"norm_type",val:": str = 'layer_norm'"},{name:"text_embed_dim",val:": int = 4096"},{name:"image_embed_dim",val:": int | None = None"},{name:"rope_theta",val:": float = 256.0"},{name:"rope_axes_dim",val:": typing.Tuple[int, ...] = (16, 56, 56)"},{name:"enable_text_cross_attention_dual",val:": bool = False"},{name:"enable_text_cross_attention_single",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.MotifVideoTransformer3DModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, defaults to <code>33</code>) &#x2014;
The number of channels in the input.`,name:"in_channels"},{anchor:"diffusers.MotifVideoTransformer3DModel.out_channels",description:`<strong>out_channels</strong> (<code>int</code>, defaults to <code>16</code>) &#x2014;
The number of channels in the output.`,name:"out_channels"},{anchor:"diffusers.MotifVideoTransformer3DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>24</code>) &#x2014;
The number of heads to use for multi-head attention.`,name:"num_attention_heads"},{anchor:"diffusers.MotifVideoTransformer3DModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code>, defaults to <code>128</code>) &#x2014;
The number of channels in each head.`,name:"attention_head_dim"},{anchor:"diffusers.MotifVideoTransformer3DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to <code>20</code>) &#x2014;
The number of layers of dual-stream blocks to use.`,name:"num_layers"},{anchor:"diffusers.MotifVideoTransformer3DModel.num_single_layers",description:`<strong>num_single_layers</strong> (<code>int</code>, defaults to <code>40</code>) &#x2014;
The number of layers of single-stream blocks to use.`,name:"num_single_layers"},{anchor:"diffusers.MotifVideoTransformer3DModel.num_decoder_layers",description:`<strong>num_decoder_layers</strong> (<code>int</code>, defaults to <code>0</code>) &#x2014;
The number of decoder layers in single-stream blocks.`,name:"num_decoder_layers"},{anchor:"diffusers.MotifVideoTransformer3DModel.mlp_ratio",description:`<strong>mlp_ratio</strong> (<code>float</code>, defaults to <code>4.0</code>) &#x2014;
The ratio of the hidden layer size to the input size in the feedforward network.`,name:"mlp_ratio"},{anchor:"diffusers.MotifVideoTransformer3DModel.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, defaults to <code>2</code>) &#x2014;
The size of the spatial patches to use in the patch embedding layer.`,name:"patch_size"},{anchor:"diffusers.MotifVideoTransformer3DModel.patch_size_t",description:`<strong>patch_size_t</strong> (<code>int</code>, defaults to <code>1</code>) &#x2014;
The size of the temporal patches to use in the patch embedding layer.`,name:"patch_size_t"},{anchor:"diffusers.MotifVideoTransformer3DModel.qk_norm",description:`<strong>qk_norm</strong> (<code>str</code>, defaults to <code>rms_norm</code>) &#x2014;
The normalization to use for the query and key projections in the attention layers.`,name:"qk_norm"},{anchor:"diffusers.MotifVideoTransformer3DModel.text_embed_dim",description:`<strong>text_embed_dim</strong> (<code>int</code>, defaults to <code>4096</code>) &#x2014;
Input dimension of text embeddings from the text encoder.`,name:"text_embed_dim"},{anchor:"diffusers.MotifVideoTransformer3DModel.image_embed_dim",description:`<strong>image_embed_dim</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Input dimension of image embeddings from a vision encoder. If provided, enables image conditioning.`,name:"image_embed_dim"},{anchor:"diffusers.MotifVideoTransformer3DModel.rope_theta",description:`<strong>rope_theta</strong> (<code>float</code>, defaults to <code>256.0</code>) &#x2014;
The value of theta to use in the RoPE layer.`,name:"rope_theta"},{anchor:"diffusers.MotifVideoTransformer3DModel.rope_axes_dim",description:`<strong>rope_axes_dim</strong> (<code>Tuple[int]</code>, defaults to <code>(16, 56, 56)</code>) &#x2014;
The dimensions of the axes to use in the RoPE layer.`,name:"rope_axes_dim"}]});var p=e(u,4),y=s(p);n(y,{name:"forward",anchor:"diffusers.MotifVideoTransformer3DModel.forward",source:"https://github.com/huggingface/diffusers/blob/vr_13966/src/diffusers/models/transformers/transformer_motif_video.py#L888",parameters:[{name:"hidden_states",val:": Tensor"},{name:"timestep",val:": LongTensor"},{name:"encoder_hidden_states",val:": Tensor"},{name:"encoder_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"image_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_kwargs",val:": typing.Optional[typing.Dict[str, typing.Any]] = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.MotifVideoTransformer3DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code>) &#x2014;
Input latent tensor of shape <code>(batch_size, channels, num_frames, height, width)</code>.`,name:"hidden_states"},{anchor:"diffusers.MotifVideoTransformer3DModel.forward.timestep",description:`<strong>timestep</strong> (<code>torch.LongTensor</code>) &#x2014;
Diffusion timesteps of shape <code>(batch_size,)</code>.`,name:"timestep"},{anchor:"diffusers.MotifVideoTransformer3DModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.Tensor</code>) &#x2014;
Text conditioning of shape <code>(batch_size, sequence_length, embed_dim)</code>.`,name:"encoder_hidden_states"},{anchor:"diffusers.MotifVideoTransformer3DModel.forward.encoder_attention_mask",description:`<strong>encoder_attention_mask</strong> (<code>torch.Tensor</code>) &#x2014;
Mask for text conditioning of shape <code>(batch_size, sequence_length)</code>.`,name:"encoder_attention_mask"},{anchor:"diffusers.MotifVideoTransformer3DModel.forward.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Image embeddings from vision encoder of shape <code>(batch_size, num_tokens, embed_dim)</code>.`,name:"image_embeds"},{anchor:"diffusers.MotifVideoTransformer3DModel.forward.attention_kwargs",description:`<strong>attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Additional arguments for attention processors.`,name:"attention_kwargs"},{anchor:"diffusers.MotifVideoTransformer3DModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Whether to return a <a href="/docs/diffusers/pr_13966/en/api/models/sana_video_transformer3d#diffusers.models.modeling_outputs.Transformer2DModelOutput">Transformer2DModelOutput</a>.`,name:"return_dict"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>The predicted samples.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><a
href="/docs/diffusers/pr_13966/en/api/models/sana_video_transformer3d#diffusers.models.modeling_outputs.Transformer2DModelOutput"
>Transformer2DModelOutput</a> or <code>tuple</code></p>
`}),d(2),a(p),a(o);var h=e(o,2);t(h,{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"});var r=e(h,2),D=s(r);n(D,{name:"class diffusers.models.modeling_outputs.Transformer2DModelOutput",anchor:"diffusers.models.modeling_outputs.Transformer2DModelOutput",source:"https://github.com/huggingface/diffusers/blob/vr_13966/src/diffusers/models/modeling_outputs.py#L21",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_13966/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"}]}),d(2),a(r);var x=e(r,2);Z(x,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/motif_video_transformer_3d.md"}),d(2),M(b,i),U()}export{F as component};

Xet Storage Details

Size:
12 kB
·
Xet hash:
876edf78f78fda37d8c3ab8b2305900d71e1b6325183727d4d216df5662b03fa

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.