import{s as re,n as ae,o as de}from"../chunks/scheduler.53228c21.js";import{S as ie,i as me,e as m,s,c as f,h as le,a as l,d as t,b as r,f as G,g as c,j as A,k as B,l as q,m as o,n as p,t as u,o as _,p as h}from"../chunks/index.100fac89.js";import{C as fe}from"../chunks/CopyLLMTxtMenu.999d3d86.js";import{D as se}from"../chunks/Docstring.46d0934e.js";import{C as ce}from"../chunks/CodeBlock.d30a6509.js";import{H as Q,E as pe}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.d27ae4df.js";function ue(Y){let a,j,R,z,g,E,y,Z,T,ee='A Diffusion Transformer model for 3D video-like data was introduced in <a href="https://github.com/SkyworkAI/SkyReels-V2" rel="nofollow">SkyReels-V2</a> by the Skywork AI.',C,k,ne="The model can be loaded with the following code snippet.",J,b,F,$,I,d,M,X,V,te="A Transformer model for video-like data used in the Wan-based SkyReels-V2 model.",L,v,N,i,x,K,S,oe='The output of <a href="/docs/diffusers/main/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',O,D,U,w,P;return g=new fe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),y=new Q({props:{title:"SkyReelsV2Transformer3DModel",local:"skyreelsv2transformer3dmodel",headingTag:"h1"}}),b=new ce({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFNreVJlZWxzVjJUcmFuc2Zvcm1lcjNETW9kZWwlMEElMEF0cmFuc2Zvcm1lciUyMCUzRCUyMFNreVJlZWxzVjJUcmFuc2Zvcm1lcjNETW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMlNreXdvcmslMkZTa3lSZWVscy1WMi1ERi0xLjNCLTU0MFAtRGlmZnVzZXJzJTIyJTJDJTIwc3ViZm9sZGVyJTNEJTIydHJhbnNmb3JtZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2KQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> SkyReelsV2Transformer3DModel

transformer = SkyReelsV2Transformer3DModel.from_pretrained(<span class="hljs-string">&quot;Skywork/SkyReels-V2-DF-1.3B-540P-Diffusers&quot;</span>, subfolder=<span class="hljs-string">&quot;transformer&quot;</span>, torch_dtype=torch.bfloat16)`,wrap:!1}}),$=new Q({props:{title:"SkyReelsV2Transformer3DModel",local:"diffusers.SkyReelsV2Transformer3DModel",headingTag:"h2"}}),M=new se({props:{name:"class diffusers.SkyReelsV2Transformer3DModel",anchor:"diffusers.SkyReelsV2Transformer3DModel",parameters:[{name:"patch_size",val:": typing.Tuple[int, ...] = (1, 2, 2)"},{name:"num_attention_heads",val:": int = 16"},{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 = 8192"},{name:"num_layers",val:": int = 32"},{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"},{name:"pos_embed_seq_len",val:": typing.Optional[int] = None"},{name:"inject_sample_info",val:": bool = False"},{name:"num_frame_per_block",val:": int = 1"}],parametersDescription:[{anchor:"diffusers.SkyReelsV2Transformer3DModel.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.SkyReelsV2Transformer3DModel.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, defaults to <code>16</code>) &#x2014;
Fixed length for text embeddings.`,name:"num_attention_heads"},{anchor:"diffusers.SkyReelsV2Transformer3DModel.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.SkyReelsV2Transformer3DModel.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.SkyReelsV2Transformer3DModel.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.SkyReelsV2Transformer3DModel.text_dim",description:`<strong>text_dim</strong> (<code>int</code>, defaults to <code>4096</code>) &#x2014;
Input dimension for text embeddings.`,name:"text_dim"},{anchor:"diffusers.SkyReelsV2Transformer3DModel.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.SkyReelsV2Transformer3DModel.ffn_dim",description:`<strong>ffn_dim</strong> (<code>int</code>, defaults to <code>8192</code>) &#x2014;
Intermediate dimension in feed-forward network.`,name:"ffn_dim"},{anchor:"diffusers.SkyReelsV2Transformer3DModel.num_layers",description:`<strong>num_layers</strong> (<code>int</code>, defaults to <code>32</code>) &#x2014;
The number of layers of transformer blocks to use.`,name:"num_layers"},{anchor:"diffusers.SkyReelsV2Transformer3DModel.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.SkyReelsV2Transformer3DModel.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.SkyReelsV2Transformer3DModel.qk_norm",description:`<strong>qk_norm</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;rms_norm_across_heads&quot;</code>) &#x2014;
Enable query/key normalization.`,name:"qk_norm"},{anchor:"diffusers.SkyReelsV2Transformer3DModel.eps",description:`<strong>eps</strong> (<code>float</code>, defaults to <code>1e-6</code>) &#x2014;
Epsilon value for normalization layers.`,name:"eps"},{anchor:"diffusers.SkyReelsV2Transformer3DModel.inject_sample_info",description:`<strong>inject_sample_info</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Whether to inject sample information into the model.`,name:"inject_sample_info"},{anchor:"diffusers.SkyReelsV2Transformer3DModel.image_dim",description:`<strong>image_dim</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The dimension of the image embeddings.`,name:"image_dim"},{anchor:"diffusers.SkyReelsV2Transformer3DModel.added_kv_proj_dim",description:`<strong>added_kv_proj_dim</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The dimension of the added key/value projection.`,name:"added_kv_proj_dim"},{anchor:"diffusers.SkyReelsV2Transformer3DModel.rope_max_seq_len",description:`<strong>rope_max_seq_len</strong> (<code>int</code>, defaults to <code>1024</code>) &#x2014;
The maximum sequence length for the rotary embeddings.`,name:"rope_max_seq_len"},{anchor:"diffusers.SkyReelsV2Transformer3DModel.pos_embed_seq_len",description:`<strong>pos_embed_seq_len</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The sequence length for the positional embeddings.`,name:"pos_embed_seq_len"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/transformers/transformer_skyreels_v2.py#L518"}}),v=new Q({props:{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"}}),x=new se({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"}}),D=new pe({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/skyreels_v2_transformer_3d.md"}}),{c(){a=m("meta"),j=s(),R=m("p"),z=s(),f(g.$$.fragment),E=s(),f(y.$$.fragment),Z=s(),T=m("p"),T.innerHTML=ee,C=s(),k=m("p"),k.textContent=ne,J=s(),f(b.$$.fragment),F=s(),f($.$$.fragment),I=s(),d=m("div"),f(M.$$.fragment),X=s(),V=m("p"),V.textContent=te,L=s(),f(v.$$.fragment),N=s(),i=m("div"),f(x.$$.fragment),K=s(),S=m("p"),S.innerHTML=oe,O=s(),f(D.$$.fragment),U=s(),w=m("p"),this.h()},l(e){const n=le("svelte-u9bgzb",document.head);a=l(n,"META",{name:!0,content:!0}),n.forEach(t),j=r(e),R=l(e,"P",{}),G(R).forEach(t),z=r(e),c(g.$$.fragment,e),E=r(e),c(y.$$.fragment,e),Z=r(e),T=l(e,"P",{"data-svelte-h":!0}),A(T)!=="svelte-14k6y22"&&(T.innerHTML=ee),C=r(e),k=l(e,"P",{"data-svelte-h":!0}),A(k)!=="svelte-1vuni30"&&(k.textContent=ne),J=r(e),c(b.$$.fragment,e),F=r(e),c($.$$.fragment,e),I=r(e),d=l(e,"DIV",{class:!0});var W=G(d);c(M.$$.fragment,W),X=r(W),V=l(W,"P",{"data-svelte-h":!0}),A(V)!=="svelte-om4ddc"&&(V.textContent=te),W.forEach(t),L=r(e),c(v.$$.fragment,e),N=r(e),i=l(e,"DIV",{class:!0});var H=G(i);c(x.$$.fragment,H),K=r(H),S=l(H,"P",{"data-svelte-h":!0}),A(S)!=="svelte-1x8c0js"&&(S.innerHTML=oe),H.forEach(t),O=r(e),c(D.$$.fragment,e),U=r(e),w=l(e,"P",{}),G(w).forEach(t),this.h()},h(){B(a,"name","hf:doc:metadata"),B(a,"content",_e),B(d,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),B(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){q(document.head,a),o(e,j,n),o(e,R,n),o(e,z,n),p(g,e,n),o(e,E,n),p(y,e,n),o(e,Z,n),o(e,T,n),o(e,C,n),o(e,k,n),o(e,J,n),p(b,e,n),o(e,F,n),p($,e,n),o(e,I,n),o(e,d,n),p(M,d,null),q(d,X),q(d,V),o(e,L,n),p(v,e,n),o(e,N,n),o(e,i,n),p(x,i,null),q(i,K),q(i,S),o(e,O,n),p(D,e,n),o(e,U,n),o(e,w,n),P=!0},p:ae,i(e){P||(u(g.$$.fragment,e),u(y.$$.fragment,e),u(b.$$.fragment,e),u($.$$.fragment,e),u(M.$$.fragment,e),u(v.$$.fragment,e),u(x.$$.fragment,e),u(D.$$.fragment,e),P=!0)},o(e){_(g.$$.fragment,e),_(y.$$.fragment,e),_(b.$$.fragment,e),_($.$$.fragment,e),_(M.$$.fragment,e),_(v.$$.fragment,e),_(x.$$.fragment,e),_(D.$$.fragment,e),P=!1},d(e){e&&(t(j),t(R),t(z),t(E),t(Z),t(T),t(C),t(k),t(J),t(F),t(I),t(d),t(L),t(N),t(i),t(O),t(U),t(w)),t(a),h(g,e),h(y,e),h(b,e),h($,e),h(M),h(v,e),h(x),h(D,e)}}}const _e='{"title":"SkyReelsV2Transformer3DModel","local":"skyreelsv2transformer3dmodel","sections":[{"title":"SkyReelsV2Transformer3DModel","local":"diffusers.SkyReelsV2Transformer3DModel","sections":[],"depth":2},{"title":"Transformer2DModelOutput","local":"diffusers.models.modeling_outputs.Transformer2DModelOutput","sections":[],"depth":2}],"depth":1}';function he(Y){return de(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Me extends ie{constructor(a){super(),me(this,a,he,ue,re,{})}}export{Me as component};
