import{s as se,n as ae,o as ie}from"../chunks/scheduler.53228c21.js";import{S as de,i as me,e as m,s as r,c as u,h as le,a as l,d as t,b as s,f as X,g as f,j as A,k as F,l as J,m as o,n as c,t as p,o as h,p as _}from"../chunks/index.100fac89.js";import{C as ue}from"../chunks/CopyLLMTxtMenu.20a72e0e.js";import{D as re}from"../chunks/Docstring.49101787.js";import{C as fe}from"../chunks/CodeBlock.d30a6509.js";import{H as B,E as ce}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.4d82655d.js";function pe(K){let a,Z,k,j,g,E,y,I,T,ee='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.',C,b,ne="The model can be loaded with the following code snippet.",L,$,R,M,P,i,v,Y,H,te='A Transformer model for video-like data used in <a href="https://huggingface.co/tencent/HunyuanVideo" rel="nofollow">HunyuanVideo</a>.',W,x,G,d,D,Q,w,oe='The output of <a href="/docs/diffusers/main/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',q,V,S,z,N;return g=new ue({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),y=new B({props:{title:"HunyuanVideoTransformer3DModel",local:"hunyuanvideotransformer3dmodel",headingTag:"h1"}}),$=new fe({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">&quot;hunyuanvideo-community/HunyuanVideo&quot;</span>, subfolder=<span class="hljs-string">&quot;transformer&quot;</span>, torch_dtype=torch.bfloat16)`,wrap:!1}}),M=new B({props:{title:"HunyuanVideoTransformer3DModel",local:"diffusers.HunyuanVideoTransformer3DModel",headingTag:"h2"}}),v=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:": typing.Tuple[int, ...] = (16, 56, 56)"},{name:"image_condition_type",val:": typing.Optional[str] = None"}],parametersDescription:[{anchor:"diffusers.HunyuanVideoTransformer3DModel.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, defaults to <code>16</code>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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>) &#x2014;
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/main/src/diffusers/models/transformers/transformer_hunyuan_video.py#L841"}}),x=new B({props:{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"}}),D=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/main/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/main/src/diffusers/models/modeling_outputs.py#L21"}}),V=new ce({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/hunyuan_video_transformer_3d.md"}}),{c(){a=m("meta"),Z=r(),k=m("p"),j=r(),u(g.$$.fragment),E=r(),u(y.$$.fragment),I=r(),T=m("p"),T.innerHTML=ee,C=r(),b=m("p"),b.textContent=ne,L=r(),u($.$$.fragment),R=r(),u(M.$$.fragment),P=r(),i=m("div"),u(v.$$.fragment),Y=r(),H=m("p"),H.innerHTML=te,W=r(),u(x.$$.fragment),G=r(),d=m("div"),u(D.$$.fragment),Q=r(),w=m("p"),w.innerHTML=oe,q=r(),u(V.$$.fragment),S=r(),z=m("p"),this.h()},l(e){const n=le("svelte-u9bgzb",document.head);a=l(n,"META",{name:!0,content:!0}),n.forEach(t),Z=s(e),k=l(e,"P",{}),X(k).forEach(t),j=s(e),f(g.$$.fragment,e),E=s(e),f(y.$$.fragment,e),I=s(e),T=l(e,"P",{"data-svelte-h":!0}),A(T)!=="svelte-fdngxv"&&(T.innerHTML=ee),C=s(e),b=l(e,"P",{"data-svelte-h":!0}),A(b)!=="svelte-1vuni30"&&(b.textContent=ne),L=s(e),f($.$$.fragment,e),R=s(e),f(M.$$.fragment,e),P=s(e),i=l(e,"DIV",{class:!0});var O=X(i);f(v.$$.fragment,O),Y=s(O),H=l(O,"P",{"data-svelte-h":!0}),A(H)!=="svelte-wu7xtw"&&(H.innerHTML=te),O.forEach(t),W=s(e),f(x.$$.fragment,e),G=s(e),d=l(e,"DIV",{class:!0});var U=X(d);f(D.$$.fragment,U),Q=s(U),w=l(U,"P",{"data-svelte-h":!0}),A(w)!=="svelte-1x8c0js"&&(w.innerHTML=oe),U.forEach(t),q=s(e),f(V.$$.fragment,e),S=s(e),z=l(e,"P",{}),X(z).forEach(t),this.h()},h(){F(a,"name","hf:doc:metadata"),F(a,"content",he),F(i,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),F(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,n){J(document.head,a),o(e,Z,n),o(e,k,n),o(e,j,n),c(g,e,n),o(e,E,n),c(y,e,n),o(e,I,n),o(e,T,n),o(e,C,n),o(e,b,n),o(e,L,n),c($,e,n),o(e,R,n),c(M,e,n),o(e,P,n),o(e,i,n),c(v,i,null),J(i,Y),J(i,H),o(e,W,n),c(x,e,n),o(e,G,n),o(e,d,n),c(D,d,null),J(d,Q),J(d,w),o(e,q,n),c(V,e,n),o(e,S,n),o(e,z,n),N=!0},p:ae,i(e){N||(p(g.$$.fragment,e),p(y.$$.fragment,e),p($.$$.fragment,e),p(M.$$.fragment,e),p(v.$$.fragment,e),p(x.$$.fragment,e),p(D.$$.fragment,e),p(V.$$.fragment,e),N=!0)},o(e){h(g.$$.fragment,e),h(y.$$.fragment,e),h($.$$.fragment,e),h(M.$$.fragment,e),h(v.$$.fragment,e),h(x.$$.fragment,e),h(D.$$.fragment,e),h(V.$$.fragment,e),N=!1},d(e){e&&(t(Z),t(k),t(j),t(E),t(I),t(T),t(C),t(b),t(L),t(R),t(P),t(i),t(W),t(G),t(d),t(q),t(S),t(z)),t(a),_(g,e),_(y,e),_($,e),_(M,e),_(v),_(x,e),_(D),_(V,e)}}}const he='{"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(K){return ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ve extends de{constructor(a){super(),me(this,a,_e,pe,se,{})}}export{ve as component};
