deepeyes的recipe的bug
System Info
首先一个deepeyes代码中的一个问题 recipe/deepeyes/deepeyes.py:line 74
class CustomRLHFDataset(RLHFDataset):
def __getitem__(self, item):
"""
Note that we also return the raw_input_ids so that it can be combined with other chat template
"""
row_dict: dict = self.dataframe[item]
row_dict[self.prompt_key] = [
{
"role": "system",
# We don't need tool description, because custom_chat_template will add it.
"content": (
"You are a helpful assistant. You can call functions to assist with the user query. "
"Important: You must call only one function at a time. After each function call, "
"wait for the execution result before making the next function call if needed."
),
},
{
"role": "user",
"content": row_dict[self.prompt_key][1]["content"],
},
]
# messages = self._build_messages(row_dict)
messages = self._build_messages(row_dict.copy()) # original self._build_messages(row_dict)
model_inputs = {}
if self.processor is not None:
raw_prompt = self.processor.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
multi_modal_data = {}
# breakpoint()
images = None
row_dict_images = row_dict.pop(self.image_key, None)
if row_dict_images:
images = [Image.open(io.BytesIO(image["bytes"])) for image in row_dict_images]
# due to the image key is "image" instead of "images" in vllm, we need to use "image" here
# link: https://github.com/vllm-project/vllm/blob/3c545c0c3b98ee642373a308197d750d0e449403/vllm/multimodal/parse.py#L205 # noqa: E501
multi_modal_data["image"] = images
self._build_messages(row_dict) 会移除row_dict的图片, 因为在verl/utils/dataset/rl_dataset.py line 299 , images = example.pop(self.image_key, None) or []有对example pop的操作,导致row_dict中没有images了。
这样的话,row_dict_images = row_dict.pop(self.image_key, None) 就会总为空。
一个简单的例子
a = {
"a": 1,
"b": "3"
}
def f(example):
ans = example.pop("a")
return ans
ans = f(a)
print(a)
python3 run.py
{'b': '3'}
所以这里self._build_messages(row_dict) 应该换成self._build_messages(row_dict.copy()) 。
但是这里改完之后再继续跑deepeyes的脚本的还是会遇到其他问题,让tantigravity对verl这个项目debug还要改verl/experimental/agent_loop/tool_agent_loop.py和verl/trainer/ppo/ray_trainer.py两个地方的代码才最终跑了起来。 但是现在还不确定结果的正常,就先不放了
Information
- [x] The official example scripts
- [x] My own modified scripts
Tasks
- [ ] An officially supported task in the
examplesfolder (such as GLUE/SQuAD, ...) - [x] My own task or dataset (give details below)
Reproduction
PROJECT_NAME="deepeyes" EXPERIMENT_NAME="init-7B"
BASEDIR=$(pwd) SAVE_CHECKPOINT_DIR=${BASEDIR}/verl_checkpoints DATASET_TRAIN=data/ChenShawn/DeepEyes-Datasets-47k/data_0.1.2_visual_toolbox_v2.parquet DATASET_VAL=data/ChenShawn/DeepEyes-Datasets-47k/data_0.1.2_visual_toolbox_v2.parquet
REF_MODEL_PATH=data/Qwen/Qwen2.5-VL-7B-Instruct
train_batch_size=16
ppo_mini_batch_size=16
PYTHONUNBUFFERED=1 python3 -m verl.trainer.main_ppo
--config-path=${BASEDIR}/recipe/deepeyes/configs
--config-name='deepeyes_multiturn_grpo'
data.train_files=${DATASET_TRAIN}
data.val_files=[${DATASET_VAL}]
data.train_batch_size=$train_batch_size
data.max_prompt_length=8192
data.max_response_length=16384
data.return_raw_chat=True
data.filter_overlong_prompts=False
data.filter_overlong_prompts_workers=1
data.dataloader_num_workers=0
algorithm.adv_estimator=grpo
algorithm.kl_ctrl.kl_coef=0.0
actor_rollout_ref.model.path=${REF_MODEL_PATH}
actor_rollout_ref.model.use_remove_padding=True
actor_rollout_ref.model.use_fused_kernels=True
actor_rollout_ref.actor.optim.lr=1e-6
actor_rollout_ref.actor.ppo_mini_batch_size=$ppo_mini_batch_size
actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=1
actor_rollout_ref.actor.use_kl_loss=False
actor_rollout_ref.actor.kl_loss_coef=0.0
actor_rollout_ref.actor.kl_loss_type=low_var_kl
actor_rollout_ref.actor.entropy_coeff=0.0
actor_rollout_ref.actor.checkpoint.save_contents=['model','hf_model','optimizer','extra']
actor_rollout_ref.actor.ulysses_sequence_parallel_size=1
actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=1
actor_rollout_ref.rollout.tensor_model_parallel_size=1
actor_rollout_ref.rollout.name=sglang
actor_rollout_ref.rollout.mode=async
actor_rollout_ref.rollout.n=8
actor_rollout_ref.rollout.max_num_batched_tokens=32768
actor_rollout_ref.rollout.gpu_memory_utilization=0.8
actor_rollout_ref.rollout.free_cache_engine=True
actor_rollout_ref.rollout.enable_chunked_prefill=True
actor_rollout_ref.actor.fsdp_config.param_offload=True
actor_rollout_ref.actor.fsdp_config.optimizer_offload=True
actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=1
actor_rollout_ref.ref.fsdp_config.param_offload=True
actor_rollout_ref.rollout.multi_turn.enable=True
actor_rollout_ref.rollout.multi_turn.max_assistant_turns=5
actor_rollout_ref.rollout.multi_turn.max_user_turns=5
actor_rollout_ref.rollout.multi_turn.max_parallel_calls=1
actor_rollout_ref.rollout.multi_turn.tool_config_path=recipe/deepeyes/configs/image_zoom_in_tool_config.yaml
trainer.critic_warmup=0
trainer.logger=['console','tensorboard']
trainer.val_before_train=False
trainer.n_gpus_per_node=8
trainer.nnodes=1
trainer.save_freq=8
trainer.test_freq=80000000000000
trainer.project_name=${PROJECT_NAME}
trainer.experiment_name=${EXPERIMENT_NAME}
trainer.default_local_dir=${SAVE_CHECKPOINT_DIR}/${PROJECT_NAME}/${EXPERIMENT_NAME}
+trainer.tensorboard_dir=${SAVE_CHECKPOINT_DIR}/logs/tensorboard
+trainer.rl_logging_board_dir=${SAVE_CHECKPOINT_DIR}/logs/rl_logging_board
trainer.total_epochs=1 2>&1 | tee ./logs/${EXPERIMENT_NAME}4.log
Expected behavior
测试deepeyes的官方样例可以运行
hi! 你在测试deepeyes脚本的时候遇到过地址被占用的问题吗
torch.distributed.DistNetworkError: The server socket has failed to listen on any local network address. port: 18039, useIpv6: false, code: -98, name: EADDRINUSE, message: address already in use
same
hi! 你在测试deepeyes脚本的时候遇到过地址被占用的问题吗
torch.distributed.DistNetworkError: The server socket has failed to listen on any local network address. port: 18039, useIpv6: false, code: -98, name: EADDRINUSE, message: address already in use
这个好像没,看起来直接换个端口就好了
hi我想知道你怎么改tool_agent_loop的代码的,我现在也是出现这个问题
hi! 你在测试deepeyes脚本的时候遇到过地址被占用的问题吗
torch.distributed.DistNetworkError: The server socket has failed to listen on any local network address. port: 18039, useIpv6: false, code: -98, name: EADDRINUSE, message: address already in use
我测其他脚本也遇到过这个问题,是并发启动rollout server或者reward model server时出现的
@liuchaohu can you share the other two modifications that ultimately enable the code to run? Thanks so much !! I will try to reproduce the result
@liuchaohu can you share the other two modifications that ultimately enable the code to run? Thanks so much !! I will try to reproduce the result
Hi, I have provide the other two modifications, you can see the #5358 to reproduce the result!
但是这里改完之后再继续跑deepeyes的脚本的还是会遇到其他问题,让tantigravity对verl这个项目debug还要改
verl/experimental/agent_loop/tool_agent_loop.py和verl/trainer/ppo/ray_trainer.py两个地方的代码才最终跑了起来。 但是现在还不确定结果的正常,就先不放了
佬请问这两个地方的代码要怎么修改呢?
中文:
我做了一次只读核对:当前 verl-recipe 里的 DeepEyes recipe 已经在调用 _build_messages 前用 row_dict.get(self.image_key, None) 读取图片,并把 images 传给 processor;当前 verl 的 RLHFDataset._build_messages 也使用 example.get(...) 读取多模态字段。因此,issue 最初描述的“图片字段被 pop 后后续为空”这一点,在当前 main 代码路径里看起来已经有对应缓解。
同时,#5358 中提到的 tool_agent_loop.py 空图片列表问题,当前 verl/experimental/agent_loop/tool_agent_loop.py 也已经在无新图片时传 images=None。
不过我还不建议直接关闭这个 issue:#5358 提到的第三类问题是 union_tensor_dict 在 rollout 后处理 input_ids / attention_mask / position_ids 这类扩展字段时仍可能触发同名 tensor 不相等;当前 verl/protocol.py 仍要求同名 tensor 完全 equal。我没有看到等价的上游合并修复,也没有完整跑通当前 DeepEyes 训练脚本的实验结果。
建议:如果仍能在当前 verl main + 当前 verl-recipe main 上复现,请补充最新 traceback,尤其是是否还卡在 union_tensor_dict / protocol.py 或 PPO rollout 合并阶段;否则这个 issue 可以后续在确认 #5358 覆盖的问题已修复后再关闭。
Evidence:
- DeepEyes recipe currently reads images before
_build_messages: https://github.com/verl-project/verl-recipe/blob/main/deepeyes/deepeyes.py#L74-L82 RLHFDataset._build_messagescurrently usesgetfor multimodal fields: https://github.com/verl-project/verl/blob/main/verl/utils/dataset/rl_dataset.py#L313-L315tool_agent_loop.pycurrently converts empty new images toNone: https://github.com/verl-project/verl/blob/main/verl/experimental/agent_loop/tool_agent_loop.py#L415-L424protocol.pystill asserts equality for duplicate tensor keys: https://github.com/verl-project/verl/blob/main/verl/protocol.py#L109-L120- Related report with the three proposed fixes: https://github.com/verl-project/verl/issues/5358
English:
I did a read-only triage. In the current verl-recipe DeepEyes recipe, images are read with row_dict.get(self.image_key, None) before _build_messages, and then passed to the processor. In current verl, RLHFDataset._build_messages also reads multimodal fields with example.get(...). So the original image-field mutation issue described here appears to be mitigated on the current main code path.
The empty new_images_this_turn case mentioned in #5358 also appears to be handled in current tool_agent_loop.py, where no new images are passed as images=None.
I would not close this yet: the third class of issue from #5358 concerns union_tensor_dict when rollout extends fields such as input_ids, attention_mask, and position_ids; current verl/protocol.py still requires duplicate tensor keys to be exactly equal. I did not find an equivalent merged upstream fix, and I did not run a full current DeepEyes training reproduction.
Suggested next step: if this still reproduces on current verl main plus current verl-recipe main, please add the latest traceback, especially whether the remaining failure is still in union_tensor_dict / protocol.py or PPO rollout merging. Otherwise, this can be reconsidered for closure after confirming the #5358 cases are fully fixed.
This response was generated by a scheduled Codex GPT5.5 issue processing task.