Repository navigation
feat(peft): add moe_shared_loras export layout for shared-outer MoE LoRA - #6225
Open
HollowMan6 wants to merge 2 commits into
Open
HollowMan6 wants to merge 2 commits into
HollowMan6 wants to merge 2 commits into
Conversation
8 tasks done
HollowMan6
force-pushed
the
moe_shared_loras
branch
2 times, most recently
from
October 5, 2026 19:13
1c3b40d to
79e3bdf
Compare
Add a `moe_shared_loras` option to adapter export that emits shared-outer routed-expert LoRA in the 2D `experts.w1/w2/w3` layout consumed by vLLM's `enable_moe_shared_loras` mode. Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
HollowMan6
force-pushed
the
moe_shared_loras
branch
from
October 11, 2026 22:30
7999789 to
85d27ce
Compare
This branch has not been deployed
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.
What does this PR do ?
Add a
moe_shared_lorasoption to adapter export that emits shared-outer routed-expert LoRA in the 2Dexperts.w1/w2/w3layout consumed by vLLM'senable_moe_shared_lorasmode.Changelog
moe_shared_loras: bool = FalsetoAutoBridge.export_adapter_weights,MegatronPeftBridge.stream_adapter_weights_megatron_to_hf, and the registeredstream_adapter_weights_megatron_to_hfdispatch.MegatronPeftBridge._stream_shared_outer_adapter_weights_2d_moe, which reuses the legacy shared-outer emission (mapping lookup, EP gather, fused gate/up split) and repacks it as:experts.w1/w3.lora_A: shared gate/up factor,(1, r, hidden)experts.w1/w3.lora_B: per-expert gate/up factors stacked in expert order,(E, intermediate, r)experts.w2.lora_A: per-expert down factors,(E, r, intermediate)experts.w2.lora_B: shared down factor,(1, hidden, r)stack_3d_moe>moe_shared_loras>expand_shared_outer. With all three unset, the legacy (SGLang) layout is unchanged.ValueErrorwhenmoe_shared_lorasmeets non-gated experts, which have now1/w3pair.moe_shared_loras(likewith_megatron_names) only when enabled and check the bridge's streaming override up front, so bridges that overridestream_adapter_weights_megatron_to_hfwith an explicit signature keep working by default._check_with_megatron_names_supportis generalized to_check_stream_kwarg_support.docs/training/peft.md.w1/w2/w3layout (w1 = gate, w3 = up, expert order, shared factors at expert-dim 1), flag priority, the non-gated error path, and AutoBridge forwarding / legacy-override compatibility.GitHub Actions CI
See the CI section in the Contributing doc for how to trigger the CI. A Nvidia developer will need to approve and trigger the CI for external contributors.
Before your PR is "Ready for review"
Pre checks:
If you haven't finished some of the above items you can still open "Draft" PR.
Additional Information
expand_shared_outer) and Support 3D-MoE LoRA export for shared-outer routed-expert adapters #5939 (stack_3d_moe). The new flag is additive and defaults toFalse, so existing export output is unchanged.python -m pytest tests/unit_tests/models/test_adapter_export.py tests/unit_tests/models/test_auto_bridge.py tests/unit_tests/models/test_model_bridge_lora.py tests/unit_tests/models/megatron_mimo/conversion/test_orchestrator.py(305 passed).