verl icon indicating copy to clipboard operation
verl copied to clipboard

[NPU][one step off] Bug : grpo_qwen3_8b_gsm8k_fsdp2_8_8_npu.sh, Script execution reported an error:NCCL is not available.

Open Allen-Jon opened this issue 11 months ago • 3 comments

System Info

Ascend 910B2 NPU python 3.10

Information

  • [x] The official example scripts
  • [ ] My own modified scripts

Tasks

  • [x] An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • [ ] My own task or dataset (give details below)

Reproduction

recipe/one_step_off_policy/grpo_qwen3_8b_gsm8k_fsdp2_8_8_npu.sh

Hello,Can this script actually run? When I try to run the script on 910B npu,it dose't work.there is the error: ray.exceptions.RayTaskError(RuntimeError): ray::OneStepTaskRunner.run() (pid=2471917, ip=192.168.0.212, actor_id=77f8df4d37ee3143fbb6946701000000, repr=<main_ppo.OneStepTaskRunner object at 0xffcf74348070>) File "/data/zsh/verl-disaggregated/verl/recipe/one_step_off_policy/main_ppo.py", line 214, in run trainer.init_workers() File "/data/zsh/verl-disaggregated/verl/recipe/one_step_off_policy/ray_trainer.py", line 148, in init_workers self._init_models() File "/data/zsh/verl-disaggregated/verl/recipe/one_step_off_policy/ray_trainer.py", line 255, in _init_models self._create_weight_sync_group() File "/data/zsh/verl-disaggregated/verl/recipe/one_step_off_policy/ray_trainer.py", line 265, in _create_weight_sync_group collective.create_collective_group( File "/home/zsh/myenv/lib/python3.10/site-packages/ray/util/collective/collective.py", line 183, in create_collective_group _check_backend_availability(backend) File "/home/zsh/myenv/lib/python3.10/site-packages/ray/util/collective/collective.py", line 753, in _check_backend_availability raise RuntimeError("NCCL is not available.") RuntimeError: NCCL is not available.

The source code that's throwing the error looks like this: def _check_backend_availability(backend: types.Backend): """Check whether the backend is available.""" if backend == types.Backend.GLOO: # Now we have deprecated pygloo, and use torch_gloo in all cases. if not torch_distributed_available(): raise RuntimeError("torch.distributed is not available.") elif backend == types.Backend.NCCL: if not nccl_available(): raise RuntimeError("NCCL is not available.")

Then,followed the error,I find the https://github.com/volcengine/verl/blob/main/recipe/one_step_off_policy/ray_trainer.py,line 258,there is a note:# TODO: NPU support

Image

############################################ So is there a way to run this script on npu correctly?

Expected behavior

Regular training

Allen-Jon avatar Dec 23 '25 09:12 Allen-Jon

Here is my training script:

`export VLLM_ASCEND_ENABLE_NZ=0
export HCCL_EXEC_TIMEOUT=60000
export HCCL_CONNECT_TIMEOUT=7200
export ASCEND_RT_VISIBLE_DEVICES=0,1,3,4
export LD_LIBRARY_PATH=/usr/local/Ascend/nnal/atb/8.1.RC1/atb/cxx_abi_1/lib:$LD_LIBRARY_PATH


export MODEL_PATH=Qwen3-1___7B
export TRAIN_FILE=train.parquet
export TEST_FILE=test.parquet
export CKPTS_DIR=/verl/ckpts/GRPO/GRPO-Qwen3-1.7b-gsm8k-fsdp2-one-step-off-2-2-npu
export HYDRA_FULL_ERROR=1

project_name='GRPO'
exp_name='GRPO-Qwen3-1.7b-gsm8k-fsdp2-one-step-off-2-2-npu'

# Paths
RAY_DATA_HOME=${RAY_DATA_HOME:-"${HOME}/verl"}
MODEL_PATH=${MODEL_PATH:-"${RAY_DATA_HOME}/models/Qwen/Qwen3-1.7B"}
CKPTS_DIR=${CKPTS_DIR:-"${RAY_DATA_HOME}/ckpts/${project_name}/${exp_name}"}
TRAIN_FILE=${TRAIN_FILE:-"${RAY_DATA_HOME}/data/BytedTsinghua-SIA/DAPO-Math-17k"}
TEST_FILE=${TEST_FILE:-"${RAY_DATA_HOME}/data/BytedTsinghua-SIA/DAPO-Math-17k"}

NNODES=1
NGPUS_PER_NODE=4

n_gpus_rollout=2
n_gpus_training=$((NGPUS_PER_NODE - n_gpus_rollout))

max_prompt_length=$((1024 * 2))
max_response_length=$((1024 * 32))

use_dynamic_bsz=True
sp_size=2
fsdp_size=2
actor_ppo_max_token_len=$(((max_prompt_length + max_response_length) / sp_size))
infer_ppo_max_token_len=$(((max_prompt_length + max_response_length) / sp_size))

python3 -m recipe.one_step_off_policy.main_ppo \
    algorithm.adv_estimator=grpo \
    data.train_files="${TRAIN_FILE}" \
    data.val_files="${TEST_FILE}" \
    data.train_batch_size=8 \
    data.max_prompt_length=${max_prompt_length} \
    data.max_response_length=${max_response_length} \
    data.filter_overlong_prompts=True \
    data.filter_overlong_prompts_workers=64 \
    data.truncation='error' \
    actor_rollout_ref.actor.strategy=fsdp \
    critic.strategy=fsdp \
    actor_rollout_ref.model.path="${MODEL_PATH}" \
    actor_rollout_ref.actor.optim.lr=1e-6 \
    actor_rollout_ref.hybrid_engine=False \
    actor_rollout_ref.model.use_remove_padding=True \
    actor_rollout_ref.actor.ppo_mini_batch_size=8 \
    actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=4 \
    actor_rollout_ref.actor.use_kl_loss=False \
    actor_rollout_ref.actor.kl_loss_coef=0.001 \
    actor_rollout_ref.actor.kl_loss_type=low_var_kl \
    actor_rollout_ref.actor.entropy_coeff=0 \
    actor_rollout_ref.actor.use_torch_compile=False \
    actor_rollout_ref.ref.use_torch_compile=False \
    actor_rollout_ref.model.enable_gradient_checkpointing=True \
    actor_rollout_ref.actor.fsdp_config.param_offload=False \
    actor_rollout_ref.actor.fsdp_config.optimizer_offload=False \
    actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=1 \
    actor_rollout_ref.rollout.tensor_model_parallel_size=2 \
    actor_rollout_ref.rollout.name=vllm \
    actor_rollout_ref.rollout.mode=async \
    actor_rollout_ref.rollout.gpu_memory_utilization=0.8 \
    actor_rollout_ref.rollout.max_num_batched_tokens=$((max_prompt_length + max_response_length)) \
    actor_rollout_ref.rollout.n=2 \
    actor_rollout_ref.rollout.enforce_eager=True \
    actor_rollout_ref.rollout.load_format=safetensors \
    actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=4 \
    actor_rollout_ref.ref.fsdp_config.param_offload=False \
    actor_rollout_ref.actor.fsdp_config.fsdp_size=${fsdp_size} \
    actor_rollout_ref.actor.use_dynamic_bsz=${use_dynamic_bsz} \
    actor_rollout_ref.actor.ppo_max_token_len_per_gpu=${actor_ppo_max_token_len} \
    actor_rollout_ref.actor.ulysses_sequence_parallel_size=${sp_size} \
    actor_rollout_ref.ref.log_prob_use_dynamic_bsz=${use_dynamic_bsz} \
    actor_rollout_ref.ref.log_prob_max_token_len_per_gpu=${infer_ppo_max_token_len} \
    actor_rollout_ref.ref.ulysses_sequence_parallel_size=${sp_size} \
    actor_rollout_ref.rollout.log_prob_use_dynamic_bsz=${use_dynamic_bsz} \
    algorithm.use_kl_in_reward=False \
    actor_rollout_ref.nccl_timeout=14400 \
    trainer.critic_warmup=0 \
    trainer.val_before_train=False \
    trainer.logger=['console','tensorboard'] \
    trainer.project_name="${project_name}" \
    trainer.experiment_name="${exp_name}" \
    trainer.default_local_dir=${CKPTS_DIR} \
    trainer.save_freq=10 \
    trainer.test_freq=-1 \
    trainer.total_epochs=15 \
    trainer.resume_mode=auto \
    trainer.nnodes="${NNODES}" \
    trainer.n_gpus_per_node="${n_gpus_training}" \
    rollout.nnodes="${NNODES}" \
    rollout.n_gpus_per_node="${n_gpus_rollout}" $@`

Allen-Jon avatar Dec 23 '25 09:12 Allen-Jon

Please provide your environment information.

1k77 avatar Dec 30 '25 01:12 1k77

Please provide your environment information.

Thanks, I see this bug has been fixed in the latest commit. https://github.com/volcengine/verl/commit/35bf8d9dd0ce07772c86ffed96065de2bd693b9c

Allen-Jon avatar Dec 30 '25 01:12 Allen-Jon