-
Notifications
You must be signed in to change notification settings - Fork 153
feat(retool): add RL training script for Qwen3.5 on NPU (Ascend). #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
luoshijiang
wants to merge
8
commits into
verl-project:main
Choose a base branch
from
luoshijiang:add-qwen35-retool-dapo-npu-script
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c94033f
feat(retool): add retool DAPO training script for Qwen3.5 model on NP…
luoshijiang 111dfe3
Update retool/run_qwen35-9b_dapo_npu.sh
luoshijiang d310d7a
Update retool/run_qwen35-9b_dapo_npu.sh
luoshijiang b9fb13f
Update retool/run_qwen35-9b_dapo_npu.sh
luoshijiang 2feb24e
Update retool/run_qwen35-9b_dapo_npu.sh
luoshijiang 88d673d
Update retool/run_qwen35-9b_dapo_npu.sh
luoshijiang 7b71761
Update retool/run_qwen35-9b_dapo_npu.sh
luoshijiang a0d0d92
Update retool/run_qwen35-9b_dapo_npu.sh
luoshijiang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| set -x | ||
|
|
||
| # echo "127.0.0.1 localhost" >> /etc/hosts # Add localhost for container environments if needed | ||
| export VLLM_USE_V1=1 | ||
| export TORCHDYNAMO_DISABLE=1 | ||
| export VLLM_ASCEND_ENABLE_NZ=0 | ||
| export TASK_QUEUE_ENABLE=1 | ||
| export VLLM_ENABLE_GRAPH_MODE=1 | ||
| export HCCL_OP_EXPANSION_MODE="AIV" | ||
| # export ASCEND_RT_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 # Specify NPU_IDs if needed | ||
|
|
||
| # ================= data/model/tool ================= | ||
| HDFS_ROOT=${HDFS_ROOT:-$PWD} | ||
| DATA_ROOT=${DATA_ROOT:-$PWD} | ||
|
luoshijiang marked this conversation as resolved.
|
||
|
|
||
| dapo_math_17k=$DATA_ROOT/dataset/BytedTsinghua-SIA/DAPO-Math-17k | ||
| aime_2024=$DATA_ROOT/dataset/Maxwell-Jia/AIME_2024 | ||
| model_path=$HDFS_ROOT/checkpoint/multiturn-sft-qwen-3.5-9b/global_step_372/huggingface | ||
|
|
||
| train_files="['$dapo_math_17k']" | ||
| test_files="['$aime_2024']" | ||
|
|
||
| # tool | ||
| tool_config_path=verl-recipe/retool/sandbox_fusion_tool_config.yaml | ||
|
luoshijiang marked this conversation as resolved.
Outdated
|
||
|
|
||
| # wandb | ||
| project_name=retool | ||
| experiment_name=qwen3.5-9b_dapo_npu | ||
| default_local_dir=$DATA_ROOT/ckpts/$experiment_name | ||
|
|
||
| # ================= algorithm ================= | ||
| adv_estimator=grpo | ||
|
|
||
| use_kl_in_reward=False | ||
| kl_coef=0.0 | ||
| use_kl_loss=False | ||
| kl_loss_coef=0.0 | ||
|
|
||
| clip_ratio_low=0.2 | ||
| clip_ratio_high=0.28 | ||
|
|
||
| max_turns=16 | ||
| max_prompt_length=2048 | ||
| max_response_length=16384 | ||
| actor_lr=1e-6 | ||
|
|
||
| train_batch_size=32 | ||
| ppo_mini_batch_size=16 | ||
| n_resp_per_prompt=16 | ||
| n_resp_per_prompt_val=16 | ||
|
|
||
| # ================= perfomance ================= | ||
| infer_tp=4 # vllm | ||
| train_sp=4 # train | ||
| offload=True | ||
|
|
||
| actor_max_token_len_per_gpu=$(( (max_prompt_length + max_response_length) * 1 )) | ||
| log_prob_max_token_len_per_gpu=$(( actor_max_token_len_per_gpu * 4 )) | ||
|
|
||
| python3 -m verl.trainer.main_ppo \ | ||
| algorithm.adv_estimator=$adv_estimator \ | ||
| algorithm.use_kl_in_reward=$use_kl_in_reward \ | ||
| algorithm.kl_ctrl.kl_coef=$kl_coef \ | ||
| data.train_files="$train_files" \ | ||
| data.val_files="$test_files" \ | ||
| data.return_raw_chat=True \ | ||
| data.train_batch_size=$train_batch_size \ | ||
| data.max_prompt_length=$max_prompt_length \ | ||
| data.max_response_length=$max_response_length \ | ||
| data.filter_overlong_prompts=True \ | ||
| data.truncation='error' \ | ||
| data.custom_cls.path=verl-recipe/retool/retool.py \ | ||
| data.custom_cls.name=CustomRLHFDataset \ | ||
| custom_reward_function.path=verl-recipe/retool/retool.py \ | ||
|
luoshijiang marked this conversation as resolved.
Outdated
|
||
| custom_reward_function.name=compute_score \ | ||
| actor_rollout_ref.model.path=$model_path \ | ||
|
luoshijiang marked this conversation as resolved.
Outdated
|
||
| actor_rollout_ref.model.use_remove_padding=True \ | ||
| actor_rollout_ref.model.enable_gradient_checkpointing=True \ | ||
| actor_rollout_ref.actor.use_kl_loss=$use_kl_loss \ | ||
| actor_rollout_ref.actor.kl_loss_coef=$kl_loss_coef \ | ||
| actor_rollout_ref.actor.clip_ratio_low=$clip_ratio_low \ | ||
| actor_rollout_ref.actor.clip_ratio_high=$clip_ratio_high \ | ||
| actor_rollout_ref.actor.clip_ratio_c=10.0 \ | ||
| actor_rollout_ref.actor.optim.lr=$actor_lr \ | ||
| actor_rollout_ref.actor.use_dynamic_bsz=True \ | ||
| actor_rollout_ref.actor.ppo_mini_batch_size=$ppo_mini_batch_size \ | ||
| actor_rollout_ref.actor.ppo_max_token_len_per_gpu=$actor_max_token_len_per_gpu \ | ||
| actor_rollout_ref.actor.ulysses_sequence_parallel_size=$train_sp \ | ||
| actor_rollout_ref.actor.fsdp_config.param_offload=$offload \ | ||
| actor_rollout_ref.actor.fsdp_config.optimizer_offload=$offload \ | ||
| actor_rollout_ref.ref.log_prob_max_token_len_per_gpu=$log_prob_max_token_len_per_gpu \ | ||
| actor_rollout_ref.rollout.name=vllm \ | ||
| actor_rollout_ref.rollout.mode=async \ | ||
| actor_rollout_ref.rollout.max_num_seqs=256 \ | ||
| actor_rollout_ref.rollout.tensor_model_parallel_size=$infer_tp \ | ||
| actor_rollout_ref.rollout.multi_turn.enable=True \ | ||
| actor_rollout_ref.rollout.multi_turn.max_user_turns=$max_turns \ | ||
| actor_rollout_ref.rollout.multi_turn.max_assistant_turns=$max_turns \ | ||
| actor_rollout_ref.rollout.multi_turn.tool_config_path=$tool_config_path \ | ||
|
luoshijiang marked this conversation as resolved.
Outdated
|
||
| actor_rollout_ref.rollout.multi_turn.format=hermes \ | ||
| actor_rollout_ref.rollout.gpu_memory_utilization=0.7 \ | ||
| actor_rollout_ref.rollout.n=$n_resp_per_prompt \ | ||
| actor_rollout_ref.rollout.val_kwargs.top_p=0.6 \ | ||
| actor_rollout_ref.rollout.val_kwargs.temperature=1.0 \ | ||
| actor_rollout_ref.rollout.val_kwargs.n=$n_resp_per_prompt_val \ | ||
| actor_rollout_ref.rollout.enable_chunked_prefill=False \ | ||
| actor_rollout_ref.rollout.enforce_eager=False \ | ||
| actor_rollout_ref.actor.entropy_checkpointing=True \ | ||
| actor_rollout_ref.ref.entropy_checkpointing=True \ | ||
| actor_rollout_ref.actor.entropy_from_logits_with_chunking=True \ | ||
| actor_rollout_ref.ref.entropy_from_logits_with_chunking=True \ | ||
| actor_rollout_ref.actor.use_torch_compile=False \ | ||
| actor_rollout_ref.ref.use_torch_compile=False \ | ||
| trainer.logger=['console'] \ | ||
| trainer.project_name=$project_name \ | ||
| trainer.experiment_name=$experiment_name \ | ||
| trainer.n_gpus_per_node=8 \ | ||
| trainer.val_before_train=False \ | ||
| trainer.log_val_generations=20 \ | ||
| trainer.nnodes=1 \ | ||
| trainer.device=npu \ | ||
| trainer.save_freq=20 \ | ||
| trainer.default_local_dir=$default_local_dir \ | ||
|
luoshijiang marked this conversation as resolved.
Outdated
|
||
| trainer.test_freq=10 \ | ||
| trainer.total_epochs=1 $@ | ||
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.
Uh oh!
There was an error while loading. Please reload this page.