---
title: matrixgame3
---

<div class="python-reference">

<a id="fastvideo.configs.models.dits.matrixgame3"></a>

<h2 id="fastvideo.configs.models.dits.matrixgame3.WanVideoArchConfig"><code>fastvideo.configs.models.dits.matrixgame3.WanVideoArchConfig</code></h2>
<pre class="doc-signature"><code>WanVideoArchConfig(stacked_params_mapping: list&#91;tuple&#91;str, str, str&#93;&#93; = list(), _fsdp_shard_conditions: list = (lambda: &#91;is_blocks&#93;)(), _compile_conditions: list = list(), param_names_mapping: dict = (lambda: &#123;&#x27;^patch_embedding\\.(.*)$&#x27;: &#x27;patch_embedding.proj.\\1&#x27;, &#x27;^condition_embedder\\.text_embedder\\.linear_1\\.(.*)$&#x27;: &#x27;condition_embedder.text_embedder.fc_in.\\1&#x27;, &#x27;^condition_embedder\\.text_embedder\\.linear_2\\.(.*)$&#x27;: &#x27;condition_embedder.text_embedder.fc_out.\\1&#x27;, &#x27;^condition_embedder\\.time_embedder\\.linear_1\\.(.*)$&#x27;: &#x27;condition_embedder.time_embedder.mlp.fc_in.\\1&#x27;, &#x27;^condition_embedder\\.time_embedder\\.linear_2\\.(.*)$&#x27;: &#x27;condition_embedder.time_embedder.mlp.fc_out.\\1&#x27;, &#x27;^condition_embedder\\.delta_embedder\\.linear_1\\.(.*)$&#x27;: &#x27;condition_embedder.delta_embedder.mlp.fc_in.\\1&#x27;, &#x27;^condition_embedder\\.delta_embedder\\.linear_2\\.(.*)$&#x27;: &#x27;condition_embedder.delta_embedder.mlp.fc_out.\\1&#x27;, &#x27;^condition_embedder\\.time_proj\\.(.*)$&#x27;: &#x27;condition_embedder.time_modulation.linear.\\1&#x27;, &#x27;^condition_embedder\\.image_embedder\\.ff\\.net\\.0\\.proj\\.(.*)$&#x27;: &#x27;condition_embedder.image_embedder.ff.fc_in.\\1&#x27;, &#x27;^condition_embedder\\.image_embedder\\.ff\\.net\\.2\\.(.*)$&#x27;: &#x27;condition_embedder.image_embedder.ff.fc_out.\\1&#x27;, &#x27;^blocks\\.(\\d+)\\.attn1\\.to_q\\.(.*)$&#x27;: &#x27;blocks.\\1.to_q.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.attn1\\.to_k\\.(.*)$&#x27;: &#x27;blocks.\\1.to_k.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.attn1\\.to_v\\.(.*)$&#x27;: &#x27;blocks.\\1.to_v.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.attn1\\.to_out\\.0\\.(.*)$&#x27;: &#x27;blocks.\\1.to_out.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.attn1\\.norm_q\\.(.*)$&#x27;: &#x27;blocks.\\1.norm_q.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.attn1\\.norm_k\\.(.*)$&#x27;: &#x27;blocks.\\1.norm_k.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.attn2\\.to_out\\.0\\.(.*)$&#x27;: &#x27;blocks.\\1.attn2.to_out.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.ffn\\.net\\.0\\.proj\\.(.*)$&#x27;: &#x27;blocks.\\1.ffn.fc_in.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.ffn\\.net\\.2\\.(.*)$&#x27;: &#x27;blocks.\\1.ffn.fc_out.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.norm2\\.(.*)$&#x27;: &#x27;blocks.\\1.self_attn_residual_norm.norm.\\2&#x27;&#125;)(), reverse_param_names_mapping: dict = (lambda: &#123;&#125;)(), lora_param_names_mapping: dict = (lambda: &#123;&#x27;^blocks\\.(\\d+)\\.self_attn\\.q\\.(.*)$&#x27;: &#x27;blocks.\\1.attn1.to_q.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.self_attn\\.k\\.(.*)$&#x27;: &#x27;blocks.\\1.attn1.to_k.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.self_attn\\.v\\.(.*)$&#x27;: &#x27;blocks.\\1.attn1.to_v.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.self_attn\\.o\\.(.*)$&#x27;: &#x27;blocks.\\1.attn1.to_out.0.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.cross_attn\\.q\\.(.*)$&#x27;: &#x27;blocks.\\1.attn2.to_q.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.cross_attn\\.k\\.(.*)$&#x27;: &#x27;blocks.\\1.attn2.to_k.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.cross_attn\\.v\\.(.*)$&#x27;: &#x27;blocks.\\1.attn2.to_v.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.cross_attn\\.o\\.(.*)$&#x27;: &#x27;blocks.\\1.attn2.to_out.0.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.ffn\\.0\\.(.*)$&#x27;: &#x27;blocks.\\1.ffn.fc_in.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.ffn\\.2\\.(.*)$&#x27;: &#x27;blocks.\\1.ffn.fc_out.\\2&#x27;&#125;)(), cast_prompt_embeds_to_dit_dtype: bool = False, _supported_attention_backends: tuple&#91;AttentionBackendEnum, ...&#93; = (AttentionBackendEnum.SAGE_ATTN, AttentionBackendEnum.FLASH_ATTN, AttentionBackendEnum.TORCH_SDPA, AttentionBackendEnum.VIDEO_SPARSE_ATTN, AttentionBackendEnum.VMOBA_ATTN, AttentionBackendEnum.SAGE_ATTN_THREE, AttentionBackendEnum.ATTN_QAT_INFER, AttentionBackendEnum.ATTN_QAT_TRAIN, AttentionBackendEnum.SLA_ATTN, AttentionBackendEnum.SAGE_SLA_ATTN), hidden_size: int = 0, num_attention_heads: int = 40, num_channels_latents: int = 0, in_channels: int = 16, out_channels: int = 16, exclude_lora_layers: list&#91;str&#93; = (lambda: &#91;&#x27;embedder&#x27;&#93;)(), boundary_ratio: float | None = None, patch_size: tuple&#91;int, int, int&#93; = (1, 2, 2), attention_head_dim: int = 128, text_dim: int = 4096, freq_dim: int = 256, ffn_dim: int = 13824, num_layers: int = 40, cross_attn_norm: bool = True, qk_norm: str = &#x27;rms_norm_across_heads&#x27;, eps: float = 1e-06, image_dim: int | None = None, added_kv_proj_dim: int | None = None, rope_max_seq_len: int = 1024, pos_embed_seq_len: int | None = None, local_attn_size: int = -1, sink_size: int = 0, num_frames_per_block: int = 3, sliding_window_num_frames: int = 21, rope_cache_policy: str = &#x27;absolute&#x27;, r_embedder: bool = False, r_embedder_fusion: Literal&#91;&#x27;additive&#x27;, &#x27;gated&#x27;&#93; = &#x27;additive&#x27;, r_embedder_gate_value: float = 0.25, r_embedder_deltatime_type: Literal&#91;&#x27;r&#x27;, &#x27;t-r&#x27;&#93; = &#x27;r&#x27;)</code></pre>


<h2 id="fastvideo.configs.models.dits.matrixgame3.WanVideoConfig"><code>fastvideo.configs.models.dits.matrixgame3.WanVideoConfig</code></h2>
<pre class="doc-signature"><code>WanVideoConfig(arch_config: DiTArchConfig = WanVideoArchConfig(), prefix: str = &#x27;Wan&#x27;, quant_config: QuantizationConfig | None = None, *, _resolved_attention_backend: AttentionBackendEnum | None = None)</code></pre>


<h2 id="fastvideo.configs.models.dits.matrixgame3.MatrixGame3WanVideoArchConfig"><code>fastvideo.configs.models.dits.matrixgame3.MatrixGame3WanVideoArchConfig</code></h2>
<pre class="doc-signature"><code>MatrixGame3WanVideoArchConfig(stacked_params_mapping: list&#91;tuple&#91;str, str, str&#93;&#93; = list(), _fsdp_shard_conditions: list = (lambda: &#91;is_blocks&#93;)(), _compile_conditions: list = list(), param_names_mapping: dict = (lambda: &#123;&#x27;^patch_embedding\\.(weight|bias)$&#x27;: &#x27;patch_embedding.proj.\\1&#x27;, &#x27;^patch_embedding_wancamctrl\\.(.*)$&#x27;: &#x27;camera_patch_embedding.proj.\\1&#x27;, &#x27;^time_embedding\\.0\\.(.*)$&#x27;: &#x27;condition_embedder.time_embedder.mlp.fc_in.\\1&#x27;, &#x27;^time_embedding\\.2\\.(.*)$&#x27;: &#x27;condition_embedder.time_embedder.mlp.fc_out.\\1&#x27;, &#x27;^time_projection\\.1\\.(.*)$&#x27;: &#x27;condition_embedder.time_modulation.linear.\\1&#x27;, &#x27;^head\\.head\\.(.*)$&#x27;: &#x27;proj_out.\\1&#x27;, &#x27;^head\\.modulation$&#x27;: &#x27;scale_shift_table&#x27;, &#x27;^blocks\\.(\\d+)\\.self_attn\\.q\\.(.*)$&#x27;: &#x27;blocks.\\1.to_q.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.self_attn\\.k\\.(.*)$&#x27;: &#x27;blocks.\\1.to_k.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.self_attn\\.v\\.(.*)$&#x27;: &#x27;blocks.\\1.to_v.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.self_attn\\.o\\.(.*)$&#x27;: &#x27;blocks.\\1.to_out.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.self_attn\\.norm_q\\.(.*)$&#x27;: &#x27;blocks.\\1.norm_q.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.self_attn\\.norm_k\\.(.*)$&#x27;: &#x27;blocks.\\1.norm_k.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.cross_attn\\.q\\.(.*)$&#x27;: &#x27;blocks.\\1.attn2.to_q.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.cross_attn\\.k\\.(.*)$&#x27;: &#x27;blocks.\\1.attn2.to_k.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.cross_attn\\.v\\.(.*)$&#x27;: &#x27;blocks.\\1.attn2.to_v.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.cross_attn\\.o\\.(.*)$&#x27;: &#x27;blocks.\\1.attn2.to_out.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.cross_attn\\.norm_q\\.(.*)$&#x27;: &#x27;blocks.\\1.attn2.norm_q.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.cross_attn\\.norm_k\\.(.*)$&#x27;: &#x27;blocks.\\1.attn2.norm_k.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.ffn\\.0\\.(.*)$&#x27;: &#x27;blocks.\\1.ffn.fc_in.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.ffn\\.2\\.(.*)$&#x27;: &#x27;blocks.\\1.ffn.fc_out.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.norm3\\.(.*)$&#x27;: &#x27;blocks.\\1.self_attn_residual_norm.norm.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.modulation$&#x27;: &#x27;blocks.\\1.scale_shift_table&#x27;&#125;)(), reverse_param_names_mapping: dict = (lambda: &#123;&#125;)(), lora_param_names_mapping: dict = (lambda: &#123;&#x27;^blocks\\.(\\d+)\\.self_attn\\.q\\.(.*)$&#x27;: &#x27;blocks.\\1.attn1.to_q.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.self_attn\\.k\\.(.*)$&#x27;: &#x27;blocks.\\1.attn1.to_k.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.self_attn\\.v\\.(.*)$&#x27;: &#x27;blocks.\\1.attn1.to_v.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.self_attn\\.o\\.(.*)$&#x27;: &#x27;blocks.\\1.attn1.to_out.0.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.cross_attn\\.q\\.(.*)$&#x27;: &#x27;blocks.\\1.attn2.to_q.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.cross_attn\\.k\\.(.*)$&#x27;: &#x27;blocks.\\1.attn2.to_k.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.cross_attn\\.v\\.(.*)$&#x27;: &#x27;blocks.\\1.attn2.to_v.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.cross_attn\\.o\\.(.*)$&#x27;: &#x27;blocks.\\1.attn2.to_out.0.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.ffn\\.0\\.(.*)$&#x27;: &#x27;blocks.\\1.ffn.fc_in.\\2&#x27;, &#x27;^blocks\\.(\\d+)\\.ffn\\.2\\.(.*)$&#x27;: &#x27;blocks.\\1.ffn.fc_out.\\2&#x27;&#125;)(), cast_prompt_embeds_to_dit_dtype: bool = False, _supported_attention_backends: tuple&#91;AttentionBackendEnum, ...&#93; = (AttentionBackendEnum.SAGE_ATTN, AttentionBackendEnum.FLASH_ATTN, AttentionBackendEnum.TORCH_SDPA, AttentionBackendEnum.VIDEO_SPARSE_ATTN, AttentionBackendEnum.VMOBA_ATTN, AttentionBackendEnum.SAGE_ATTN_THREE, AttentionBackendEnum.ATTN_QAT_INFER, AttentionBackendEnum.ATTN_QAT_TRAIN, AttentionBackendEnum.SLA_ATTN, AttentionBackendEnum.SAGE_SLA_ATTN), hidden_size: int = 0, num_attention_heads: int = 24, num_channels_latents: int = 0, in_channels: int = 48, out_channels: int = 48, exclude_lora_layers: list&#91;str&#93; = (lambda: &#91;&#x27;embedder&#x27;&#93;)(), boundary_ratio: float | None = None, patch_size: tuple&#91;int, int, int&#93; = (1, 2, 2), attention_head_dim: int = 128, text_dim: int = 4096, freq_dim: int = 256, ffn_dim: int = 14336, num_layers: int = 30, cross_attn_norm: bool = True, qk_norm: str = &#x27;rms_norm_across_heads&#x27;, eps: float = 1e-06, image_dim: int = 0, added_kv_proj_dim: int | None = None, rope_max_seq_len: int = 1024, pos_embed_seq_len: int | None = None, local_attn_size: int = -1, sink_size: int = 0, num_frames_per_block: int = 3, sliding_window_num_frames: int = 21, rope_cache_policy: str = &#x27;absolute&#x27;, r_embedder: bool = False, r_embedder_fusion: Literal&#91;&#x27;additive&#x27;, &#x27;gated&#x27;&#93; = &#x27;additive&#x27;, r_embedder_gate_value: float = 0.25, r_embedder_deltatime_type: Literal&#91;&#x27;r&#x27;, &#x27;t-r&#x27;&#93; = &#x27;r&#x27;, text_len: int = 512, use_text_crossattn: bool = True, use_memory: bool = True, sigma_theta: float = 0.8, camera_embed_in_channels: int = 1536, action_config: dict = (lambda: &#123;&#x27;blocks&#x27;: list(range(15)), &#x27;enable_mouse&#x27;: True, &#x27;enable_keyboard&#x27;: True, &#x27;heads_num&#x27;: 16, &#x27;hidden_size&#x27;: 128, &#x27;img_hidden_size&#x27;: 3072, &#x27;keyboard_dim_in&#x27;: 6, &#x27;keyboard_hidden_dim&#x27;: 1024, &#x27;mouse_dim_in&#x27;: 2, &#x27;mouse_hidden_dim&#x27;: 1024, &#x27;mouse_qk_dim_list&#x27;: &#91;8, 28, 28&#93;, &#x27;patch_size&#x27;: &#91;1, 2, 2&#93;, &#x27;qk_norm&#x27;: True, &#x27;qkv_bias&#x27;: False, &#x27;rope_dim_list&#x27;: &#91;8, 28, 28&#93;, &#x27;rope_theta&#x27;: 256, &#x27;vae_time_compression_ratio&#x27;: 4, &#x27;windows_size&#x27;: 3&#125;)())</code></pre>


<details><summary>Source</summary><pre><code>@dataclass
class MatrixGame3WanVideoArchConfig(WanVideoArchConfig):
    param_names_mapping: dict = field(
        default_factory=lambda: &#123;
            r&quot;^patch_embedding\.(weight|bias)$&quot;: r&quot;patch_embedding.proj.\1&quot;,
            r&quot;^patch_embedding_wancamctrl\.(.*)$&quot;: r&quot;camera_patch_embedding.proj.\1&quot;,
            r&quot;^time_embedding\.0\.(.*)$&quot;: r&quot;condition_embedder.time_embedder.mlp.fc_in.\1&quot;,
            r&quot;^time_embedding\.2\.(.*)$&quot;: r&quot;condition_embedder.time_embedder.mlp.fc_out.\1&quot;,
            r&quot;^time_projection\.1\.(.*)$&quot;: r&quot;condition_embedder.time_modulation.linear.\1&quot;,
            r&quot;^head\.head\.(.*)$&quot;: r&quot;proj_out.\1&quot;,
            r&quot;^head\.modulation$&quot;: r&quot;scale_shift_table&quot;,
            r&quot;^blocks\.(\d+)\.self_attn\.q\.(.*)$&quot;: r&quot;blocks.\1.to_q.\2&quot;,
            r&quot;^blocks\.(\d+)\.self_attn\.k\.(.*)$&quot;: r&quot;blocks.\1.to_k.\2&quot;,
            r&quot;^blocks\.(\d+)\.self_attn\.v\.(.*)$&quot;: r&quot;blocks.\1.to_v.\2&quot;,
            r&quot;^blocks\.(\d+)\.self_attn\.o\.(.*)$&quot;: r&quot;blocks.\1.to_out.\2&quot;,
            r&quot;^blocks\.(\d+)\.self_attn\.norm_q\.(.*)$&quot;: r&quot;blocks.\1.norm_q.\2&quot;,
            r&quot;^blocks\.(\d+)\.self_attn\.norm_k\.(.*)$&quot;: r&quot;blocks.\1.norm_k.\2&quot;,
            r&quot;^blocks\.(\d+)\.cross_attn\.q\.(.*)$&quot;: r&quot;blocks.\1.attn2.to_q.\2&quot;,
            r&quot;^blocks\.(\d+)\.cross_attn\.k\.(.*)$&quot;: r&quot;blocks.\1.attn2.to_k.\2&quot;,
            r&quot;^blocks\.(\d+)\.cross_attn\.v\.(.*)$&quot;: r&quot;blocks.\1.attn2.to_v.\2&quot;,
            r&quot;^blocks\.(\d+)\.cross_attn\.o\.(.*)$&quot;: r&quot;blocks.\1.attn2.to_out.\2&quot;,
            r&quot;^blocks\.(\d+)\.cross_attn\.norm_q\.(.*)$&quot;: r&quot;blocks.\1.attn2.norm_q.\2&quot;,
            r&quot;^blocks\.(\d+)\.cross_attn\.norm_k\.(.*)$&quot;: r&quot;blocks.\1.attn2.norm_k.\2&quot;,
            r&quot;^blocks\.(\d+)\.ffn\.0\.(.*)$&quot;: r&quot;blocks.\1.ffn.fc_in.\2&quot;,
            r&quot;^blocks\.(\d+)\.ffn\.2\.(.*)$&quot;: r&quot;blocks.\1.ffn.fc_out.\2&quot;,
            r&quot;^blocks\.(\d+)\.norm3\.(.*)$&quot;: r&quot;blocks.\1.self_attn_residual_norm.norm.\2&quot;,
            r&quot;^blocks\.(\d+)\.modulation$&quot;: r&quot;blocks.\1.scale_shift_table&quot;,
        &#125;)
    patch_size: tuple&#91;int, int, int&#93; = (1, 2, 2)
    in_channels: int = 48
    out_channels: int = 48
    num_attention_heads: int = 24
    attention_head_dim: int = 128
    ffn_dim: int = 14336
    num_layers: int = 30
    text_len: int = 512
    image_dim: int = 0
    use_text_crossattn: bool = True
    use_memory: bool = True
    sigma_theta: float = 0.8
    camera_embed_in_channels: int = 1536
    action_config: dict = field(
        default_factory=lambda: &#123;
            &quot;blocks&quot;: list(range(15)),
            &quot;enable_mouse&quot;: True,
            &quot;enable_keyboard&quot;: True,
            &quot;heads_num&quot;: 16,
            &quot;hidden_size&quot;: 128,
            &quot;img_hidden_size&quot;: 3072,
            &quot;keyboard_dim_in&quot;: 6,
            &quot;keyboard_hidden_dim&quot;: 1024,
            &quot;mouse_dim_in&quot;: 2,
            &quot;mouse_hidden_dim&quot;: 1024,
            &quot;mouse_qk_dim_list&quot;: &#91;8, 28, 28&#93;,
            &quot;patch_size&quot;: &#91;1, 2, 2&#93;,
            &quot;qk_norm&quot;: True,
            &quot;qkv_bias&quot;: False,
            &quot;rope_dim_list&quot;: &#91;8, 28, 28&#93;,
            &quot;rope_theta&quot;: 256,
            &quot;vae_time_compression_ratio&quot;: 4,
            &quot;windows_size&quot;: 3,
        &#125;)</code></pre></details>
<h2 id="fastvideo.configs.models.dits.matrixgame3.MatrixGame3WanVideoConfig"><code>fastvideo.configs.models.dits.matrixgame3.MatrixGame3WanVideoConfig</code></h2>
<pre class="doc-signature"><code>MatrixGame3WanVideoConfig(arch_config: MatrixGame3WanVideoArchConfig = MatrixGame3WanVideoArchConfig(), prefix: str = &#x27;Wan&#x27;, quant_config: QuantizationConfig | None = None, _compile_conditions: list = (lambda: &#91;_is_transformer_block&#93;)(), *, _resolved_attention_backend: AttentionBackendEnum | None = None)</code></pre>


<details><summary>Source</summary><pre><code>@dataclass
class MatrixGame3WanVideoConfig(WanVideoConfig):
    arch_config: MatrixGame3WanVideoArchConfig = field(default_factory=MatrixGame3WanVideoArchConfig)
    prefix: str = &quot;Wan&quot;
    _compile_conditions: list = field(default_factory=lambda: &#91;_is_transformer_block&#93;)</code></pre></details>
</div>
