nemo_automodel.components.models.minimax_m2.layers

View as Markdown

Module Contents

Classes

NameDescription
MiniMaxM2AttentionMiniMax-M2 attention with optional Q/K RMSNorm and partial RoPE.

API

class nemo_automodel.components.models.minimax_m2.layers.MiniMaxM2Attention(
config: typing.Any,
backend: nemo_automodel.components.models.common.BackendConfig
)

Bases: Module

MiniMax-M2 attention with optional Q/K RMSNorm and partial RoPE.

head_dim
k_norm
k_proj
num_heads
= config.num_attention_heads
num_kv_heads
= config.num_key_value_heads
o_proj
q_norm
q_proj
use_qk_norm
= getattr(config, 'use_qk_norm', False)
v_proj
nemo_automodel.components.models.minimax_m2.layers.MiniMaxM2Attention.forward(
x: torch.Tensor,
freqs_cis: torch.Tensor,
attention_mask: torch.Tensor | None = None,
attn_kwargs: typing.Any = {}
) -> torch.Tensor
nemo_automodel.components.models.minimax_m2.layers.MiniMaxM2Attention.init_weights(
buffer_device: torch.device,
init_std: float = 0.02
)