Skip to content

Minimax m3 mask rope cache - #1318

Closed
ochougul wants to merge 4 commits into
quic:mainfrom
ochougul:minimax-m3-mask-rope-cache
Closed

Minimax m3 mask rope cache#1318
ochougul wants to merge 4 commits into
quic:mainfrom
ochougul:minimax-m3-mask-rope-cache

Conversation

@ochougul

@ochougul ochougul commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

No description provided.

kdulla and others added 4 commits September 3, 2026 18:45
Signed-off-by: Kushal Dulla <kdulla@qti.qualcomm.com>
Signed-off-by: Kushal Dulla <kdulla@qti.qualcomm.com>
…oder

Adds the checkpoint-key resolution, duplicate-submodule, lifted-constant,
and dtype-promotion fixes needed to trace and export MiniMax-M3's decoder
under torch.export/torch.onnx.export with weight_free=True (meta-device
parameters, no real weights loaded at trace time):

- checkpoint_key_resolver: resolve MiniMax's flattened
  block_sparse_moe.e_score_correction_bias checkpoint key (buffer sits one
  level shallower in the checkpoint than in the live module tree).
- modeling_minimax_m3_vl: avoid duplicate nn.Module registration of
  MoEWeights (object.__setattr__ instead of plain assignment); avoid
  device-bound lifted scalar constants in shape/threshold comparisons;
  cast lm_head input to lm_head.weight.dtype consistently across all
  forward paths; use torch.clamp instead of torch.maximum/minimum against
  a device-bound constant; cast the sigmoid-router's top_k_weights back
  to the router's native dtype so a float32 MoE output doesn't leak into
  later float16-weighted layers (only visible once more than one MoE
  layer runs in sequence).
- blocked_attention_forwards: compare start_index as a plain Python int
  (not a device-bound tensor) in blocked_kv_attention_forward_headpar_offline,
  scoped to the function MiniMax's kv_headpar blocking mode dispatches to.

Validated by iteratively running
examples/text_generation/minimax_m3_decode_only.py against the real
MiniMax-M3 checkpoint and a local reproduction harness exercising the
full 60-layer config without requiring real weights (weight-free export
only needs the config at trace time).

Signed-off-by: amarshar <amarshar@qti.qualcomm.com>
Signed-off-by: Onkar Chougule <ochougul@qti.qualcomm.com>
@ochougul

Copy link
Copy Markdown
Contributor Author

closing at its hanlded in #1317

@ochougul ochougul closed this Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants