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

matrixgame3

fastvideo.configs.models.dits.matrixgame3.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.matrixgame3.WanVideoConfig

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

fastvideo.configs.models.dits.matrixgame3.MatrixGame3WanVideoArchConfig

MatrixGame3WanVideoArchConfig(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\\.(weight|bias)$': 'patch_embedding.proj.\\1', '^patch_embedding_wancamctrl\\.(.*)$': 'camera_patch_embedding.proj.\\1', '^time_embedding\\.0\\.(.*)$': 'condition_embedder.time_embedder.mlp.fc_in.\\1', '^time_embedding\\.2\\.(.*)$': 'condition_embedder.time_embedder.mlp.fc_out.\\1', '^time_projection\\.1\\.(.*)$': 'condition_embedder.time_modulation.linear.\\1', '^head\\.head\\.(.*)$': 'proj_out.\\1', '^head\\.modulation$': 'scale_shift_table', '^blocks\\.(\\d+)\\.self_attn\\.q\\.(.*)$': 'blocks.\\1.to_q.\\2', '^blocks\\.(\\d+)\\.self_attn\\.k\\.(.*)$': 'blocks.\\1.to_k.\\2', '^blocks\\.(\\d+)\\.self_attn\\.v\\.(.*)$': 'blocks.\\1.to_v.\\2', '^blocks\\.(\\d+)\\.self_attn\\.o\\.(.*)$': 'blocks.\\1.to_out.\\2', '^blocks\\.(\\d+)\\.self_attn\\.norm_q\\.(.*)$': 'blocks.\\1.norm_q.\\2', '^blocks\\.(\\d+)\\.self_attn\\.norm_k\\.(.*)$': 'blocks.\\1.norm_k.\\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.\\2', '^blocks\\.(\\d+)\\.cross_attn\\.norm_q\\.(.*)$': 'blocks.\\1.attn2.norm_q.\\2', '^blocks\\.(\\d+)\\.cross_attn\\.norm_k\\.(.*)$': 'blocks.\\1.attn2.norm_k.\\2', '^blocks\\.(\\d+)\\.ffn\\.0\\.(.*)$': 'blocks.\\1.ffn.fc_in.\\2', '^blocks\\.(\\d+)\\.ffn\\.2\\.(.*)$': 'blocks.\\1.ffn.fc_out.\\2', '^blocks\\.(\\d+)\\.norm3\\.(.*)$': 'blocks.\\1.self_attn_residual_norm.norm.\\2', '^blocks\\.(\\d+)\\.modulation$': 'blocks.\\1.scale_shift_table'})(), 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 = 24, num_channels_latents: int = 0, in_channels: int = 48, out_channels: int = 48, 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 = 14336, num_layers: int = 30, cross_attn_norm: bool = True, qk_norm: str = 'rms_norm_across_heads', 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 = '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', 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: {'blocks': list(range(15)), 'enable_mouse': True, 'enable_keyboard': True, 'heads_num': 16, 'hidden_size': 128, 'img_hidden_size': 3072, 'keyboard_dim_in': 6, '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})())
Source
@dataclass
class MatrixGame3WanVideoArchConfig(WanVideoArchConfig):
    param_names_mapping: dict = field(
        default_factory=lambda: {
            r"^patch_embedding\.(weight|bias)$": r"patch_embedding.proj.\1",
            r"^patch_embedding_wancamctrl\.(.*)$": r"camera_patch_embedding.proj.\1",
            r"^time_embedding\.0\.(.*)$": r"condition_embedder.time_embedder.mlp.fc_in.\1",
            r"^time_embedding\.2\.(.*)$": r"condition_embedder.time_embedder.mlp.fc_out.\1",
            r"^time_projection\.1\.(.*)$": r"condition_embedder.time_modulation.linear.\1",
            r"^head\.head\.(.*)$": r"proj_out.\1",
            r"^head\.modulation$": r"scale_shift_table",
            r"^blocks\.(\d+)\.self_attn\.q\.(.*)$": r"blocks.\1.to_q.\2",
            r"^blocks\.(\d+)\.self_attn\.k\.(.*)$": r"blocks.\1.to_k.\2",
            r"^blocks\.(\d+)\.self_attn\.v\.(.*)$": r"blocks.\1.to_v.\2",
            r"^blocks\.(\d+)\.self_attn\.o\.(.*)$": r"blocks.\1.to_out.\2",
            r"^blocks\.(\d+)\.self_attn\.norm_q\.(.*)$": r"blocks.\1.norm_q.\2",
            r"^blocks\.(\d+)\.self_attn\.norm_k\.(.*)$": r"blocks.\1.norm_k.\2",
            r"^blocks\.(\d+)\.cross_attn\.q\.(.*)$": r"blocks.\1.attn2.to_q.\2",
            r"^blocks\.(\d+)\.cross_attn\.k\.(.*)$": r"blocks.\1.attn2.to_k.\2",
            r"^blocks\.(\d+)\.cross_attn\.v\.(.*)$": r"blocks.\1.attn2.to_v.\2",
            r"^blocks\.(\d+)\.cross_attn\.o\.(.*)$": r"blocks.\1.attn2.to_out.\2",
            r"^blocks\.(\d+)\.cross_attn\.norm_q\.(.*)$": r"blocks.\1.attn2.norm_q.\2",
            r"^blocks\.(\d+)\.cross_attn\.norm_k\.(.*)$": r"blocks.\1.attn2.norm_k.\2",
            r"^blocks\.(\d+)\.ffn\.0\.(.*)$": r"blocks.\1.ffn.fc_in.\2",
            r"^blocks\.(\d+)\.ffn\.2\.(.*)$": r"blocks.\1.ffn.fc_out.\2",
            r"^blocks\.(\d+)\.norm3\.(.*)$": r"blocks.\1.self_attn_residual_norm.norm.\2",
            r"^blocks\.(\d+)\.modulation$": r"blocks.\1.scale_shift_table",
        })
    patch_size: tuple[int, int, int] = (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: {
            "blocks": list(range(15)),
            "enable_mouse": True,
            "enable_keyboard": True,
            "heads_num": 16,
            "hidden_size": 128,
            "img_hidden_size": 3072,
            "keyboard_dim_in": 6,
            "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,
        })

fastvideo.configs.models.dits.matrixgame3.MatrixGame3WanVideoConfig

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

Was this page helpful?