import{s as oe,n as re,o as se}from"../chunks/scheduler.8c3d61f6.js";import{S as ae,i as de,g as m,s as r,r as $,A as ie,h as l,f as t,c as s,j as U,u as M,x as A,k as S,y as z,a as o,v,d as D,t as y,w as W}from"../chunks/index.da70eac4.js";import{D as te}from"../chunks/Docstring.6b390b9a.js";import{C as me}from"../chunks/CodeBlock.00a903b3.js";import{H as Q,E as le}from"../chunks/EditOnGithub.1e64e623.js";function fe(Y){let a,j,k,E,f,I,c,B='A Diffusion Transformer model for 3D video-like data was introduced in <a href="https://github.com/Wan-Video/Wan2.1" rel="nofollow">Wan 2.1</a> by the Alibaba Wan Team.',Z,u,K="The model can be loaded with the following code snippet.",q,p,C,_,V,d,h,X,x,ee="A Transformer model for video-like data used in the Wan model.",H,g,L,i,T,F,w,ne='The output of <a href="/docs/diffusers/main/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',O,b,N,J,P;return f=new Q({props:{title:"WanTransformer3DModel",local:"wantransformer3dmodel",headingTag:"h1"}}),p=new me({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFdhblRyYW5zZm9ybWVyM0RNb2RlbCUwQSUwQXRyYW5zZm9ybWVyJTIwJTNEJTIwV2FuVHJhbnNmb3JtZXIzRE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJXYW4tQUklMkZXYW4yLjEtVDJWLTEuM0ItRGlmZnVzZXJzJTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIydHJhbnNmb3JtZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2KQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> WanTransformer3DModel

transformer = WanTransformer3DModel.from_pretrained(<span class="hljs-string">&quot;Wan-AI/Wan2.1-T2V-1.3B-Diffusers&quot;</span>, subfolder=<span class="hljs-string">&quot;transformer&quot;</span>, torch_dtype=torch.bfloat16)`,wrap:!1}}),_=new Q({props:{title:"WanTransformer3DModel",local:"diffusers.WanTransformer3DModel",headingTag:"h2"}}),h=new te({props:{name:"class diffusers.WanTransformer3DModel",anchor:"diffusers.WanTransformer3DModel",parameters:[{name:"patch_size",val:": typing.Tuple[int] = (1, 2, 2)"},{name:"num_attention_heads",val:": int = 40"},{name:"attention_head_dim",val:": int = 128"},{name:"in_channels",val:": int = 16"},{name:"out_channels",val:": int = 16"},{name:"text_dim",val:": int = 4096"},{name:"freq_dim",val:": int = 256"},{name:"ffn_dim",val:": int = 13824"},{name:"num_layers",val:": int = 40"},{name:"cross_attn_norm",val:": bool = True"},{name:"qk_norm",val:": typing.Optional[str] = 'rms_norm_across_heads'"},{name:"eps",val:": float = 1e-06"},{name:"image_dim",val:": typing.Optional[int] = None"},{name:"added_kv_proj_dim",val:": typing.Optional[int] = None"},{name:"rope_max_seq_len",val:": int = 1024"}],parametersDescription:[{anchor:"diffusers.WanTransformer3DModel.patch_size",description:`<strong>patch_size</strong> (<code>Tuple[int]</code>, defaults to <code>(1, 2, 2)</code>) &#x2014;
3D patch dimensions for video embedding (t_patch, h_patch, w_patch).`,name:"patch_size"},{anchor:"diffusers.WanTransformer3DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>40</code>) &#x2014;
Fixed length for text embeddings.`,name:"num_attention_heads"},{anchor:"diffusers.WanTransformer3DModel.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.WanTransformer3DModel.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.WanTransformer3DModel.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.WanTransformer3DModel.text_dim",description:`<strong>text_dim</strong> (<code>int</code>, defaults to <code>512</code>) &#x2014;
Input dimension for text embeddings.`,name:"text_dim"},{anchor:"diffusers.WanTransformer3DModel.freq_dim",description:`<strong>freq_dim</strong> (<code>int</code>, defaults to <code>256</code>) &#x2014;
Dimension for sinusoidal time embeddings.`,name:"freq_dim"},{anchor:"diffusers.WanTransformer3DModel.ffn_dim",description:`<strong>ffn_dim</strong> (<code>int</code>, defaults to <code>13824</code>) &#x2014;
Intermediate dimension in feed-forward network.`,name:"ffn_dim"},{anchor:"diffusers.WanTransformer3DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to <code>40</code>) &#x2014;
The number of layers of transformer blocks to use.`,name:"num_layers"},{anchor:"diffusers.WanTransformer3DModel.window_size",description:`<strong>window_size</strong> (<code>Tuple[int]</code>, defaults to <code>(-1, -1)</code>) &#x2014;
Window size for local attention (-1 indicates global attention).`,name:"window_size"},{anchor:"diffusers.WanTransformer3DModel.cross_attn_norm",description:`<strong>cross_attn_norm</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Enable cross-attention normalization.`,name:"cross_attn_norm"},{anchor:"diffusers.WanTransformer3DModel.qk_norm",description:`<strong>qk_norm</strong> (<code>bool</code>, defaults to <code>True</code>) &#x2014;
Enable query/key normalization.`,name:"qk_norm"},{anchor:"diffusers.WanTransformer3DModel.eps",description:`<strong>eps</strong> (<code>float</code>, defaults to <code>1e-6</code>) &#x2014;
Epsilon value for normalization layers.`,name:"eps"},{anchor:"diffusers.WanTransformer3DModel.add_img_emb",description:`<strong>add_img_emb</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Whether to use img_emb.`,name:"add_img_emb"},{anchor:"diffusers.WanTransformer3DModel.added_kv_proj_dim",description:`<strong>added_kv_proj_dim</strong> (<code>int</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The number of channels to use for the added key and value projections. If <code>None</code>, no projection is used.`,name:"added_kv_proj_dim"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/transformer_wan.py#L291"}}),g=new Q({props:{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"}}),T=new te({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#L20"}}),b=new le({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/wan_transformer_3d.md"}}),{c(){a=m("meta"),j=r(),k=m("p"),E=r(),$(f.$$.fragment),I=r(),c=m("p"),c.innerHTML=B,Z=r(),u=m("p"),u.textContent=K,q=r(),$(p.$$.fragment),C=r(),$(_.$$.fragment),V=r(),d=m("div"),$(h.$$.fragment),X=r(),x=m("p"),x.textContent=ee,H=r(),$(g.$$.fragment),L=r(),i=m("div"),$(T.$$.fragment),F=r(),w=m("p"),w.innerHTML=ne,O=r(),$(b.$$.fragment),N=r(),J=m("p"),this.h()},l(e){const n=ie("svelte-u9bgzb",document.head);a=l(n,"META",{name:!0,content:!0}),n.forEach(t),j=s(e),k=l(e,"P",{}),U(k).forEach(t),E=s(e),M(f.$$.fragment,e),I=s(e),c=l(e,"P",{"data-svelte-h":!0}),A(c)!=="svelte-1h7uf3v"&&(c.innerHTML=B),Z=s(e),u=l(e,"P",{"data-svelte-h":!0}),A(u)!=="svelte-1vuni30"&&(u.textContent=K),q=s(e),M(p.$$.fragment,e),C=s(e),M(_.$$.fragment,e),V=s(e),d=l(e,"DIV",{class:!0});var R=U(d);M(h.$$.fragment,R),X=s(R),x=l(R,"P",{"data-svelte-h":!0}),A(x)!=="svelte-1idrolf"&&(x.textContent=ee),R.forEach(t),H=s(e),M(g.$$.fragment,e),L=s(e),i=l(e,"DIV",{class:!0});var G=U(i);M(T.$$.fragment,G),F=s(G),w=l(G,"P",{"data-svelte-h":!0}),A(w)!=="svelte-1x8c0js"&&(w.innerHTML=ne),G.forEach(t),O=s(e),M(b.$$.fragment,e),N=s(e),J=l(e,"P",{}),U(J).forEach(t),this.h()},h(){S(a,"name","hf:doc:metadata"),S(a,"content",ce),S(d,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(i,"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){z(document.head,a),o(e,j,n),o(e,k,n),o(e,E,n),v(f,e,n),o(e,I,n),o(e,c,n),o(e,Z,n),o(e,u,n),o(e,q,n),v(p,e,n),o(e,C,n),v(_,e,n),o(e,V,n),o(e,d,n),v(h,d,null),z(d,X),z(d,x),o(e,H,n),v(g,e,n),o(e,L,n),o(e,i,n),v(T,i,null),z(i,F),z(i,w),o(e,O,n),v(b,e,n),o(e,N,n),o(e,J,n),P=!0},p:re,i(e){P||(D(f.$$.fragment,e),D(p.$$.fragment,e),D(_.$$.fragment,e),D(h.$$.fragment,e),D(g.$$.fragment,e),D(T.$$.fragment,e),D(b.$$.fragment,e),P=!0)},o(e){y(f.$$.fragment,e),y(p.$$.fragment,e),y(_.$$.fragment,e),y(h.$$.fragment,e),y(g.$$.fragment,e),y(T.$$.fragment,e),y(b.$$.fragment,e),P=!1},d(e){e&&(t(j),t(k),t(E),t(I),t(c),t(Z),t(u),t(q),t(C),t(V),t(d),t(H),t(L),t(i),t(O),t(N),t(J)),t(a),W(f,e),W(p,e),W(_,e),W(h),W(g,e),W(T),W(b,e)}}}const ce='{"title":"WanTransformer3DModel","local":"wantransformer3dmodel","sections":[{"title":"WanTransformer3DModel","local":"diffusers.WanTransformer3DModel","sections":[],"depth":2},{"title":"Transformer2DModelOutput","local":"diffusers.models.modeling_outputs.Transformer2DModelOutput","sections":[],"depth":2}],"depth":1}';function ue(Y){return se(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class be extends ae{constructor(a){super(),de(this,a,ue,fe,oe,{})}}export{be as component};
