Minimax m3 mask rope cache - #1318
Closed
ochougul wants to merge 4 commits into
Closed
Conversation
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>
Contributor
Author
|
closing at its hanlded in #1317 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.