import{s as oe,n as se,o as re}from"../chunks/scheduler.8c3d61f6.js";import{S as ae,i as de,g as l,s,r as k,A as ie,h as m,f as t,c as r,j as L,u as b,x as H,k as A,y as w,a as o,v,d as M,t as $,w as D}from"../chunks/index.da70eac4.js";import{D as te}from"../chunks/Docstring.c021b19a.js";import{C as le}from"../chunks/CodeBlock.a9c4becf.js";import{H as X,E as me}from"../chunks/getInferenceSnippets.725ed3d4.js";function fe(K){let a,q,S,j,f,z,c,Q='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.',E,u,Y="The model can be loaded with the following code snippet.",Z,p,J,_,C,d,h,G,x,ee="A Transformer model for video-like data used in the Wan-based SkyReels-V2 model.",F,g,I,i,y,B,V,ne='The output of <a href="/docs/diffusers/main/en/api/models/transformer2d#diffusers.Transformer2DModel">Transformer2DModel</a>.',N,T,O,R,U;return f=new X({props:{title:"SkyReelsV2Transformer3DModel",local:"skyreelsv2transformer3dmodel",headingTag:"h1"}}),p=new le({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 X({props:{title:"SkyReelsV2Transformer3DModel",local:"diffusers.SkyReelsV2Transformer3DModel",headingTag:"h2"}}),h=new te({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#L344"}}),g=new X({props:{title:"Transformer2DModelOutput",local:"diffusers.models.modeling_outputs.Transformer2DModelOutput",headingTag:"h2"}}),y=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"}}),T=new me({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/models/skyreels_v2_transformer_3d.md"}}),{c(){a=l("meta"),q=s(),S=l("p"),j=s(),k(f.$$.fragment),z=s(),c=l("p"),c.innerHTML=Q,E=s(),u=l("p"),u.textContent=Y,Z=s(),k(p.$$.fragment),J=s(),k(_.$$.fragment),C=s(),d=l("div"),k(h.$$.fragment),G=s(),x=l("p"),x.textContent=ee,F=s(),k(g.$$.fragment),I=s(),i=l("div"),k(y.$$.fragment),B=s(),V=l("p"),V.innerHTML=ne,N=s(),k(T.$$.fragment),O=s(),R=l("p"),this.h()},l(e){const n=ie("svelte-u9bgzb",document.head);a=m(n,"META",{name:!0,content:!0}),n.forEach(t),q=r(e),S=m(e,"P",{}),L(S).forEach(t),j=r(e),b(f.$$.fragment,e),z=r(e),c=m(e,"P",{"data-svelte-h":!0}),H(c)!=="svelte-14k6y22"&&(c.innerHTML=Q),E=r(e),u=m(e,"P",{"data-svelte-h":!0}),H(u)!=="svelte-1vuni30"&&(u.textContent=Y),Z=r(e),b(p.$$.fragment,e),J=r(e),b(_.$$.fragment,e),C=r(e),d=m(e,"DIV",{class:!0});var P=L(d);b(h.$$.fragment,P),G=r(P),x=m(P,"P",{"data-svelte-h":!0}),H(x)!=="svelte-om4ddc"&&(x.textContent=ee),P.forEach(t),F=r(e),b(g.$$.fragment,e),I=r(e),i=m(e,"DIV",{class:!0});var W=L(i);b(y.$$.fragment,W),B=r(W),V=m(W,"P",{"data-svelte-h":!0}),H(V)!=="svelte-1x8c0js"&&(V.innerHTML=ne),W.forEach(t),N=r(e),b(T.$$.fragment,e),O=r(e),R=m(e,"P",{}),L(R).forEach(t),this.h()},h(){A(a,"name","hf:doc:metadata"),A(a,"content",ce),A(d,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),A(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){w(document.head,a),o(e,q,n),o(e,S,n),o(e,j,n),v(f,e,n),o(e,z,n),o(e,c,n),o(e,E,n),o(e,u,n),o(e,Z,n),v(p,e,n),o(e,J,n),v(_,e,n),o(e,C,n),o(e,d,n),v(h,d,null),w(d,G),w(d,x),o(e,F,n),v(g,e,n),o(e,I,n),o(e,i,n),v(y,i,null),w(i,B),w(i,V),o(e,N,n),v(T,e,n),o(e,O,n),o(e,R,n),U=!0},p:se,i(e){U||(M(f.$$.fragment,e),M(p.$$.fragment,e),M(_.$$.fragment,e),M(h.$$.fragment,e),M(g.$$.fragment,e),M(y.$$.fragment,e),M(T.$$.fragment,e),U=!0)},o(e){$(f.$$.fragment,e),$(p.$$.fragment,e),$(_.$$.fragment,e),$(h.$$.fragment,e),$(g.$$.fragment,e),$(y.$$.fragment,e),$(T.$$.fragment,e),U=!1},d(e){e&&(t(q),t(S),t(j),t(z),t(c),t(E),t(u),t(Z),t(J),t(C),t(d),t(F),t(I),t(i),t(N),t(O),t(R)),t(a),D(f,e),D(p,e),D(_,e),D(h),D(g,e),D(y),D(T,e)}}}const ce='{"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 ue(K){return re(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Te extends ae{constructor(a){super(),de(this,a,ue,fe,oe,{})}}export{Te as component};
