Buckets:

download
raw
14.7 kB
import{s as _e,n as he,o as ge}from"../chunks/scheduler.53228c21.js";import{S as Me,i as Te,e as a,s as r,c as l,h as be,a as d,d as o,b as s,f as O,g as c,j as L,k as q,l as u,m as n,n as p,t as _,o as h,p as g}from"../chunks/index.cac5d66a.js";import{C as ve}from"../chunks/CopyLLMTxtMenu.127444ce.js";import{D as ae}from"../chunks/Docstring.3f02c614.js";import{C as $e}from"../chunks/CodeBlock.606cbaf4.js";import{H as de,E as xe}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.1e8e5da3.js";function ye(ie){let m,N,j,U,T,G,b,R,v,me="A Diffusion Transformer model for 3D video-like data was introduced in Motif-Video by the Motif Technologies Team.",F,$,fe="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.",H,x,le="The model can be loaded with the following code snippet.",W,y,S,D,A,i,V,oe,E,ce="A Transformer model for video-like data used in the Motif-Video model.",ne,M,w,re,Z,ue="Forward pass of the MotifVideoTransformer3DModel.",B,k,K,f,C,se,P,pe='The output of <a href="/docs/diffusers/pr_13751/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',Q,z,X,J,Y;return T=new ve({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),b=new de({props:{title:"MotifVideoTransformer3DModel",local:"motifvideotransformer3dmodel",headingTag:"h1"}}),y=new $e({props:{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}}),D=new de({props:{title:"MotifVideoTransformer3DModel",local:"diffusers.MotifVideoTransformer3DModel",headingTag:"h2"}}),V=new ae({props:{name:"class diffusers.MotifVideoTransformer3DModel",anchor:"diffusers.MotifVideoTransformer3DModel",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"}],source:"https://github.com/huggingface/diffusers/blob/vr_13751/src/diffusers/models/transformers/transformer_motif_video.py#L730"}}),w=new ae({props:{name:"forward",anchor:"diffusers.MotifVideoTransformer3DModel.forward",parameters:[{name:"hidden_states",val:": Tensor"},{name:"timestep",val:": LongTensor"},{name:"encoder_hidden_states",val:": Tensor"},{name:"encoder_attention_mask",val:": torch.Tensor | None = None"},{name:"image_embeds",val:": torch.Tensor | None = 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_13751/en/api/models/sana_video_transformer3d#diffusers.models.modeling_outputs.Transformer2DModelOutput">Transformer2DModelOutput</a>.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_13751/src/diffusers/models/transformers/transformer_motif_video.py#L888",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_13751/en/api/models/sana_video_transformer3d#diffusers.models.modeling_outputs.Transformer2DModelOutput"
>Transformer2DModelOutput</a> or <code>tuple</code></p>
`}}),k=new de({props:{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"}}),C=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_13751/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/vr_13751/src/diffusers/models/modeling_outputs.py#L21"}}),z=new xe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/motif_video_transformer_3d.md"}}),{c(){m=a("meta"),N=r(),j=a("p"),U=r(),l(T.$$.fragment),G=r(),l(b.$$.fragment),R=r(),v=a("p"),v.textContent=me,F=r(),$=a("p"),$.textContent=fe,H=r(),x=a("p"),x.textContent=le,W=r(),l(y.$$.fragment),S=r(),l(D.$$.fragment),A=r(),i=a("div"),l(V.$$.fragment),oe=r(),E=a("p"),E.textContent=ce,ne=r(),M=a("div"),l(w.$$.fragment),re=r(),Z=a("p"),Z.textContent=ue,B=r(),l(k.$$.fragment),K=r(),f=a("div"),l(C.$$.fragment),se=r(),P=a("p"),P.innerHTML=pe,Q=r(),l(z.$$.fragment),X=r(),J=a("p"),this.h()},l(e){const t=be("svelte-u9bgzb",document.head);m=d(t,"META",{name:!0,content:!0}),t.forEach(o),N=s(e),j=d(e,"P",{}),O(j).forEach(o),U=s(e),c(T.$$.fragment,e),G=s(e),c(b.$$.fragment,e),R=s(e),v=d(e,"P",{"data-svelte-h":!0}),L(v)!=="svelte-11aooaj"&&(v.textContent=me),F=s(e),$=d(e,"P",{"data-svelte-h":!0}),L($)!=="svelte-tenonu"&&($.textContent=fe),H=s(e),x=d(e,"P",{"data-svelte-h":!0}),L(x)!=="svelte-1vuni30"&&(x.textContent=le),W=s(e),c(y.$$.fragment,e),S=s(e),c(D.$$.fragment,e),A=s(e),i=d(e,"DIV",{class:!0});var I=O(i);c(V.$$.fragment,I),oe=s(I),E=d(I,"P",{"data-svelte-h":!0}),L(E)!=="svelte-1bjc03w"&&(E.textContent=ce),ne=s(I),M=d(I,"DIV",{class:!0});var ee=O(M);c(w.$$.fragment,ee),re=s(ee),Z=d(ee,"P",{"data-svelte-h":!0}),L(Z)!=="svelte-u8aayb"&&(Z.textContent=ue),ee.forEach(o),I.forEach(o),B=s(e),c(k.$$.fragment,e),K=s(e),f=d(e,"DIV",{class:!0});var te=O(f);c(C.$$.fragment,te),se=s(te),P=d(te,"P",{"data-svelte-h":!0}),L(P)!=="svelte-1acihvv"&&(P.innerHTML=pe),te.forEach(o),Q=s(e),c(z.$$.fragment,e),X=s(e),J=d(e,"P",{}),O(J).forEach(o),this.h()},h(){q(m,"name","hf:doc:metadata"),q(m,"content",De),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(i,"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")},m(e,t){u(document.head,m),n(e,N,t),n(e,j,t),n(e,U,t),p(T,e,t),n(e,G,t),p(b,e,t),n(e,R,t),n(e,v,t),n(e,F,t),n(e,$,t),n(e,H,t),n(e,x,t),n(e,W,t),p(y,e,t),n(e,S,t),p(D,e,t),n(e,A,t),n(e,i,t),p(V,i,null),u(i,oe),u(i,E),u(i,ne),u(i,M),p(w,M,null),u(M,re),u(M,Z),n(e,B,t),p(k,e,t),n(e,K,t),n(e,f,t),p(C,f,null),u(f,se),u(f,P),n(e,Q,t),p(z,e,t),n(e,X,t),n(e,J,t),Y=!0},p:he,i(e){Y||(_(T.$$.fragment,e),_(b.$$.fragment,e),_(y.$$.fragment,e),_(D.$$.fragment,e),_(V.$$.fragment,e),_(w.$$.fragment,e),_(k.$$.fragment,e),_(C.$$.fragment,e),_(z.$$.fragment,e),Y=!0)},o(e){h(T.$$.fragment,e),h(b.$$.fragment,e),h(y.$$.fragment,e),h(D.$$.fragment,e),h(V.$$.fragment,e),h(w.$$.fragment,e),h(k.$$.fragment,e),h(C.$$.fragment,e),h(z.$$.fragment,e),Y=!1},d(e){e&&(o(N),o(j),o(U),o(G),o(R),o(v),o(F),o($),o(H),o(x),o(W),o(S),o(A),o(i),o(B),o(K),o(f),o(Q),o(X),o(J)),o(m),g(T,e),g(b,e),g(y,e),g(D,e),g(V),g(w),g(k,e),g(C),g(z,e)}}}const De='{"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}';function Ve(ie){return ge(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Pe extends Me{constructor(m){super(),Te(this,m,Ve,ye,_e,{})}}export{Pe as component};

Xet Storage Details

Size:
14.7 kB
·
Xet hash:
f9fd61a7801c0db1fb013463cd601386e570bb6b33a8254261c057e48c20993a

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