Skip to content

[bugfix] fix minicpmv mm prompt placeholder parse error - #49162

Closed
yma11 wants to merge 3 commits into
vllm-project:mainfrom
yma11:minicpm-v
Closed

yma11 wants to merge 3 commits into
vllm-project:mainfrom
yma11:minicpm-v

Conversation

@yma11

@yma11 yma11 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Purpose

minicpm-v gets prompt placeholder parse error in latest main:

File "/workspace/mayan/vllm-714/vllm/entrypoints/offline_utils.py", line 151, in _preprocess_cmpl_one
    (engine_input,) = self._preprocess_cmpl(
                      ^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/mayan/vllm-714/vllm/entrypoints/offline_utils.py", line 139, in _preprocess_cmpl
    return renderer.render_cmpl(
           ^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/mayan/vllm-714/vllm/renderers/base.py", line 1003, in render_cmpl
    self.process_for_engine(prompt, arrival_time, skip_mm_cache=skip_mm_cache)
  File "/workspace/mayan/vllm-714/vllm/renderers/base.py", line 955, in process_for_engine
    engine_input = self._process_singleton(prompt, skip_mm_cache=skip_mm_cache)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/mayan/vllm-714/vllm/renderers/base.py", line 876, in _process_singleton
    return self._process_tokens(prompt, skip_mm_cache=skip_mm_cache)  # type: ignore[arg-type]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/mayan/vllm-714/vllm/renderers/hf.py", line 1192, in _process_tokens
    engine_input = super()._process_tokens(prompt, skip_mm_cache=skip_mm_cache)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/mayan/vllm-714/vllm/renderers/base.py", line 781, in _process_tokens
    engine_input = self._process_multimodal(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/mayan/vllm-714/vllm/renderers/base.py", line 762, in _process_multimodal
    mm_inputs = mm_processor.apply(mm_processor_inputs, mm_timing_ctx)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/mayan/vllm-714/vllm/multimodal/processing/processor.py", line 1689, in apply
    prompt_ids, mm_placeholders = self._maybe_apply_prompt_updates(
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/mayan/vllm-714/vllm/multimodal/processing/processor.py", line 1659, in _maybe_apply_prompt_updates
    self._validate_mm_placeholders(mm_placeholders, mm_item_counts)
  File "/workspace/mayan/vllm-714/vllm/multimodal/processing/processor.py", line 1628, in _validate_mm_placeholders
    raise RuntimeError(
RuntimeError: Expected there to be 1 prompt placeholders corresponding to 1 image items, but instead found 0 prompt placeholders! Make sure the implementation of `_call_hf_processor` and `_get_mm_fields_config` are consistent with each other.

This PR also remove vendor minicpm processor as shifted to transformers 5.13.1

Test Plan

 python ./examples/generate/multimodal/vision_language_offline.py -m minicpmv

Test Result


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mergify mergify Bot added the bug Something isn't working label Jul 20, 2026
@yma11
yma11 marked this pull request as draft July 20, 2026 08:04
@yma11
yma11 marked this pull request as ready for review July 20, 2026 08:36
@yma11

yma11 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@hmellor Please help take a look. Thanks.

Comment thread vllm/model_executor/models/minicpmv.py Outdated
Comment on lines +551 to +560
@@ -555,6 +557,7 @@ def get_hf_processor(self, **kwargs: object):
version=self.get_model_version(),
)
hf_processor = vendored_processor
"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this here?

Suggested change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intermediate diff applied by mistaken. Updated and addressed your comments. Thanks.

Comment on lines +91 to +97
try:
module = importlib.import_module(module_name)
except ModuleNotFoundError as e:
# Let getattr(processors, name, None) gracefully fall back.
raise AttributeError(
f"module 'processors' has no attribute '{name}'"
) from e

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? This should be unreachable because of the if name in _CLASS_TO_MODULE check

Comment thread vllm/model_executor/models/minicpmv.py Outdated
# placeholder text is tokenized differently inside chat templates.
# Keep dummy startup prompts aligned with the real online prompt shape
# so encoder-budget initialization exercises the same path.
if self.info.get_model_version() in {(4, 0), (4, 5), (4, 6)}:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file does not define 4.6

@yma11

yma11 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

@hmellor can you review again? Thanks.

@mergify

mergify Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @yma11.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@@ -66,8 +64,6 @@
"KimiAudioProcessor": "vllm.transformers_utils.processors.kimi_audio",
"KimiK25Processor": "vllm.transformers_utils.processors.kimi_k25",
"MiMoOmniProcessor": "vllm.transformers_utils.processors.mimo_v2_omni",
"MiniCPMOProcessor": "vllm.transformers_utils.processors.minicpmo",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you delete the processor for minicpmo too?

@hmellor hmellor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also delete the comment:

        # MiniCPM-V 4.6 keeps the native transformers MiniCPMV4_6Processor:
        # this model has its own image/video handling and prompt-update logic
        # below, so it does not need (and is incompatible with) the vendored
        # MiniCPMVProcessor used by 2.x/4.0/4.5, whose __init__ assumes a
        # legacy `image_processor.version` attribute that 4.6 no longer has.

from MiniCPMV4_6ProcessingInfo.

yma11 added 3 commits August 6, 2026 02:45
Signed-off-by: Yan Ma <yan.ma@intel.com>
Signed-off-by: Yan Ma <yan.ma@intel.com>
Signed-off-by: Yan Ma <yan.ma@intel.com>
@yma11

yma11 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Close as PR #48413 fixed this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants