[NPU] Migrate Megatron training to Core 0.18 with MegatronAdaptor and TENPU - #10087
Draft
addsubmuldiv wants to merge 1 commit into
Draft
[NPU] Migrate Megatron training to Core 0.18 with MegatronAdaptor and TENPU#10087addsubmuldiv wants to merge 1 commit into
addsubmuldiv wants to merge 1 commit into
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.
PR type
Summary
Migrate the Ascend NPU Megatron training integration from MindSpeed to Megatron Core 0.18 + MegatronAdaptor + TransformerEngineNPU (TENPU), including the NPU compatibility needed by the existing Megatron-FSDP checkpoint flow.
Companion bridge change: modelscope/mcore-bridge#189
Changes
Initialization and attention
megatron_adaptorbefore MCore/bridge initialization on NPU, with an installation hint for a missing adaptor module.npu_patch/mindspeed.py.attention_backendcontract instead of injecting MindSpeed'suse_flash_attn. Retain task/padding-free guards and Qwen3.5's 2D attention-mask handling.Optimizer and checkpoint compatibility
load_state_dict; remove the MindSpeed loader detection, manual reshard loading, and tensor-step restoration. Keep save-time NPU step normalization.Scope
Validation
The submitted Swift and bridge snapshots were rechecked on 8×Ascend 910B3, Python 3.12, CANN 9.1.0, PyTorch 2.10.0, torch_npu 2.10.0.post2, Transformers 5.12.1, and vLLM 0.23. Backend snapshots: MCore
ba7b5ebce12a(0.18.0), MegatronAdaptor2a164d4548e2, and TENPU0a389a677586.1e-9. CPU global RNG was not identical.no_save_optim, so MoE optimizer resume is not established by this check.merge_lora=false.7.82e-5.Known limitations / follow-ups
merge_lora=falsefor resume-equivalence checks.