Bbq support#5
Open
akhauriyash wants to merge 4 commits into
Open
Conversation
…ansformer_config.py: adds layernorm_num_groups, exposed as --layernorm-num-groups.
- Megatron-LM/megatron/core/transformer/torch_norm.py: adds native GroupRMSNorm.
- Megatron-LM/megatron/core/extensions/transformer_engine.py: makes TENorm return GroupRMSNorm when groups > 1.
- Megatron-LM/megatron/core/extensions/transformer_engine_spec_provider.py and Megatron-LM/
megatron/core/models/gpt/gpt_layer_specs.py: disable TE fused LN+linear when grouped RMSNorm is used and add the checkpoint key mapping for unfused norms.
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.
Summary
Adds an opt-in Megatron-LM RoPE path for xLLM checkpoints that use partial RoPE with the HF/SGLang head-dimension layout.
Why
For xLLM 375B,
rope_head_dim=64andhead_dim=128. Megatron’s standardrotary_percent=0.5path rotates the first contiguous 64 head dims, while the xLLM HF/SGLang implementation applies RoPE after converting through the xLLM head layout. This mismatch can produce large trainer-vs-rollout logprob differences.Changes
--xllm-partial-rope-layoutTransformerConfig.xllm_partial_rope_layoutScope
The new behavior is disabled by default. Existing Megatron RoPE behavior is unchanged unless
--xllm-partial-rope-layoutis passed.Validation
python3 -m py_compile megatron/core/models/common/embeddings/rope_utils.py megatron/core/transformer/transformer_config.py megatron/training/arguments.pygit diff --check