verl icon indicating copy to clipboard operation
verl copied to clipboard

[trainer, vllm, megatron, recipe] feat: one/two step off async on-policy distillation recipe

Open moehanabi opened this issue 1 year ago • 21 comments

What does this PR do?

This PR provides a simple implementation of one and two step off async knowledge distillation with megatron and vllm backend.

Checklist Before Starting

  • [x] Search for similar PRs. Paste at least one query link here: ...
  • [x] Format the PR title as [{modules}] {type}: {description} (This will be checked by the CI)
    • {modules} include fsdp, megatron, sglang, vllm, rollout, trainer, ci, training_utils, recipe, hardware, deployment, ray, worker, single_controller, misc, perf, model, algo, env, tool, ckpt, doc, data
    • If this PR involves multiple modules, separate them with , like [megatron, fsdp, doc]
    • {type} is in feat, fix, refactor, chore, test
    • If this PR breaks any API (CLI arguments, config, function signature, etc.), add [BREAKING] to the beginning of the title.
    • Example: [BREAKING][fsdp, megatron] feat: dynamic batching

Test

For changes that can not be tested by CI (e.g., algorithm implementation, new model support), validate by experiment(s) and show results like training curve plots, evaluation results, etc.

API and Usage Example

Demonstrate how the API changes if any, and provide usage example(s) if possible.

# Add code snippet or script demonstrating how to use this

Design & Code Changes

Demonstrate the high-level design if this PR is complex, and list the specific changes.

Checklist Before Submitting

[!IMPORTANT] Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review.

moehanabi avatar Oct 31 '25 12:10 moehanabi

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Nov 06 '25 08:11 CLAassistant

@moehanabi Thanks for your contribution! It looks a great recipe but do we have any documentation for it? It this an implementation of your work or another existing one?

ISEEKYAN avatar Nov 06 '25 16:11 ISEEKYAN

@moehanabi Thanks for your contribution! It looks a great recipe but do we have any documentation for it? It this an implementation of your work or another existing one?

Thanks for your attention!

I will add a description document in the near future.

This work refers to the asynchronous implementation of one-step-off-policy recipe, completes the function of on-policy distillation, and optimizes some communication time consumption (maybe it can also be submitted to one-step-off-policy recipe in the future if it is also applicable to it).

I wonder if you would like to merge this recipe in the future.

moehanabi avatar Nov 07 '25 03:11 moehanabi

@moehanabi Thanks for your contribution! It looks a great recipe but do we have any documentation for it? It this an implementation of your work or another existing one?

Thanks for your attention!

I will add a description document in the near future.

This work refers to the asynchronous implementation of one-step-off-policy recipe, completes the function of on-policy distillation, and optimizes some communication time consumption (maybe it can also be submitted to one-step-off-policy recipe in the future if it is also applicable to it).

I wonder if you would like to merge this recipe in the future.

Surely we'd like to merge your great work, while a document is necessary to not confuse other developers.

BTW, The authors of the one-step-off-policy have evolve that recipe into fully-async, which is a superset of one-step-off and is native with async patterns. I wonder if that recipe is potential a more suitable basement for your distillation work?

ISEEKYAN avatar Nov 07 '25 04:11 ISEEKYAN

@moehanabi Thanks for your contribution! It looks a great recipe but do we have any documentation for it? It this an implementation of your work or another existing one?

Thanks for your attention! I will add a description document in the near future. This work refers to the asynchronous implementation of one-step-off-policy recipe, completes the function of on-policy distillation, and optimizes some communication time consumption (maybe it can also be submitted to one-step-off-policy recipe in the future if it is also applicable to it). I wonder if you would like to merge this recipe in the future.

Surely we'd like to merge your great work, while a document is necessary to not confuse other developers.

BTW, The authors of the one-step-off-policy have evolve that recipe into fully-async, which is a superset of one-step-off and is native with async patterns. I wonder if that recipe is potential a more suitable basement for your distillation work?

Thanks for your support!

I am glad to investigate the fully-async recipe later and check whether it is suitable for our distillation work. Thanks for your introduction.

moehanabi avatar Nov 07 '25 06:11 moehanabi

/gemini review

moehanabi avatar Nov 07 '25 08:11 moehanabi

/gemini review

@moehanabi Thanks for your contribution! It looks a great recipe but do we have any documentation for it? It this an implementation of your work or another existing one?

Thanks for your attention! I will add a description document in the near future. This work refers to the asynchronous implementation of one-step-off-policy recipe, completes the function of on-policy distillation, and optimizes some communication time consumption (maybe it can also be submitted to one-step-off-policy recipe in the future if it is also applicable to it). I wonder if you would like to merge this recipe in the future.

Surely we'd like to merge your great work, while a document is necessary to not confuse other developers. BTW, The authors of the one-step-off-policy have evolve that recipe into fully-async, which is a superset of one-step-off and is native with async patterns. I wonder if that recipe is potential a more suitable basement for your distillation work?

Thanks for your support!

I am glad to investigate the fully-async recipe later and check whether it is suitable for our distillation work. Thanks for your introduction.

/gemini review

love-cfall avatar Nov 11 '25 09:11 love-cfall

Hello, could you please provide the detailed documentation for gkd? I'm currently encountering some connection issues with the teacher model during reproduction.

love-cfall avatar Nov 11 '25 09:11 love-cfall

Hello, could you please provide the detailed documentation for gkd? I'm currently encountering some connection issues with the teacher model during reproduction.

Hi. Thanks for trying our work!

Which kind of issues did you encountered? Could you provide some err message?

Documentation may be uploaded tommorow if you want to solve by yourself.

moehanabi avatar Nov 11 '25 09:11 moehanabi

Hello, could you please provide the detailed documentation for gkd? I'm currently encountering some connection issues with the teacher model during reproduction.

Hi. Thanks for trying our work!

Which kind of issues did you encountered? Could you provide some err message?

Documentation may be uploaded tommorow if you want to solve by yourself.

I started start_server.sh and found that it keeps showing "wait proxy server ready at 127.0.0.1:15556..." without becoming ready. When I use test_teacher_server.py for testing, it reports a timeout error. When I launch the training script test_qwen.sh, I still cannot get responses from the teacher model Qwen. thank you!

love-cfall avatar Nov 11 '25 11:11 love-cfall

Hello, could you please provide the detailed documentation for gkd? I'm currently encountering some connection issues with the teacher model during reproduction.

Hi. Thanks for trying our work! Which kind of issues did you encountered? Could you provide some err message? Documentation may be uploaded tommorow if you want to solve by yourself.

I started start_server.sh and found that it keeps showing "wait proxy server ready at 127.0.0.1:15556..." without becoming ready. When I use test_teacher_server.py for testing, it reports a timeout error. When I launch the training script test_qwen.sh, I still cannot get responses from the teacher model Qwen. thank you!

Hi, please check if you have installed telnet and your python command is python as in some docker images / os, the default python command is python3

moehanabi avatar Nov 11 '25 11:11 moehanabi

thank you very much! It turns out it was actually the netlet package causing the issue

love-cfall avatar Nov 11 '25 13:11 love-cfall

@moehanabi Thanks for your contribution! It looks a great recipe but do we have any documentation for it? It this an implementation of your work or another existing one?

Thanks for your attention! I will add a description document in the near future. This work refers to the asynchronous implementation of one-step-off-policy recipe, completes the function of on-policy distillation, and optimizes some communication time consumption (maybe it can also be submitted to one-step-off-policy recipe in the future if it is also applicable to it). I wonder if you would like to merge this recipe in the future.

Surely we'd like to merge your great work, while a document is necessary to not confuse other developers.

BTW, The authors of the one-step-off-policy have evolve that recipe into fully-async, which is a superset of one-step-off and is native with async patterns. I wonder if that recipe is potential a more suitable basement for your distillation work?

Hello, could you please provide the detailed documentation for gkd? I'm currently encountering some connection issues with the teacher model during reproduction.

Hello. Thanks for your attention @ISEEKYAN @love-cfall. I have uploaded the document yesterday and support SGLang now. The pictures in document still need to wait for @eric-haibin-lin to accept the pr

moehanabi avatar Nov 13 '25 03:11 moehanabi

Hello, I’m getting an OOM (Out-Of-Memory) error when running the script below on a single node with 8 × 80 GB GPUs. I place the teacher model on GPU-7. Could you please take a look? Here is the script :

#!/usr/bin/env bash set -xeuo pipefail

export MODEL_PATH="deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B" export NVTE_ALLOW_NONDETERMINISTIC_ALGO=0 export NVTE_FLASH_ATTN=1 export NVTE_DEBUG=1 export NVTE_DEBUG_LEVEL=2

gsm8k_train_path=/data/gsm8k/train.parquet gsm8k_test_path=/data/gsm8k/test.parquet train_files=$gsm8k_train_path test_files=$gsm8k_test_path

#run PP=1 TP=1 EP=1 ETP=1 INFER_TP=1

adv_estimator=grpo

use_kl_in_reward=False kl_coef=0.0 use_kl_loss=False kl_loss_coef=0.0

RAY_ADDRESS='auto' ray job submit --working-dir . --

python3 -m recipe.gkd.main_gkd --config-name on_policy_distill_trainer
data.train_files="$train_files"
data.val_files="$test_files"
data.prompt_key=prompt
data.train_batch_size=64
data.max_prompt_length=512
data.max_response_length=1024
data.filter_overlong_prompts=True
data.truncation='error'
data.trust_remote_code=True
+teacher.server_ip=127.0.0.1
+teacher.server_port=15555
actor_rollout_ref.model.path=$MODEL_PATH
actor_rollout_ref.model.trust_remote_code=True
actor_rollout_ref.actor.megatron.sequence_parallel=False
+actor_rollout_ref.actor.megatron.override_transformer_config.sequence_parallel=False
actor_rollout_ref.actor.optim.lr=1e-6
+actor_rollout_ref.actor.ppo_mini_batch_size=64
+actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=1
+actor_rollout_ref.actor.use_kl_loss=False
actor_rollout_ref.actor.use_torch_compile=False
actor_rollout_ref.rollout.name=vllm
actor_rollout_ref.rollout.gpu_memory_utilization=0.8
actor_rollout_ref.rollout.temperature=1.0
actor_rollout_ref.rollout.top_p=0.99
actor_rollout_ref.rollout.top_k=-1
actor_rollout_ref.rollout.tensor_model_parallel_size=$INFER_TP
actor_rollout_ref.rollout.load_format='auto'
+algorithm.use_kl_in_reward=False
trainer.logger=['console']
trainer.project_name='verl_onpolicy'
trainer.experiment_name='qwen-distill'
trainer.n_gpus_per_node=4
trainer.nnodes=1
trainer.save_freq=80
trainer.test_freq=25
actor_rollout_ref.actor.megatron.pipeline_model_parallel_size=$PP
actor_rollout_ref.actor.megatron.tensor_model_parallel_size=$TP
actor_rollout_ref.actor.megatron.expert_model_parallel_size=$EP
actor_rollout_ref.actor.megatron.expert_tensor_parallel_size=$ETP
trainer.val_before_train=False
trainer.total_training_steps=400
trainer.total_epochs=3 $@

the error:torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 26.00 MiB. GPU 0 has a total capacity of 79.32 GiB of which 23.75 MiB is free. Process 2604735 has 58.89 GiB memory in use. Process 3192223 has 20.40 GiB memory in use. Of the allocated memory 14.56 GiB is allocated by PyTorch, and 229.50 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)

love-cfall avatar Nov 13 '25 09:11 love-cfall

Hello, I’m getting an OOM (Out-Of-Memory) error when running the script below on a single node with 8 × 80 GB GPUs. I place the teacher model on GPU-7. Could you please take a look? Here is the script :

#!/usr/bin/env bash set -xeuo pipefail

export MODEL_PATH="deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B" export NVTE_ALLOW_NONDETERMINISTIC_ALGO=0 export NVTE_FLASH_ATTN=1 export NVTE_DEBUG=1 export NVTE_DEBUG_LEVEL=2

gsm8k_train_path=/data/gsm8k/train.parquet gsm8k_test_path=/data/gsm8k/test.parquet train_files=$gsm8k_train_path test_files=$gsm8k_test_path

#run PP=1 TP=1 EP=1 ETP=1 INFER_TP=1

adv_estimator=grpo

use_kl_in_reward=False kl_coef=0.0 use_kl_loss=False kl_loss_coef=0.0

RAY_ADDRESS='auto' ray job submit --working-dir . --

python3 -m recipe.gkd.main_gkd --config-name on_policy_distill_trainer data.train_files="$train_files" data.val_files="$test_files" data.prompt_key=prompt data.train_batch_size=64 data.max_prompt_length=512 data.max_response_length=1024 data.filter_overlong_prompts=True data.truncation='error' data.trust_remote_code=True +teacher.server_ip=127.0.0.1 +teacher.server_port=15555 actor_rollout_ref.model.path=$MODEL_PATH actor_rollout_ref.model.trust_remote_code=True actor_rollout_ref.actor.megatron.sequence_parallel=False +actor_rollout_ref.actor.megatron.override_transformer_config.sequence_parallel=False actor_rollout_ref.actor.optim.lr=1e-6 +actor_rollout_ref.actor.ppo_mini_batch_size=64 +actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=1 +actor_rollout_ref.actor.use_kl_loss=False actor_rollout_ref.actor.use_torch_compile=False actor_rollout_ref.rollout.name=vllm actor_rollout_ref.rollout.gpu_memory_utilization=0.8 actor_rollout_ref.rollout.temperature=1.0 actor_rollout_ref.rollout.top_p=0.99 actor_rollout_ref.rollout.top_k=-1 actor_rollout_ref.rollout.tensor_model_parallel_size=$INFER_TP actor_rollout_ref.rollout.load_format='auto' +algorithm.use_kl_in_reward=False trainer.logger=['console'] trainer.project_name='verl_onpolicy' trainer.experiment_name='qwen-distill' trainer.n_gpus_per_node=4 trainer.nnodes=1 trainer.save_freq=80 trainer.test_freq=25 actor_rollout_ref.actor.megatron.pipeline_model_parallel_size=$PP actor_rollout_ref.actor.megatron.tensor_model_parallel_size=$TP actor_rollout_ref.actor.megatron.expert_model_parallel_size=$EP actor_rollout_ref.actor.megatron.expert_tensor_parallel_size=$ETP trainer.val_before_train=False trainer.total_training_steps=400 trainer.total_epochs=3 $@

the error:torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 26.00 MiB. GPU 0 has a total capacity of 79.32 GiB of which 23.75 MiB is free. Process 2604735 has 58.89 GiB memory in use. Process 3192223 has 20.40 GiB memory in use. Of the allocated memory 14.56 GiB is allocated by PyTorch, and 229.50 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)

Hello, thanks for trying our work. I noticed that you have set

trainer.n_gpus_per_node=4
trainer.nnodes=1 

but have not set rollout nnodes and n_gpus_per_node in your script, which is set to 1 and 4 as default value in recipe/gkd/config/on_policy_distill_trainer.yaml.

So if you started a teacher server in GPU-7, it may occupy some cuda memory of rollout or actor. I suggest that reduce trainer.n_gpus_per_node or rollout.n_gpus_per_node and then use CUDA_VISIBLE_DEVICES env in recipe/gkd/config/runtime_env.yaml to avoid ray to use GPU-7.

moehanabi avatar Nov 13 '25 11:11 moehanabi

Hello, I’m getting an OOM (Out-Of-Memory) error when running the script below on a single node with 8 × 80 GB GPUs. I place the teacher model on GPU-7. Could you please take a look? Here is the script : #!/usr/bin/env bash set -xeuo pipefail export MODEL_PATH="deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B" export NVTE_ALLOW_NONDETERMINISTIC_ALGO=0 export NVTE_FLASH_ATTN=1 export NVTE_DEBUG=1 export NVTE_DEBUG_LEVEL=2 gsm8k_train_path=/data/gsm8k/train.parquet gsm8k_test_path=/data/gsm8k/test.parquet train_files=$gsm8k_train_path test_files=$gsm8k_test_path #run PP=1 TP=1 EP=1 ETP=1 INFER_TP=1 adv_estimator=grpo use_kl_in_reward=False kl_coef=0.0 use_kl_loss=False kl_loss_coef=0.0

RAY_ADDRESS='auto' ray job submit --working-dir . --

python3 -m recipe.gkd.main_gkd --config-name on_policy_distill_trainer data.train_files="$train_files" data.val_files="$test_files" data.prompt_key=prompt data.train_batch_size=64 data.max_prompt_length=512 data.max_response_length=1024 data.filter_overlong_prompts=True data.truncation='error' data.trust_remote_code=True +teacher.server_ip=127.0.0.1 +teacher.server_port=15555 actor_rollout_ref.model.path=$MODEL_PATH actor_rollout_ref.model.trust_remote_code=True actor_rollout_ref.actor.megatron.sequence_parallel=False +actor_rollout_ref.actor.megatron.override_transformer_config.sequence_parallel=False actor_rollout_ref.actor.optim.lr=1e-6 +actor_rollout_ref.actor.ppo_mini_batch_size=64 +actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=1 +actor_rollout_ref.actor.use_kl_loss=False actor_rollout_ref.actor.use_torch_compile=False actor_rollout_ref.rollout.name=vllm actor_rollout_ref.rollout.gpu_memory_utilization=0.8 actor_rollout_ref.rollout.temperature=1.0 actor_rollout_ref.rollout.top_p=0.99 actor_rollout_ref.rollout.top_k=-1 actor_rollout_ref.rollout.tensor_model_parallel_size=$INFER_TP actor_rollout_ref.rollout.load_format='auto' +algorithm.use_kl_in_reward=False trainer.logger=['console'] trainer.project_name='verl_onpolicy' trainer.experiment_name='qwen-distill' trainer.n_gpus_per_node=4 trainer.nnodes=1 trainer.save_freq=80 trainer.test_freq=25 actor_rollout_ref.actor.megatron.pipeline_model_parallel_size=$PP actor_rollout_ref.actor.megatron.tensor_model_parallel_size=$TP actor_rollout_ref.actor.megatron.expert_model_parallel_size=$EP actor_rollout_ref.actor.megatron.expert_tensor_parallel_size=$ETP trainer.val_before_train=False trainer.total_training_steps=400 trainer.total_epochs=3 $@ the error:torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 26.00 MiB. GPU 0 has a total capacity of 79.32 GiB of which 23.75 MiB is free. Process 2604735 has 58.89 GiB memory in use. Process 3192223 has 20.40 GiB memory in use. Of the allocated memory 14.56 GiB is allocated by PyTorch, and 229.50 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)

Hello, thanks for trying our work. I noticed that you have set

trainer.n_gpus_per_node=4
trainer.nnodes=1 

but have not set rollout nnodes and n_gpus_per_node in your script, which is set to 1 and 4 as default value in recipe/gkd/config/on_policy_distill_trainer.yaml.

So if you started a teacher server in GPU-7, it may occupy some cuda memory of rollout or actor. I suggest that reduce trainer.n_gpus_per_node or rollout.n_gpus_per_node and then use CUDA_VISIBLE_DEVICES env in recipe/gkd/config/runtime_env.yaml to avoid ray to use GPU-7.

Thanks! The issue is resolved now 😊

love-cfall avatar Nov 13 '25 12:11 love-cfall

Hello,after I started the code, I encountered this issue. Teacher request failed: Teacher error: Generate failed: '>' not supported between instances of 'list' and 'int' after I adapted the code to the latest vLLM (0.10.2), the vLLM engine works fine for inference, but I encountered a new issue. Traceback (most recent call last): File "/opt/miniconda/envs/verl/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/opt/miniconda/envs/verl/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/main_gkd.py", line 229, in main() File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/main.py", line 94, in decorated_main _run_hydra( File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/_internal/utils.py", line 394, in _run_hydra _run_app( File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/_internal/utils.py", line 457, in _run_app run_and_report( File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/_internal/utils.py", line 223, in run_and_report raise ex File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/_internal/utils.py", line 220, in run_and_report return func() File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/_internal/utils.py", line 458, in lambda: hydra.run( File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/_internal/hydra.py", line 132, in run _ = ret.return_value File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/core/utils.py", line 260, in return_value raise self._return_value File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/core/utils.py", line 186, in run_job ret.return_value = task_function(task_cfg) File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/main_gkd.py", line 52, in main run_on_policy_distill(config) File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/main_gkd.py", line 90, in run_on_policy_distill ray.get(runner.run.remote(config)) File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/ray/_private/auto_init_hook.py", line 22, in auto_init_wrapper return fn(*args, **kwargs) File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/ray/_private/client_mode_hook.py", line 104, in wrapper return func(*args, **kwargs) File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/ray/_private/worker.py", line 2882, in get values, debugger_breakpoint = worker.get_objects(object_refs, timeout=timeout) File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/ray/_private/worker.py", line 968, in get_objects raise value.as_instanceof_cause() ray.exceptions.RayTaskError(AssertionError): ray::TaskRunner.run() (pid=48593, ip=172.22.26.17, actor_id=0b175f7dd5ef2f3ff9bfeed406000000, repr=<main_gkd.TaskRunner object at 0x7f6e9c4672b0>) File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/main_gkd.py", line 225, in run trainer.fit() File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/ray_trainer.py", line 592, in fit _, batch, gen_batch_output, teacher_batch_output, schedule_timing = next(scheduler) File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/ray_trainer.py", line 421, in one_step_off_scheduler fut = self._async_gen_next_batch(epoch, batch_dict) File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/ray_trainer.py", line 366, in _async_gen_next_batch gen_batch_output = self.rollout_wg.async_generate_sequences(gen_batch) File "/home/zibing.wei/code/github/moehanabi/verl/verl/single_controller/ray/base.py", line 44, in call args, kwargs = dispatch_fn(self, *args, **kwargs) File "/home/zibing.wei/code/github/moehanabi/verl/verl/single_controller/base/decorator.py", line 290, in dispatch_lazy_compute_data_proto return dispatch_nd_compute_dataproto(dp_rank_mapping, dp_size, worker_group, *args, **kwargs) File "/home/zibing.wei/code/github/moehanabi/verl/verl/single_controller/base/decorator.py", line 260, in dispatch_nd_compute_dataproto splitted_args, splitted_kwargs = _split_args_kwargs_data_proto(dp_size, *args, **kwargs) File "/home/zibing.wei/code/github/moehanabi/verl/verl/single_controller/base/decorator.py", line 78, in _split_args_kwargs_data_proto splitted_args.append(arg.chunk(chunks=chunks)) File "/home/zibing.wei/code/github/moehanabi/verl/verl/protocol.py", line 881, in chunk assert len(self) % chunks == 0, ( AssertionError: only support equal chunk. Got size of DataProto 1 and chunk 2. Training Progress: 0%| | 0/10 [00:02<?, ?it/s]

Jim2016713 avatar Nov 14 '25 10:11 Jim2016713

Hello,after I started the code, I encountered this issue. Teacher request failed: Teacher error: Generate failed: '>' not supported between instances of 'list' and 'int' after I adapted the code to the latest vLLM (0.10.2), the vLLM engine works fine for inference, but I encountered a new issue. Traceback (most recent call last): File "/opt/miniconda/envs/verl/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/opt/miniconda/envs/verl/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/main_gkd.py", line 229, in main() File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/main.py", line 94, in decorated_main _run_hydra( File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/_internal/utils.py", line 394, in _run_hydra _run_app( File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/_internal/utils.py", line 457, in _run_app run_and_report( File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/_internal/utils.py", line 223, in run_and_report raise ex File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/_internal/utils.py", line 220, in run_and_report return func() File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/_internal/utils.py", line 458, in lambda: hydra.run( File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/_internal/hydra.py", line 132, in run _ = ret.return_value File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/core/utils.py", line 260, in return_value raise self._return_value File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/core/utils.py", line 186, in run_job ret.return_value = task_function(task_cfg) File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/main_gkd.py", line 52, in main run_on_policy_distill(config) File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/main_gkd.py", line 90, in run_on_policy_distill ray.get(runner.run.remote(config)) File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/ray/_private/auto_init_hook.py", line 22, in auto_init_wrapper return fn(*args, **kwargs) File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/ray/_private/client_mode_hook.py", line 104, in wrapper return func(*args, **kwargs) File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/ray/_private/worker.py", line 2882, in get values, debugger_breakpoint = worker.get_objects(object_refs, timeout=timeout) File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/ray/_private/worker.py", line 968, in get_objects raise value.as_instanceof_cause() ray.exceptions.RayTaskError(AssertionError): ray::TaskRunner.run() (pid=48593, ip=172.22.26.17, actor_id=0b175f7dd5ef2f3ff9bfeed406000000, repr=<main_gkd.TaskRunner object at 0x7f6e9c4672b0>) File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/main_gkd.py", line 225, in run trainer.fit() File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/ray_trainer.py", line 592, in fit _, batch, gen_batch_output, teacher_batch_output, schedule_timing = next(scheduler) File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/ray_trainer.py", line 421, in one_step_off_scheduler fut = self._async_gen_next_batch(epoch, batch_dict) File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/ray_trainer.py", line 366, in _async_gen_next_batch gen_batch_output = self.rollout_wg.async_generate_sequences(gen_batch) File "/home/zibing.wei/code/github/moehanabi/verl/verl/single_controller/ray/base.py", line 44, in call args, kwargs = dispatch_fn(self, *args, **kwargs) File "/home/zibing.wei/code/github/moehanabi/verl/verl/single_controller/base/decorator.py", line 290, in dispatch_lazy_compute_data_proto return dispatch_nd_compute_dataproto(dp_rank_mapping, dp_size, worker_group, *args, **kwargs) File "/home/zibing.wei/code/github/moehanabi/verl/verl/single_controller/base/decorator.py", line 260, in dispatch_nd_compute_dataproto splitted_args, splitted_kwargs = _split_args_kwargs_data_proto(dp_size, *args, **kwargs) File "/home/zibing.wei/code/github/moehanabi/verl/verl/single_controller/base/decorator.py", line 78, in _split_args_kwargs_data_proto splitted_args.append(arg.chunk(chunks=chunks)) File "/home/zibing.wei/code/github/moehanabi/verl/verl/protocol.py", line 881, in chunk assert len(self) % chunks == 0, ( AssertionError: only support equal chunk. Got size of DataProto 1 and chunk 2. Training Progress: 0%| | 0/10 [00:02<?, ?it/s]

Hi. Please check your batch size. I don't know your config but if you don't use any parallel set, batch_size % (nnodes * n_gpus_per_node) should be 0. Just try double your batch_size.

Besides, I don't know which vllm version is suitable for you but i use vllm 0.9.2

moehanabi avatar Nov 14 '25 10:11 moehanabi

Hello,after I started the code, I encountered this issue. Teacher request failed: Teacher error: Generate failed: '>' not supported between instances of 'list' and 'int' after I adapted the code to the latest vLLM (0.10.2), the vLLM engine works fine for inference, but I encountered a new issue. Traceback (most recent call last): File "/opt/miniconda/envs/verl/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/opt/miniconda/envs/verl/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/main_gkd.py", line 229, in main() File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/main.py", line 94, in decorated_main _run_hydra( File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/_internal/utils.py", line 394, in _run_hydra _run_app( File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/_internal/utils.py", line 457, in _run_app run_and_report( File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/_internal/utils.py", line 223, in run_and_report raise ex File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/_internal/utils.py", line 220, in run_and_report return func() File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/_internal/utils.py", line 458, in lambda: hydra.run( File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/_internal/hydra.py", line 132, in run _ = ret.return_value File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/core/utils.py", line 260, in return_value raise self._return_value File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/hydra/core/utils.py", line 186, in run_job ret.return_value = task_function(task_cfg) File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/main_gkd.py", line 52, in main run_on_policy_distill(config) File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/main_gkd.py", line 90, in run_on_policy_distill ray.get(runner.run.remote(config)) File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/ray/_private/auto_init_hook.py", line 22, in auto_init_wrapper return fn(*args, **kwargs) File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/ray/_private/client_mode_hook.py", line 104, in wrapper return func(*args, **kwargs) File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/ray/_private/worker.py", line 2882, in get values, debugger_breakpoint = worker.get_objects(object_refs, timeout=timeout) File "/opt/miniconda/envs/verl/lib/python3.10/site-packages/ray/_private/worker.py", line 968, in get_objects raise value.as_instanceof_cause() ray.exceptions.RayTaskError(AssertionError): ray::TaskRunner.run() (pid=48593, ip=172.22.26.17, actor_id=0b175f7dd5ef2f3ff9bfeed406000000, repr=<main_gkd.TaskRunner object at 0x7f6e9c4672b0>) File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/main_gkd.py", line 225, in run trainer.fit() File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/ray_trainer.py", line 592, in fit _, batch, gen_batch_output, teacher_batch_output, schedule_timing = next(scheduler) File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/ray_trainer.py", line 421, in one_step_off_scheduler fut = self._async_gen_next_batch(epoch, batch_dict) File "/home/zibing.wei/code/github/moehanabi/verl/recipe/gkd/ray_trainer.py", line 366, in _async_gen_next_batch gen_batch_output = self.rollout_wg.async_generate_sequences(gen_batch) File "/home/zibing.wei/code/github/moehanabi/verl/verl/single_controller/ray/base.py", line 44, in call args, kwargs = dispatch_fn(self, *args, **kwargs) File "/home/zibing.wei/code/github/moehanabi/verl/verl/single_controller/base/decorator.py", line 290, in dispatch_lazy_compute_data_proto return dispatch_nd_compute_dataproto(dp_rank_mapping, dp_size, worker_group, *args, **kwargs) File "/home/zibing.wei/code/github/moehanabi/verl/verl/single_controller/base/decorator.py", line 260, in dispatch_nd_compute_dataproto splitted_args, splitted_kwargs = _split_args_kwargs_data_proto(dp_size, *args, **kwargs) File "/home/zibing.wei/code/github/moehanabi/verl/verl/single_controller/base/decorator.py", line 78, in _split_args_kwargs_data_proto splitted_args.append(arg.chunk(chunks=chunks)) File "/home/zibing.wei/code/github/moehanabi/verl/verl/protocol.py", line 881, in chunk assert len(self) % chunks == 0, ( AssertionError: only support equal chunk. Got size of DataProto 1 and chunk 2. Training Progress: 0%| | 0/10 [00:02<?, ?it/s]

Hi. Please check your batch size. I don't know your config but if you don't use any parallel set, batch_size % (nnodes * n_gpus_per_node) should be 0. Just try double your batch_size.

Besides, I don't know which vllm version is suitable for you but i use vllm 0.9.2

Can you please make clear desciption about the recipe scripts?

haichuan1221 avatar Nov 24 '25 11:11 haichuan1221

Hi @ISEEKYAN . I have added mbridge weight sync support, and done more optimization for weight sync (when mbridge disabled).

Could you please tell what blocked the pr to merge if there is?

Thanks for your review.

moehanabi avatar Dec 01 '25 12:12 moehanabi