Skip to content
FastVideo
Esc
↑↓navigate↵open⌘Jpreview
On this page

matrixgame2

fastvideo.configs.models.dits.matrixgame2.WanVideoArchConfig

WanVideoArchConfig(stacked_params_mapping: list[tuple[str, str, str]] = list(), _fsdp_shard_conditions: list = (lambda: [is_blocks])(), _compile_conditions: list = list(), param_names_mapping: dict = (lambda: {'^patch_embedding\\.(.*)$': 'patch_embedding.proj.\\1', '^condition_embedder\\.text_embedder\\.linear_1\\.(.*)$': 'condition_embedder.text_embedder.fc_in.\\1', '^condition_embedder\\.text_embedder\\.linear_2\\.(.*)$': 'condition_embedder.text_embedder.fc_out.\\1', '^condition_embedder\\.time_embedder\\.linear_1\\.(.*)$': 'condition_embedder.time_embedder.mlp.fc_in.\\1', '^condition_embedder\\.time_embedder\\.linear_2\\.(.*)$': 'condition_embedder.time_embedder.mlp.fc_out.\\1', '^condition_embedder\\.delta_embedder\\.linear_1\\.(.*)$': 'condition_embedder.delta_embedder.mlp.fc_in.\\1', '^condition_embedder\\.delta_embedder\\.linear_2\\.(.*)$': 'condition_embedder.delta_embedder.mlp.fc_out.\\1', '^condition_embedder\\.time_proj\\.(.*)$': 'condition_embedder.time_modulation.linear.\\1', '^condition_embedder\\.image_embedder\\.ff\\.net\\.0\\.proj\\.(.*)$': 'condition_embedder.image_embedder.ff.fc_in.\\1', '^condition_embedder\\.image_embedder\\.ff\\.net\\.2\\.(.*)$': 'condition_embedder.image_embedder.ff.fc_out.\\1', '^blocks\\.(\\d+)\\.attn1\\.to_q\\.(.*)$': 'blocks.\\1.to_q.\\2', '^blocks\\.(\\d+)\\.attn1\\.to_k\\.(.*)$': 'blocks.\\1.to_k.\\2', '^blocks\\.(\\d+)\\.attn1\\.to_v\\.(.*)$': 'blocks.\\1.to_v.\\2', '^blocks\\.(\\d+)\\.attn1\\.to_out\\.0\\.(.*)$': 'blocks.\\1.to_out.\\2', '^blocks\\.(\\d+)\\.attn1\\.norm_q\\.(.*)$': 'blocks.\\1.norm_q.\\2', '^blocks\\.(\\d+)\\.attn1\\.norm_k\\.(.*)$': 'blocks.\\1.norm_k.\\2', '^blocks\\.(\\d+)\\.attn2\\.to_out\\.0\\.(.*)$': 'blocks.\\1.attn2.to_out.\\2', '^blocks\\.(\\d+)\\.ffn\\.net\\.0\\.proj\\.(.*)$': 'blocks.\\1.ffn.fc_in.\\2', '^blocks\\.(\\d+)\\.ffn\\.net\\.2\\.(.*)$': 'blocks.\\1.ffn.fc_out.\\2', '^blocks\\.(\\d+)\\.norm2\\.(.*)$': 'blocks.\\1.self_attn_residual_norm.norm.\\2'})(), reverse_param_names_mapping: dict = (lambda: {})(), lora_param_names_mapping: dict = (lambda: {'^blocks\\.(\\d+)\\.self_attn\\.q\\.(.*)$': 'blocks.\\1.attn1.to_q.\\2', '^blocks\\.(\\d+)\\.self_attn\\.k\\.(.*)$': 'blocks.\\1.attn1.to_k.\\2', '^blocks\\.(\\d+)\\.self_attn\\.v\\.(.*)$': 'blocks.\\1.attn1.to_v.\\2', '^blocks\\.(\\d+)\\.self_attn\\.o\\.(.*)$': 'blocks.\\1.attn1.to_out.0.\\2', '^blocks\\.(\\d+)\\.cross_attn\\.q\\.(.*)$': 'blocks.\\1.attn2.to_q.\\2', '^blocks\\.(\\d+)\\.cross_attn\\.k\\.(.*)$': 'blocks.\\1.attn2.to_k.\\2', '^blocks\\.(\\d+)\\.cross_attn\\.v\\.(.*)$': 'blocks.\\1.attn2.to_v.\\2', '^blocks\\.(\\d+)\\.cross_attn\\.o\\.(.*)$': 'blocks.\\1.attn2.to_out.0.\\2', '^blocks\\.(\\d+)\\.ffn\\.0\\.(.*)$': 'blocks.\\1.ffn.fc_in.\\2', '^blocks\\.(\\d+)\\.ffn\\.2\\.(.*)$': 'blocks.\\1.ffn.fc_out.\\2'})(), cast_prompt_embeds_to_dit_dtype: bool = False, _supported_attention_backends: tuple[AttentionBackendEnum, ...] = (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[str] = (lambda: ['embedder'])(), boundary_ratio: float | None = None, patch_size: tuple[int, int, int] = (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 = 'rms_norm_across_heads', 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 = 'absolute', r_embedder: bool = False, r_embedder_fusion: Literal['additive', 'gated'] = 'additive', r_embedder_gate_value: float = 0.25, r_embedder_deltatime_type: Literal['r', 't-r'] = 'r')

fastvideo.configs.models.dits.matrixgame2.WanVideoConfig

WanVideoConfig(arch_config: DiTArchConfig = WanVideoArchConfig(), prefix: str = 'Wan', quant_config: QuantizationConfig | None = None, *, _resolved_attention_backend: AttentionBackendEnum | None = None)

fastvideo.configs.models.dits.matrixgame2.MatrixGame2WanVideoArchConfig

MatrixGame2WanVideoArchConfig(stacked_params_mapping: list[tuple[str, str, str]] = list(), _fsdp_shard_conditions: list = (lambda: [is_blocks])(), _compile_conditions: list = list(), param_names_mapping: dict = (lambda: {'^patch_embedding\\.(?!proj\\.)(.*)$': 'patch_embedding.proj.\\1', '^condition_embedder\\.text_embedder\\.linear_1\\.(.*)$': 'condition_embedder.text_embedder.fc_in.\\1', '^condition_embedder\\.text_embedder\\.linear_2\\.(.*)$': 'condition_embedder.text_embedder.fc_out.\\1', '^condition_embedder\\.time_embedder\\.linear_1\\.(.*)$': 'condition_embedder.time_embedder.mlp.fc_in.\\1', '^condition_embedder\\.time_embedder\\.linear_2\\.(.*)$': 'condition_embedder.time_embedder.mlp.fc_out.\\1', '^condition_embedder\\.time_proj\\.(.*)$': 'condition_embedder.time_modulation.linear.\\1', '^condition_embedder\\.image_embedder\\.ff\\.net\\.0\\.proj\\.(.*)$': 'condition_embedder.image_embedder.ff.fc_in.\\1', '^condition_embedder\\.image_embedder\\.ff\\.net\\.2\\.(.*)$': 'condition_embedder.image_embedder.ff.fc_out.\\1', '^blocks\\.(\\d+)\\.attn1\\.to_q\\.(.*)$': 'blocks.\\1.to_q.\\2', '^blocks\\.(\\d+)\\.attn1\\.to_k\\.(.*)$': 'blocks.\\1.to_k.\\2', '^blocks\\.(\\d+)\\.attn1\\.to_v\\.(.*)$': 'blocks.\\1.to_v.\\2', '^blocks\\.(\\d+)\\.attn1\\.to_out\\.0\\.(.*)$': 'blocks.\\1.to_out.\\2', '^blocks\\.(\\d+)\\.attn1\\.norm_q\\.(.*)$': 'blocks.\\1.norm_q.\\2', '^blocks\\.(\\d+)\\.attn1\\.norm_k\\.(.*)$': 'blocks.\\1.norm_k.\\2', '^blocks\\.(\\d+)\\.attn2\\.to_out\\.0\\.(.*)$': 'blocks.\\1.attn2.to_out.\\2', '^blocks\\.(\\d+)\\.ffn\\.net\\.0\\.proj\\.(.*)$': 'blocks.\\1.ffn.fc_in.\\2', '^blocks\\.(\\d+)\\.ffn\\.net\\.2\\.(.*)$': 'blocks.\\1.ffn.fc_out.\\2', '^blocks\\.(\\d+)\\.norm2\\.(.*)$': 'blocks.\\1.self_attn_residual_norm.norm.\\2'})(), reverse_param_names_mapping: dict = (lambda: {})(), lora_param_names_mapping: dict = (lambda: {'^blocks\\.(\\d+)\\.self_attn\\.q\\.(.*)$': 'blocks.\\1.attn1.to_q.\\2', '^blocks\\.(\\d+)\\.self_attn\\.k\\.(.*)$': 'blocks.\\1.attn1.to_k.\\2', '^blocks\\.(\\d+)\\.self_attn\\.v\\.(.*)$': 'blocks.\\1.attn1.to_v.\\2', '^blocks\\.(\\d+)\\.self_attn\\.o\\.(.*)$': 'blocks.\\1.attn1.to_out.0.\\2', '^blocks\\.(\\d+)\\.cross_attn\\.q\\.(.*)$': 'blocks.\\1.attn2.to_q.\\2', '^blocks\\.(\\d+)\\.cross_attn\\.k\\.(.*)$': 'blocks.\\1.attn2.to_k.\\2', '^blocks\\.(\\d+)\\.cross_attn\\.v\\.(.*)$': 'blocks.\\1.attn2.to_v.\\2', '^blocks\\.(\\d+)\\.cross_attn\\.o\\.(.*)$': 'blocks.\\1.attn2.to_out.0.\\2', '^blocks\\.(\\d+)\\.ffn\\.0\\.(.*)$': 'blocks.\\1.ffn.fc_in.\\2', '^blocks\\.(\\d+)\\.ffn\\.2\\.(.*)$': 'blocks.\\1.ffn.fc_out.\\2'})(), cast_prompt_embeds_to_dit_dtype: bool = False, _supported_attention_backends: tuple[AttentionBackendEnum, ...] = (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[str] = (lambda: ['embedder'])(), boundary_ratio: float | None = None, patch_size: tuple[int, int, int] = (1, 2, 2), attention_head_dim: int = 128, text_dim: int = 0, freq_dim: int = 256, ffn_dim: int = 13824, num_layers: int = 40, cross_attn_norm: bool = True, qk_norm: str = 'rms_norm_across_heads', eps: float = 1e-06, image_dim: int = 1280, 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 = 'absolute', r_embedder: bool = False, r_embedder_fusion: Literal['additive', 'gated'] = 'additive', r_embedder_gate_value: float = 0.25, r_embedder_deltatime_type: Literal['r', 't-r'] = 'r', action_config: dict = (lambda: {'blocks': list(range(15)), 'enable_mouse': True, 'enable_keyboard': True, 'heads_num': 16, 'hidden_size': 128, 'img_hidden_size': 1536, 'keyboard_dim_in': 4, 'keyboard_hidden_dim': 1024, 'mouse_dim_in': 2, 'mouse_hidden_dim': 1024, 'mouse_qk_dim_list': [8, 28, 28], 'patch_size': [1, 2, 2], 'qk_norm': True, 'qkv_bias': False, 'rope_dim_list': [8, 28, 28], 'rope_theta': 256, 'vae_time_compression_ratio': 4, 'windows_size': 3})(), text_len: int = 512)
Source
@dataclass
class MatrixGame2WanVideoArchConfig(WanVideoArchConfig):
    # Override param_names_mapping to remove patch_embedding transformation
    # because Matrix-Game 2.0 checkpoints already have patch_embedding.proj format
    param_names_mapping: dict = field(
        default_factory=lambda: {
            r"^patch_embedding\.(?!proj\.)(.*)$": r"patch_embedding.proj.\1",
            r"^condition_embedder\.text_embedder\.linear_1\.(.*)$": r"condition_embedder.text_embedder.fc_in.\1",
            r"^condition_embedder\.text_embedder\.linear_2\.(.*)$": r"condition_embedder.text_embedder.fc_out.\1",
            r"^condition_embedder\.time_embedder\.linear_1\.(.*)$": r"condition_embedder.time_embedder.mlp.fc_in.\1",
            r"^condition_embedder\.time_embedder\.linear_2\.(.*)$": r"condition_embedder.time_embedder.mlp.fc_out.\1",
            r"^condition_embedder\.time_proj\.(.*)$": r"condition_embedder.time_modulation.linear.\1",
            r"^condition_embedder\.image_embedder\.ff\.net\.0\.proj\.(.*)$":
            r"condition_embedder.image_embedder.ff.fc_in.\1",
            r"^condition_embedder\.image_embedder\.ff\.net\.2\.(.*)$":
            r"condition_embedder.image_embedder.ff.fc_out.\1",
            r"^blocks\.(\d+)\.attn1\.to_q\.(.*)$": r"blocks.\1.to_q.\2",
            r"^blocks\.(\d+)\.attn1\.to_k\.(.*)$": r"blocks.\1.to_k.\2",
            r"^blocks\.(\d+)\.attn1\.to_v\.(.*)$": r"blocks.\1.to_v.\2",
            r"^blocks\.(\d+)\.attn1\.to_out\.0\.(.*)$": r"blocks.\1.to_out.\2",
            r"^blocks\.(\d+)\.attn1\.norm_q\.(.*)$": r"blocks.\1.norm_q.\2",
            r"^blocks\.(\d+)\.attn1\.norm_k\.(.*)$": r"blocks.\1.norm_k.\2",
            r"^blocks\.(\d+)\.attn2\.to_out\.0\.(.*)$": r"blocks.\1.attn2.to_out.\2",
            r"^blocks\.(\d+)\.ffn\.net\.0\.proj\.(.*)$": r"blocks.\1.ffn.fc_in.\2",
            r"^blocks\.(\d+)\.ffn\.net\.2\.(.*)$": r"blocks.\1.ffn.fc_out.\2",
            r"^blocks\.(\d+)\.norm2\.(.*)$": r"blocks.\1.self_attn_residual_norm.norm.\2",
        })
action_config: dict = field(
    default_factory=lambda: {
        "blocks": list(range(15)),
        "enable_mouse": True,
        "enable_keyboard": True,
        "heads_num": 16,
        "hidden_size": 128,
        "img_hidden_size": 1536,
        "keyboard_dim_in": 4,
        "keyboard_hidden_dim": 1024,
        "mouse_dim_in": 2,
        "mouse_hidden_dim": 1024,
        "mouse_qk_dim_list": [8, 28, 28],
        "patch_size": [1, 2, 2],
        "qk_norm": True,
        "qkv_bias": False,
        "rope_dim_list": [8, 28, 28],
        "rope_theta": 256,
        "vae_time_compression_ratio": 4,
        "windows_size": 3,
    })

local_attn_size: int = -1
sink_size: int = 0
num_frames_per_block: int = 3
text_len: int = 512
text_dim: int = 0
image_dim: int = 1280</code></pre></details>

fastvideo.configs.models.dits.matrixgame2.MatrixGame2WanVideoConfig

MatrixGame2WanVideoConfig(arch_config: MatrixGame2WanVideoArchConfig = MatrixGame2WanVideoArchConfig(), prefix: str = 'Wan', quant_config: QuantizationConfig | None = None, _compile_conditions: list = (lambda: [_is_transformer_block])(), *, _resolved_attention_backend: AttentionBackendEnum | None = None)
Source
@dataclass
class MatrixGame2WanVideoConfig(WanVideoConfig):
    arch_config: MatrixGame2WanVideoArchConfig = field(default_factory=MatrixGame2WanVideoArchConfig)
    prefix: str = "Wan"
    _compile_conditions: list = field(default_factory=lambda: [_is_transformer_block])

Was this page helpful?