Skip to content

fix: add rotary_percent to Megatron TransformerConfig patch so MiniMax-M2 hf->torch_dist conversion works#2190

Open
mvanhorn wants to merge 1 commit into
THUDM:mainfrom
mvanhorn:fix/2129-minimax-m2-rotary-percent
Open

fix: add rotary_percent to Megatron TransformerConfig patch so MiniMax-M2 hf->torch_dist conversion works#2190
mvanhorn wants to merge 1 commit into
THUDM:mainfrom
mvanhorn:fix/2129-minimax-m2-rotary-percent

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Jul 9, 2026

Copy link
Copy Markdown

Summary

Converting a MiniMax-M2 HF checkpoint to torch_dist format no longer crashes with TransformerConfig got an unexpected keyword argument 'rotary_percent'; the bundled Megatron config patch now declares the field.

Why this matters

Issue #2129 reports the crash when running the hf -> torch_dist conversion for MiniMax-M2. The conversion passes rotary_percent to Megatron's TransformerConfig, but that field is not present in the pinned Megatron-LM. slime already carries missing TransformerConfig fields in its docker/patch/*/megatron.patch files, so the field belongs there:

rotary_percent: Optional[float] = None
"""Percent of rotary dimension to use for rotary position embeddings."""

Changes

  • Add rotary_percent: Optional[float] = None to the TransformerConfig block in every versioned megatron.patch (latest, v0.5.12.post1, v0.5.9, v0.5.7, v0.5.6, v0.5.5.post1, v0.5.0rc0-cu126) so the patch stays consistent across the image tags.

The default None preserves existing behavior for models that do not set it.

Testing

Each patch file is a unified diff applied during the Docker image build. Confirmed each modified hunk's header line counts stay consistent after the insertion so the patch still applies cleanly.

Fixes #2129

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.

[Bug] When making minimax m2.7 hf checkpoint to torch_dist format, ran into error

1 participant