feat: add npu patch for qwen3-vl-8b grpo & ppo#1750
Open
cjy0x wants to merge 1 commit intoTHUDM:mainfrom
Open
Conversation
23f0202 to
995ed8b
Compare
Co-authored-by: shiyuan680 <917935075@qq.com> Co-authored-by: PengchengShi00 <spc117369@gmail.com> Signed-off-by: cjy0x <isjunyi.chen@gmail.com>
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 Description
Overview
This PR includes a set of patches to adapt the training stack (megatron-bridge, megatron, mindspeed, sglang, slime) for NPU (Ascend) compatibility, along with several bug fixes.
megatron-bridge.patch
megatron.patch
@jit_fuserremoval: Removed all@jit_fuserdecorators, astorch_npudoes not support the corresponding fused operators and causes errors on certain versions.cuda→npureplacements wheretorch_npu's automatic translation failed to take effect.mindspeed.patch
sglang.patch
fast_pos_embed_interpolate: Fixed thefast_pos_embed_interpolatefunction in the vision model to correct positional embedding interpolation behavior. ([Reference](https://github.com/sgl-project/sglang/pull/19693/changes#diff-ae8ed8a721eecaefcf77446a0f593b7c92d2270cbb1589ceaeea2e2b68981c6cR401-R483))input_deepstack_embedsrevert: Reverted a previous modification toinput_deepstack_embeds, replacing it with the equivalent three-line implementation from upstream. ([Reference](https://github.com/sgl-project/sglang/pull/19693/changes#diff-190683f5c7ffde48eb0ce015d76532f833fe1e122779eae6da8181dbfab3895bR142-R144))slime.patch
is_npu()utility incommon.pyto gate NPU-specific logic throughout the codebase.num_gpus=Ninray.remote/.options()calls withresources={"NPU": N}(or"GPU"on non-NPU), asray.remote(num_gpus=...)is not supported on NPU. Affectsactor_group.py,placement_group.py, androllout.py.ray.get_gpu_ids()withray.get_runtime_context().get_accelerator_ids()["NPU"], with additionalint()casting since the returned values are strings. Affectsplacement_group.py.torch_npucannot auto-translate:nccl→hccl(actor.py,update_weight_from_distributed.py),cuda→npu(memory_utils.py), andCUDA_VISIBLE_DEVICES→ASCEND_RT_VISIBLE_DEVICES(sglang_engine.py).train.pyandactor.py.model_provider.py.grpo raw_reward curve:
