Buckets:
| import{s as le,n as fe,o as pe}from"../chunks/scheduler.53228c21.js";import{S as he,i as _e,e as d,s as r,c as u,h as ge,a as i,d as o,b as s,f as E,g as l,j as C,k as P,l as f,m as t,n as p,t as h,o as _,p as g}from"../chunks/index.cac5d66a.js";import{C as ye}from"../chunks/CopyLLMTxtMenu.0ef49226.js";import{D as re}from"../chunks/Docstring.9de32ff4.js";import{C as Te}from"../chunks/CodeBlock.606cbaf4.js";import{H as se,E as be}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.48d5cb47.js";function ve(ae){let m,N,I,R,T,W,b,G,v,de='A Diffusion Transformer model for 3D video-like data was introduced in <a href="https://huggingface.co/papers/2412.03603" rel="nofollow">HunyuanVideo: A Systematic Framework For Large Video Generative Models</a> by Tencent.',q,M,ie="The model can be loaded with the following code snippet.",O,$,S,D,U,a,x,ee,z,me='A Transformer model for video-like data used in <a href="https://huggingface.co/tencent/HunyuanVideo" rel="nofollow">HunyuanVideo</a>.',ne,y,H,oe,j,ce='The <a href="/docs/diffusers/pr_13921/en/api/models/hunyuan_video_transformer_3d#diffusers.HunyuanVideoTransformer3DModel">HunyuanVideoTransformer3DModel</a> forward method.',A,V,X,c,w,te,J,ue='The output of <a href="/docs/diffusers/pr_13921/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',F,k,Y,Z,Q;return T=new ye({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),b=new se({props:{title:"HunyuanVideoTransformer3DModel",local:"hunyuanvideotransformer3dmodel",headingTag:"h1"}}),$=new Te({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEh1bnl1YW5WaWRlb1RyYW5zZm9ybWVyM0RNb2RlbCUwQSUwQXRyYW5zZm9ybWVyJTIwJTNEJTIwSHVueXVhblZpZGVvVHJhbnNmb3JtZXIzRE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJodW55dWFudmlkZW8tY29tbXVuaXR5JTJGSHVueXVhblZpZGVvJTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIydHJhbnNmb3JtZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2KQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> HunyuanVideoTransformer3DModel | |
| transformer = HunyuanVideoTransformer3DModel.from_pretrained(<span class="hljs-string">"hunyuanvideo-community/HunyuanVideo"</span>, subfolder=<span class="hljs-string">"transformer"</span>, torch_dtype=torch.bfloat16)`,lang:"python",wrap:!1}}),D=new se({props:{title:"HunyuanVideoTransformer3DModel",local:"diffusers.HunyuanVideoTransformer3DModel",headingTag:"h2"}}),x=new re({props:{name:"class diffusers.HunyuanVideoTransformer3DModel",anchor:"diffusers.HunyuanVideoTransformer3DModel",parameters:[{name:"in_channels",val:": int = 16"},{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_refiner_layers",val:": int = 2"},{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:"guidance_embeds",val:": bool = True"},{name:"text_embed_dim",val:": int = 4096"},{name:"pooled_projection_dim",val:": int = 768"},{name:"rope_theta",val:": float = 256.0"},{name:"rope_axes_dim",val:": tuple = (16, 56, 56)"},{name:"image_condition_type",val:": str | None = None"}],parametersDescription:[{anchor:"diffusers.HunyuanVideoTransformer3DModel.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.HunyuanVideoTransformer3DModel.out_channels",description:`<strong>out_channels</strong> (<code>int</code>, defaults to <code>16</code>) — | |
| The number of channels in the output.`,name:"out_channels"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>24</code>) — | |
| The number of heads to use for multi-head attention.`,name:"num_attention_heads"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.attention_head_dim",description:`<strong>attention_head_dim</strong> (<code>int</code>, defaults to <code>128</code>) — | |
| The number of channels in each head.`,name:"attention_head_dim"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to <code>20</code>) — | |
| The number of layers of dual-stream blocks to use.`,name:"num_layers"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.num_single_layers",description:`<strong>num_single_layers</strong> (<code>int</code>, defaults to <code>40</code>) — | |
| The number of layers of single-stream blocks to use.`,name:"num_single_layers"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.num_refiner_layers",description:`<strong>num_refiner_layers</strong> (<code>int</code>, defaults to <code>2</code>) — | |
| The number of layers of refiner blocks to use.`,name:"num_refiner_layers"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.mlp_ratio",description:`<strong>mlp_ratio</strong> (<code>float</code>, defaults to <code>4.0</code>) — | |
| The ratio of the hidden layer size to the input size in the feedforward network.`,name:"mlp_ratio"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, defaults to <code>2</code>) — | |
| The size of the spatial patches to use in the patch embedding layer.`,name:"patch_size"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.patch_size_t",description:`<strong>patch_size_t</strong> (<code>int</code>, defaults to <code>1</code>) — | |
| The size of the tmeporal patches to use in the patch embedding layer.`,name:"patch_size_t"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.qk_norm",description:`<strong>qk_norm</strong> (<code>str</code>, defaults to <code>rms_norm</code>) — | |
| The normalization to use for the query and key projections in the attention layers.`,name:"qk_norm"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.guidance_embeds",description:`<strong>guidance_embeds</strong> (<code>bool</code>, defaults to <code>True</code>) — | |
| Whether to use guidance embeddings in the model.`,name:"guidance_embeds"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.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.HunyuanVideoTransformer3DModel.pooled_projection_dim",description:`<strong>pooled_projection_dim</strong> (<code>int</code>, defaults to <code>768</code>) — | |
| The dimension of the pooled projection of the text embeddings.`,name:"pooled_projection_dim"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.rope_theta",description:`<strong>rope_theta</strong> (<code>float</code>, defaults to <code>256.0</code>) — | |
| The value of theta to use in the RoPE layer.`,name:"rope_theta"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.rope_axes_dim",description:`<strong>rope_axes_dim</strong> (<code>tuple[int]</code>, defaults to <code>(16, 56, 56)</code>) — | |
| The dimensions of the axes to use in the RoPE layer.`,name:"rope_axes_dim"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.image_condition_type",description:`<strong>image_condition_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>None</code>) — | |
| The type of image conditioning to use. If <code>None</code>, no image conditioning is used. If <code>latent_concat</code>, the | |
| image is concatenated to the latent stream. If <code>token_replace</code>, the image is used to replace first-frame | |
| tokens in the latent stream and apply conditioning.`,name:"image_condition_type"}],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/models/transformers/transformer_hunyuan_video.py#L841"}}),H=new re({props:{name:"forward",anchor:"diffusers.HunyuanVideoTransformer3DModel.forward",parameters:[{name:"hidden_states",val:": Tensor"},{name:"timestep",val:": LongTensor"},{name:"encoder_hidden_states",val:": Tensor"},{name:"encoder_attention_mask",val:": Tensor"},{name:"pooled_projections",val:": Tensor"},{name:"guidance",val:": Tensor = None"},{name:"attention_kwargs",val:": dict[str, typing.Any] | None = None"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.HunyuanVideoTransformer3DModel.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, num_channels, num_frames, height, width)</code>) — | |
| Input <code>hidden_states</code>.`,name:"hidden_states"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.forward.timestep",description:`<strong>timestep</strong> (<code>torch.LongTensor</code>) — | |
| Used to indicate denoising step.`,name:"timestep"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_len, embed_dims)</code>) — | |
| Conditional embeddings (embeddings computed from the input conditions such as prompts) to use.`,name:"encoder_hidden_states"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.forward.encoder_attention_mask",description:`<strong>encoder_attention_mask</strong> (<code>torch.Tensor</code>) — | |
| Mask applied to <code>encoder_hidden_states</code> during attention.`,name:"encoder_attention_mask"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.forward.pooled_projections",description:`<strong>pooled_projections</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, projection_dim)</code>) — | |
| Embeddings projected from the embeddings of input conditions.`,name:"pooled_projections"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.forward.guidance",description:`<strong>guidance</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Guidance scale embedding used for guidance-distilled variants of the model.`,name:"guidance"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.forward.attention_kwargs",description:`<strong>attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) — | |
| A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under | |
| <code>self.processor</code> in | |
| <a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"attention_kwargs"},{anchor:"diffusers.HunyuanVideoTransformer3DModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to return a <code>~models.transformer_2d.Transformer2DModelOutput</code> instead of a plain | |
| tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_13921/src/diffusers/models/transformers/transformer_hunyuan_video.py#L994",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If <code>return_dict</code> is True, an <code>~models.transformer_2d.Transformer2DModelOutput</code> is returned, otherwise a | |
| <code>tuple</code> where the first element is the sample tensor.</p> | |
| `}}),V=new se({props:{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"}}),w=new re({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_13921/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_13921/src/diffusers/models/modeling_outputs.py#L21"}}),k=new be({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/hunyuan_video_transformer_3d.md"}}),{c(){m=d("meta"),N=r(),I=d("p"),R=r(),u(T.$$.fragment),W=r(),u(b.$$.fragment),G=r(),v=d("p"),v.innerHTML=de,q=r(),M=d("p"),M.textContent=ie,O=r(),u($.$$.fragment),S=r(),u(D.$$.fragment),U=r(),a=d("div"),u(x.$$.fragment),ee=r(),z=d("p"),z.innerHTML=me,ne=r(),y=d("div"),u(H.$$.fragment),oe=r(),j=d("p"),j.innerHTML=ce,A=r(),u(V.$$.fragment),X=r(),c=d("div"),u(w.$$.fragment),te=r(),J=d("p"),J.innerHTML=ue,F=r(),u(k.$$.fragment),Y=r(),Z=d("p"),this.h()},l(e){const n=ge("svelte-u9bgzb",document.head);m=i(n,"META",{name:!0,content:!0}),n.forEach(o),N=s(e),I=i(e,"P",{}),E(I).forEach(o),R=s(e),l(T.$$.fragment,e),W=s(e),l(b.$$.fragment,e),G=s(e),v=i(e,"P",{"data-svelte-h":!0}),C(v)!=="svelte-fdngxv"&&(v.innerHTML=de),q=s(e),M=i(e,"P",{"data-svelte-h":!0}),C(M)!=="svelte-1vuni30"&&(M.textContent=ie),O=s(e),l($.$$.fragment,e),S=s(e),l(D.$$.fragment,e),U=s(e),a=i(e,"DIV",{class:!0});var L=E(a);l(x.$$.fragment,L),ee=s(L),z=i(L,"P",{"data-svelte-h":!0}),C(z)!=="svelte-wu7xtw"&&(z.innerHTML=me),ne=s(L),y=i(L,"DIV",{class:!0});var B=E(y);l(H.$$.fragment,B),oe=s(B),j=i(B,"P",{"data-svelte-h":!0}),C(j)!=="svelte-19chwuv"&&(j.innerHTML=ce),B.forEach(o),L.forEach(o),A=s(e),l(V.$$.fragment,e),X=s(e),c=i(e,"DIV",{class:!0});var K=E(c);l(w.$$.fragment,K),te=s(K),J=i(K,"P",{"data-svelte-h":!0}),C(J)!=="svelte-2clpd6"&&(J.innerHTML=ue),K.forEach(o),F=s(e),l(k.$$.fragment,e),Y=s(e),Z=i(e,"P",{}),E(Z).forEach(o),this.h()},h(){P(m,"name","hf:doc:metadata"),P(m,"content",Me),P(y,"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,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),P(c,"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,n){f(document.head,m),t(e,N,n),t(e,I,n),t(e,R,n),p(T,e,n),t(e,W,n),p(b,e,n),t(e,G,n),t(e,v,n),t(e,q,n),t(e,M,n),t(e,O,n),p($,e,n),t(e,S,n),p(D,e,n),t(e,U,n),t(e,a,n),p(x,a,null),f(a,ee),f(a,z),f(a,ne),f(a,y),p(H,y,null),f(y,oe),f(y,j),t(e,A,n),p(V,e,n),t(e,X,n),t(e,c,n),p(w,c,null),f(c,te),f(c,J),t(e,F,n),p(k,e,n),t(e,Y,n),t(e,Z,n),Q=!0},p:fe,i(e){Q||(h(T.$$.fragment,e),h(b.$$.fragment,e),h($.$$.fragment,e),h(D.$$.fragment,e),h(x.$$.fragment,e),h(H.$$.fragment,e),h(V.$$.fragment,e),h(w.$$.fragment,e),h(k.$$.fragment,e),Q=!0)},o(e){_(T.$$.fragment,e),_(b.$$.fragment,e),_($.$$.fragment,e),_(D.$$.fragment,e),_(x.$$.fragment,e),_(H.$$.fragment,e),_(V.$$.fragment,e),_(w.$$.fragment,e),_(k.$$.fragment,e),Q=!1},d(e){e&&(o(N),o(I),o(R),o(W),o(G),o(v),o(q),o(M),o(O),o(S),o(U),o(a),o(A),o(X),o(c),o(F),o(Y),o(Z)),o(m),g(T,e),g(b,e),g($,e),g(D,e),g(x),g(H),g(V,e),g(w),g(k,e)}}}const Me='{"title":"HunyuanVideoTransformer3DModel","local":"hunyuanvideotransformer3dmodel","sections":[{"title":"HunyuanVideoTransformer3DModel","local":"diffusers.HunyuanVideoTransformer3DModel","sections":[],"depth":2},{"title":"Transformer2DModelOutput","local":"diffusers.models.modeling_outputs.Transformer2DModelOutput","sections":[],"depth":2}],"depth":1}';function $e(ae){return pe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ze extends he{constructor(m){super(),_e(this,m,$e,ve,le,{})}}export{ze as component}; | |
Xet Storage Details
- Size:
- 15.8 kB
- Xet hash:
- cfa1b5a2508002e991b3ef6ae654d46628035791902eefe97dc9d597b5964d4c
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.