fix(gpt-oss): emit fused raw expert tensors for SGLang#2004
Open
Jiang020609 wants to merge 1 commit into
Open
Conversation
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
Fixes #1840.
This fixes GPT-OSS raw Megatron-to-HF conversion for the non-colocate SGLang weight update path.
Previously, GPT-OSS expert tensors were emitted as per-expert
gate_proj/up_proj/down_projnames. SGLang expects fused expert tensors for GPT-OSS, so the raw converter produced tensors that could not be loaded correctly by SGLang's fused MoE weight loader.Changes
linear_fc1.weightinto interleaved fusedgate_up_proj.linear_fc2.weightbefore emittingdown_proj.[num_experts, ...]before returning them to the weight update path.gate_up_proj_biasanddown_proj_bias.Validation
python -m ruff check slime/backends/megatron_utils/megatron_to_hf/gpt_oss.py tests/test_gpt_oss_raw_converter.pypython -m pytest tests/test_gpt_oss_raw_converter.pyGPU smoke on
1x NVIDIA A800-SXM4-80GBwithlmsys/gpt-oss-20b-bf16:model.layers.0.mlp.experts.gate_up_proj:(32, 2880, 5760)model.layers.0.mlp.experts.down_proj:(32, 2880, 2880)model.layers.0.mlp.experts.gate_up_proj_bias:(32, 5760)model.layers.0.mlp.experts.down_proj_bias:(32, 2880)engine.update_weights_from_tensor(...)returned(True, 'Success').GPT-OSS raw SGLang smoke passed.