Add Ascend NPU Support for Trinity-RFT#605
Conversation
|
/unittest-all |
| # from torch.distributed.distributed_c10d import is_nccl_available | ||
|
|
||
| assert is_nccl_available() | ||
| # assert is_nccl_available() |
| self.pg = placement_group( | ||
| self.bundle_result.bundles, | ||
| strategy="PACK", | ||
| strategy="STRICT_PACK", |
There was a problem hiding this comment.
STRICT_PACK will cause all rollout models to use only one node, please use PACK instead
| "offline": "checkpoint", | ||
| } | ||
|
|
||
| @staticmethod |
There was a problem hiding this comment.
name_aliases are only used for backward compatibility, just keep it as it was.
598b279 to
27573a4
Compare
|
/unittest-all |
1 similar comment
|
/unittest-all |
unittest: Run #1840
🎉 All tests passed!Github Test Reporter by CTRF 💚 |
27573a4 to
ed3d593
Compare
|
/unittest-all |
|
The current implementation does not have a |
Thank you for your review. We have noted the failed unit test cases in the CI workflow. We are currently investigating the issues, within our internal GPU environment. We also set up external access to NPU resources. If you require access to an NPU environment for further verification or collaboration, please let us know your preferred instant messaging account (e.g., DingTalk) so we can coordinate with you directly. |
Add Native Ascend NPU Support to Trinity-RFT
Summary
This PR adds native Huawei Ascend NPU (910B and above) support to Trinity-RFT as a first-class backend, alongside the existing CUDA backend. With this change,
trinity run --config <yaml>launches end-to-end (Ray + vLLM rollout + verl FSDP trainer) on an NPU-only cluster without forking the codebase.All changes are fully backward-compatible — GPU users see no behavior change. The NPU path is gated behind a device abstraction layer (
trinity/utils/device.py) that auto-detects the runtime device and returns the correct Ray resource key, collective backend, and torch device name.Validated on Trinity-RFT 0.5.2 with the software stack listed below.
Validated Software Stack
All components below were installed in a single conda environment (
trinity) and verified end-to-end on Ascend 910B3./home/cann/cann851/ascend-toolkit/set_env.shtorch_npuNPU Test Results
Full test suite executed on Ascend 910B3 (CANN 8.5.1, 8 NPUs, conda env
trinity). Summary: 225 passed / 11 failed / 4 skipped out of 240 cases. All failures are environment/version issues, not code bugs introduced by this PR.tests/algorithm/advantage_fn_test.pytests/algorithm/kl_fn_test.pytests/algorithm/policy_loss_test.pytests/buffer/experience_pipeline_test.pytests/buffer/experience_storage_test.pytests/buffer/file_test.pytests/buffer/formatter_test.pytests/buffer/queue_test.pytests/buffer/reader_test.pytests/buffer/reward_shaping_mapper_test.pytests/buffer/sample_strategy_test.pytests/buffer/sql_test.pytests/buffer/task_scheduler_test.pytests/buffer/task_storage_test.pytests/cli/launcher_test.pytests/common/config_test.pytests/common/experience_test.pytests/common/sudoku_test.pytests/common/models/utils_test.pytest_normal_conversation_data,test_no_assistant_messages,test_first_message_is_assistant: tokenizer version drift — snapshot tests hardcode exact token counts,transformersupgrade shifted tokenization results (pre-existing, not PR-introduced).tests/common/external_model_test.pytests/common/vllm_test.pyTestModelLen_0/1/2::test_model_len(3),TestModelLenWithoutPromptTruncation::test_model_len(1):max_prompt_tokens/max_response_tokensdeprecated in vLLM > 0.16.0, no longer passed toSamplingParams; OpenAI API path doesn't honor these params either.TestLogprobs::test_logprobs_api(1): NPU precision divergence inprompt_logprobswhen temperature ≠ 1.0 (rtol=0.5 still fails).TestAPIServerToolCall_0_deepseek_r1::test_api_tool_calls(1): Qwen2.5-0.5B lacks<think>tokens; Qwen3.5 usesqwen3_5arch unsupported by transformers 4.57.6.TestTinkerAPI::test_tinker_api(1):tinkerproprietary package not installed.TestTinkerAsyncAPIServer::test_api_asyncskipped (noTINKER_API_KEY).tests/explorer/explorer_test.pytests/explorer/proxy_test.pytests/explorer/scheduler_test.pytests/explorer/step_wise_workflow_test.pytests/explorer/workflow_test.pytests/manager/log_manager_test.pytests/manager/synchronizer_test.pytests/service/data_juicer_test.pytests/utils/eval_utils_test.pytests/utils/log_test.pytests/utils/plugin_test.pytests/utils/registry_test.pytests/utils/swanlab_test.pytests/trainer/trainer_test.pycritic.strategy = "megatron"), which is not yet supported on NPU — see ToDo. Other 22 cases pass, 2 skipped.Failure Category Breakdown
transformersupgrade shifted results.max_prompt_tokens/max_response_tokensdeprecated in vLLM > 0.16.0.prompt_logprobsat temperature ≠ 1.0 (rtol=0.5 still fails).<think>tokens; Qwen3.5 arch unsupported by transformers 4.57.6;tinkerpackage not installed (includes 1 undocumented vLLM failure).tests/trainer/trainer_test.pycases withcritic.strategy = "megatron"; Megatron backend adaptation is tracked in ToDo.Total: 14 unfixed — all environment/version/backend-scope issues, none caused by this PR.
Environment Setup
Ascend NPU users set (CUDA users do nothing):
NPU users disable
torch.compilein YAML:ToDo
Checklist
Please check the following items before code is ready to be reviewed.