verl icon indicating copy to clipboard operation
verl copied to clipboard

Expected there to be 1 prompt updates corresponding to 1 image items, but instead found 0 prompt updates!

Open my-suit opened this issue 1 year ago • 12 comments

I need some help 😢 When I ran 'run_qwen2_5_vl-7b.sh', the following error popped up: 'RuntimeError: Expected there to be 1 prompt updates corresponding to 1 image items, but instead found 0 prompt updates! Either the prompt text has missing/incorrect tokens for multi-modal inputs, or there is a problem with your implementation of merged multi-modal processor for this model (usually arising from an inconsistency between _call_hf_processor and _get_prompt_updates'

my-suit avatar Mar 31 '25 08:03 my-suit

same problem

M3Dade avatar Apr 07 '25 01:04 M3Dade

Maybe you don't set in problem/prompt ?

M3Dade avatar Apr 07 '25 02:04 M3Dade

same questions

Haken1234 avatar Apr 14 '25 06:04 Haken1234

@Haken1234 @my-suit try add token in problem/prompt?

M3Dade avatar Apr 15 '25 03:04 M3Dade

same problem, I'm using vllm to do offline inference

Nebularaid2000 avatar Apr 19 '25 09:04 Nebularaid2000

same problem, I'm using vllm to do offline training

ZCDMV0031 avatar Apr 28 '25 14:04 ZCDMV0031

same probelm

wuyuqi517 avatar Apr 30 '25 07:04 wuyuqi517

same probelm

try add in prompt?

ZCDMV0031 avatar May 06 '25 08:05 ZCDMV0031

I met the same problem in verl when calling vllm:

  File "/mnt/zhangh/wangzhikai/verl/verl/trainer/main_ppo.py", line 64, in main
    run_ppo(config)
  File "/mnt/zhangh/wangzhikai/verl/verl/trainer/main_ppo.py", line 76, in run_ppo
    ray.get(runner.run.remote(config))
  File "/usr/local/conda/lib/python3.10/site-packages/ray/_private/auto_init_hook.py", line 21, in auto_init_wrapper
    return fn(*args, **kwargs)
  File "/usr/local/conda/lib/python3.10/site-packages/ray/_private/client_mode_hook.py", line 103, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/conda/lib/python3.10/site-packages/ray/_private/worker.py", line 2822, in get
    values, debugger_breakpoint = worker.get_objects(object_refs, timeout=timeout)
  File "/usr/local/conda/lib/python3.10/site-packages/ray/_private/worker.py", line 930, in get_objects
    raise value.as_instanceof_cause()
ray.exceptions.RayTaskError(RuntimeError): ray::TaskRunner.run() (pid=140431, ip=33.202.81.243, actor_id=9905c7938f5aac694dedcd2701000000, repr=<main_ppo.TaskRunner object at 0x7f62e318dc60>)
  File "/mnt/zhangh/wangzhikai/verl/verl/trainer/main_ppo.py", line 183, in run
    trainer.fit()
  File "/mnt/zhangh/wangzhikai/verl/verl/trainer/ppo/ray_trainer.py", line 908, in fit
    gen_batch_output = self.actor_rollout_wg.generate_sequences(gen_batch)
  File "/mnt/zhangh/wangzhikai/verl/verl/single_controller/ray/base.py", line 49, in func
    output = ray.get(output)
ray.exceptions.RayTaskError(RuntimeError): ray::WorkerDict.actor_rollout_generate_sequences() (pid=142937, ip=33.202.81.243, actor_id=a50fead65c3605c4742ae7ba01000000, repr=<verl.single_controller.ray.base.WorkerDict object at 0x7f8752abc3d0>)
  File "/mnt/zhangh/wangzhikai/verl/verl/single_controller/ray/base.py", line 466, in func
    return getattr(self.worker_dict[key], name)(*args, **kwargs)
  File "/mnt/zhangh/wangzhikai/verl/verl/single_controller/base/decorator.py", line 501, in inner
    return func(*args, **kwargs)
  File "/mnt/zhangh/wangzhikai/verl/verl/workers/fsdp_workers.py", line 614, in generate_sequences
    output = self.rollout.generate_sequences(prompts=prompts)
  File "/mnt/zhangh/wangzhikai/verl/verl/utils/debug/performance.py", line 78, in f
    return self.log(decorated_function, *args, **kwargs)
  File "/mnt/zhangh/wangzhikai/verl/verl/utils/debug/performance.py", line 88, in log
    output = func(*args, **kwargs)
  File "/usr/local/conda/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "/mnt/zhangh/wangzhikai/verl/verl/workers/rollout/vllm_rollout/vllm_rollout_spmd.py", line 256, in generate_sequences
    outputs = self.inference_engine.generate(
  File "/usr/local/conda/lib/python3.10/site-packages/vllm/utils.py", line 1131, in inner
    return fn(*args, **kwargs)
  File "/usr/local/conda/lib/python3.10/site-packages/vllm/entrypoints/llm.py", line 457, in generate
    self._validate_and_add_requests(
  File "/usr/local/conda/lib/python3.10/site-packages/vllm/entrypoints/llm.py", line 1317, in _validate_and_add_requests
    self._add_request(
  File "/usr/local/conda/lib/python3.10/site-packages/vllm/entrypoints/llm.py", line 1335, in _add_request
    self.llm_engine.add_request(
  File "/usr/local/conda/lib/python3.10/site-packages/vllm/v1/engine/llm_engine.py", line 186, in add_request
    request = self.processor.process_inputs(request_id, prompt, params,
  File "/usr/local/conda/lib/python3.10/site-packages/vllm/v1/engine/processor.py", line 201, in process_inputs
    processed_inputs: ProcessorInputs = self.input_preprocessor.preprocess(
  File "/usr/local/conda/lib/python3.10/site-packages/vllm/inputs/preprocess.py", line 750, in preprocess
    return self._process_decoder_only_prompt(
  File "/usr/local/conda/lib/python3.10/site-packages/vllm/inputs/preprocess.py", line 699, in _process_decoder_only_prompt
    prompt_comps = self._prompt_to_llm_inputs(
  File "/usr/local/conda/lib/python3.10/site-packages/vllm/inputs/preprocess.py", line 347, in _prompt_to_llm_inputs
    return self._process_multimodal(
  File "/usr/local/conda/lib/python3.10/site-packages/vllm/inputs/preprocess.py", line 275, in _process_multimodal
    return mm_processor.apply(prompt, mm_data, mm_processor_kwargs,
  File "/usr/local/conda/lib/python3.10/site-packages/vllm/multimodal/processing.py", line 1626, in apply
    self._validate_mm_placeholders(mm_placeholders, mm_item_counts)
  File "/usr/local/conda/lib/python3.10/site-packages/vllm/multimodal/processing.py", line 1535, in _validate_mm_placeholders
    raise RuntimeError(
RuntimeError: Expected there to be 4 prompt updates corresponding to 4 image items, but instead found 3 prompt updates! Either the prompt text has missing/incorrect tokens for multi-modal inputs, or there is a problem with your implementation of merged multi-modal processor for this model (usually arising from an inconsistency between `_call_hf_processor` and `_get_prompt_updates`).

the row of data is look like:

(TaskRunner pid=140431) {'data_source': 'PeijieWang/MV-MATH', 'ability': 'Metric Geometry', 'reward_model': {'ground_truth': '$\\sqrt{2}+1 \\# \\# 1+\\sqrt{2}$', 'style': 'rule'}, 'extra_info': {'analysis': 'Let the side length of the octagon be $a$.\n\nAccording to the problem, we have:\n\n\\[\n4 \\times \\frac{1}{2} \\cdot a \\cdot a + (2a + \\sqrt{2}a)^{2} = 8 + 4\\sqrt{2}\n\\]\n\nSimplifying, we get:\n\n\\[\n2a^{2} + (2a + \\sqrt{2}a)^{2} = 8 + 4\\sqrt{2}\n\\]\n\nExpanding the square:\n\n\\[\n2a^{2} + 4a^{2} + 4\\sqrt{2}a^{2} + 2a^{2} = 8 + 4\\sqrt{2}\n\\]\n\nCombining like terms:\n\n\\[\n8a^{2} + 4\\sqrt{2}a^{2} = 8 + 4\\sqrt{2}\n\\]\n\nFactoring out $a^{2}$:\n\n\\[\na^{2}(8 + 4\\sqrt{2}) = 8 + 4\\sqrt{2}\n\\]\n\nDividing both sides by $(8 + 4\\sqrt{2})$:\n\n\\[\na^{2} = 1\n\\]\n\nSince $a > 0$, we have:\n\n\\[\na = 1\n\\]\n\nTherefore, the length of $AB$ is:\n\n\\[\nAB = a + \\sqrt{2}a = 1 + \\sqrt{2}\n\\]\n\nThus, the answer is:\n\n\\[\n\\boxed{\\sqrt{2} + 1}\n\\]\n\n**Note:** This problem tests knowledge of geometric shapes and their properties, particularly the concept of area conservation when shapes are rearranged. The key to solving it is to set up an equation based on the area before and after the rearrangement, which is a common type of problem in middle school mathematics competitions.', 'difficulty': 'Medium', 'image_relavance': '1', 'is_multi_img': True}, 'images': [<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=299x294 at 0x7F61BC573EE0>, <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=306x291 at 0x7F61BC573820>, <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=277x266 at 0x7F61BC5735E0>]}
(TaskRunner pid=140431) {'data_source': 'PeijieWang/MV-MATH', 'ability': 'Descriptive Geometry', 'reward_model': {'ground_truth': 'A', 'style': 'rule'}, 'extra_info': {'analysis': 'Find the shape obtained from the top view, ensuring that all visible edges are represented in the top view.  \nSolution: From the top view, this geometric figure has only one layer and consists of 3 small squares, so the correct choice is A.', 'difficulty': 'Low', 'image_relavance': '1', 'is_multi_img': True}, 'images': [<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=254x195 at 0x7F61BC573700>, <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=206x80 at 0x7F61BC573280>, <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=192x128 at 0x7F61BC573160>, <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=75x129 at 0x7F61BC572EF0>, <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=205x132 at 0x7F61BC5702E0>]}
(TaskRunner pid=140431) {'data_source': 'PeijieWang/MV-MATH', 'ability': 'Combinatorial Geometry', 'reward_model': {'ground_truth': 'A', 'style': 'rule'}, 'extra_info': {'analysis': 'Solution: Since points \\( E, F, G, H \\) are the midpoints of the sides of rectangle \\( ABCD \\),\n\nTherefore, \\( AH = DH = BF = CF \\), \\( AE = BE = DG = CG \\), and \\( \\angle A = \\angle B = \\angle C = \\angle D = 90^\\circ \\),\n\nThus, triangles \\( \\triangle AEH \\cong \\triangle CGF \\cong \\triangle BEF \\cong \\triangle DGH \\) (by SAS),\n\nHence, \\( EH = EF = FG = GH \\),\n\nTherefore, quadrilateral \\( EFGH \\) is a rhombus, so option A is correct;\n\nSince quadrilateral \\( ABCD \\) is a rectangle,\n\nTherefore, \\( AD \\parallel BC \\),\n\nThus, \\( \\angle ECA = \\angle CAD \\),\n\nSince \\( \\angle CAE = \\angle CAD \\),\n\nTherefore, \\( \\angle CAE = \\angle ECA \\),\n\nHence, \\( EA = EC \\),\n\nIn triangles \\( \\triangle EAC \\) and \\( \\triangle FAC \\),\n\n\\[\n\\left\\{\n\\begin{array}{c}\n\\angle EAC = \\angle CAF \\\\\nAC = AC \\\\\n\\angle ACE = \\angle ACF\n\\end{array}\n\\right.\n\\]\n\nThus, \\( \\triangle EAC \\cong \\triangle FAC \\) (by ASA),\n\nTherefore, \\( AE = AF \\),\n\nHence, \\( AF = EC \\),\n\nSince \\( AF \\parallel EC \\),\n\nTherefore, quadrilateral \\( AECF \\) is a parallelogram,\n\nSince \\( AE = AF \\),\n\nTherefore, quadrilateral \\( AECF \\) is a rhombus, so option B is incorrect;\n\n(3) Since in rectangle \\( ABCD \\), \\( AB = 5 \\), \\( AD = 12 \\),\n\nTherefore, the area of rectangle \\( ABCD = AB \\cdot AD = 60 \\),\n\nAs shown in the figure:\n\n<image_4>\n\nSince \\( \\triangle AEH \\cong \\triangle CGF \\cong \\triangle BEF \\cong \\triangle DGH \\),\n\nTherefore, \\( S_{\\triangle AEH} = \\frac{1}{2} \\times \\frac{1}{2} \\times AB \\times \\frac{1}{2} \\times AD = \\frac{15}{2} \\),\n\nThus, the area of rhombus \\( EFGH = 60 - 4 \\times \\frac{15}{2} = 30 \\);\n\nAs shown in the figure:\n\n<image_5>\n\nLet \\( BE = x \\), then \\( AE = CE = BC - BE = 12 - x \\), in right triangle \\( \\triangle ABE \\), by the Pythagorean theorem:\n\n\\[\nx^{2} + 5^{2} = (12 - x)^{2},\n\\]\n\nSolving gives \\( x = \\frac{119}{24} \\),\n\nTherefore, \\( CE = 12 - \\frac{119}{24} = \\frac{169}{24} \\),\n\nThus, the area of rhombus \\( AECF = CE \\cdot AB = \\frac{169}{24} \\times 5 \\approx 35.21 \\),\n\nTherefore, the area of rhombus \\( EFGH \\) < the area of rhombus \\( AECF \\),\n\nHence, options C and D are both incorrect.\n\nTherefore, the correct answer is: A.\n\n【Key Insight】This question examines the determination and properties of a rhombus, the properties of a rectangle, the transformation of folding, the determination and properties of congruent triangles, and the Pythagorean theorem. The key to solving this problem lies in mastering the determination and properties of a rhombus.', 'difficulty': 'High', 'image_relavance': '1', 'is_multi_img': True}, 'images': [<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=418x243 at 0x7F61BC573B80>, <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=417x268 at 0x7F61BC573010>, <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=411x268 at 0x7F61BC5714E0>]}

the shell is like:

ENGINE=${1:-vllm}
# If you are using vllm<=0.6.3, you might need to set the following environment variable to avoid bugs:
# export VLLM_ATTENTION_BACKEND=XFORMERS

python3 -m verl.trainer.main_ppo \
    algorithm.adv_estimator=grpo \
    data.train_files=/mnt/zhangh/wangzhikai/verl/wzk_data/MV_MATH_train.parquet \
    data.val_files=/mnt/zhangh/wangzhikai/verl/wzk_data/MV_MATH_test.parquet \
    data.train_batch_size=64 \
    data.max_prompt_length=4096 \
    data.max_response_length=2048 \
    data.filter_overlong_prompts=False \
    data.truncation='error' \
    data.image_key=images \
    actor_rollout_ref.model.path=/mnt/zhangh/wangzhikai/9cdata/huggingface_model/hub/Qwen2.5-VL-7B-Instruct \
    actor_rollout_ref.actor.optim.lr=1e-6 \
    actor_rollout_ref.model.use_remove_padding=True \
    actor_rollout_ref.actor.ppo_mini_batch_size=16 \
    actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=2 \
    actor_rollout_ref.actor.use_kl_loss=True \
    actor_rollout_ref.actor.kl_loss_coef=0.01 \
    actor_rollout_ref.actor.kl_loss_type=low_var_kl \
    actor_rollout_ref.actor.entropy_coeff=0 \
    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=4 \
    actor_rollout_ref.rollout.tensor_model_parallel_size=1 \
    actor_rollout_ref.rollout.name=$ENGINE \
    actor_rollout_ref.rollout.gpu_memory_utilization=0.6 \
    actor_rollout_ref.rollout.enable_chunked_prefill=False \
    actor_rollout_ref.rollout.enforce_eager=False \
    actor_rollout_ref.rollout.free_cache_engine=False \
    actor_rollout_ref.rollout.n=2 \
    +actor_rollout_ref.rollout.limit_images=20 \
    actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=4 \
    actor_rollout_ref.ref.fsdp_config.param_offload=True \
    algorithm.use_kl_in_reward=False \
    custom_reward_function.path=/mnt/zhangh/wangzhikai/verl/wzk_data/custom_reward.py \
    custom_reward_function.name=my_reward_fn \
    trainer.critic_warmup=0 \
    trainer.logger=['console','wandb'] \
    trainer.project_name='verl_grpo_example_mvmath' \
    trainer.experiment_name='qwen2_5_vl_7b_function_rm' \
    trainer.n_gpus_per_node=2 \
    trainer.nnodes=1 \
    trainer.save_freq=20 \
    trainer.test_freq=5 \
    trainer.total_epochs=15 $@

Cloudcatcher888 avatar May 23 '25 06:05 Cloudcatcher888

Adding '<image>' to the prompt could resolve this issue.

koncle avatar Jun 12 '25 08:06 koncle

@koncle @M3Dade @Cloudcatcher888 @Nebularaid2000 @wuyuqi517 I encountered the same error when using qwen2.5-VL in VLLM. Seems vllm has special input prompt for processing the image inputs ... You can refer to https://github.com/vllm-project/vllm/blob/main/examples/offline_inference/vision_language.py#L965 , and use the example prompt format. It works for me.

jiahaolu97 avatar Jun 13 '25 04:06 jiahaolu97

定时清理检查结果:这个 issue 最近一次由当前运行账号以外账号产生的公开回复或公开引用是 2025-06-13T04:03:45Z。本轮检查日期为 2026-07-04,该时间已经超过 6 个月。检查来源包括 issue comments API https://api.github.com/repos/verl-project/verl/issues/841/comments?per_page=100 和 timeline API https://api.github.com/repos/verl-project/verl/issues/841/timeline?per_page=100。

按照本仓库的定时 issue 清理标准,我会先留下这条说明并关闭该 issue。若作者或社区成员仍能提供新的复现、证据或需求背景,请继续评论请求重开,或创建新的 issue 并引用这里的上下文。


Scheduled cleanup check: the latest public reply or public reference from an account other than the current automation account was 2025-06-13T04:03:45Z. The check date for this run is 2026-07-04, so that activity is more than 6 months old. The checked public sources were the issue comments API https://api.github.com/repos/verl-project/verl/issues/841/comments?per_page=100 and the timeline API https://api.github.com/repos/verl-project/verl/issues/841/timeline?per_page=100.

Following the scheduled issue cleanup policy, I am leaving this note first and then closing the issue. If the author or community can still provide a fresh reproduction, evidence, or requirement context, please comment to request reopening or open a new issue that links back to this one.

This response was generated by a scheduled Codex GPT5.5 issue processing task.

Kirrito-k423 avatar Jul 04 '26 01:07 Kirrito-k423