From 96acd473a7f1b4dd5a8e09752183617d3b82089e Mon Sep 17 00:00:00 2001 From: Qiming Zhang Date: Thu, 13 Aug 2026 08:44:03 -0700 Subject: [PATCH] [Bugfix][MiniCPM-V] Fix AssertionError in get_dummy_mm_data when passing VideoDummyOptions to _get_dummy_images (#52122) Signed-off-by: mayuyuace --- vllm/model_executor/models/minicpmv.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/vllm/model_executor/models/minicpmv.py b/vllm/model_executor/models/minicpmv.py index 4a3ad03ed7..ff34a4fb36 100644 --- a/vllm/model_executor/models/minicpmv.py +++ b/vllm/model_executor/models/minicpmv.py @@ -44,7 +44,11 @@ from transformers.dynamic_module_utils import ( from typing_extensions import TypeVar from vllm.config import VllmConfig -from vllm.config.multimodal import BaseDummyOptions +from vllm.config.multimodal import ( + BaseDummyOptions, + ImageDummyOptions, + VideoDummyOptions, +) from vllm.inputs import ModalityData, MultiModalDataDict from vllm.model_executor.layers.quantization import QuantizationConfig from vllm.model_executor.layers.resampler import ( @@ -811,6 +815,18 @@ class MiniCPMVDummyInputsBuilder(BaseDummyInputsBuilder[_I]): image_overrides = mm_options.get("image") video_overrides = mm_options.get("video") + # Convert video overrides to image overrides for per-frame image generation, + # and apply num_frames override to num_video_frames. + video_frame_overrides: ImageDummyOptions | None = None + if isinstance(video_overrides, VideoDummyOptions): + if video_overrides.num_frames: + num_video_frames = min(num_video_frames, video_overrides.num_frames) + if video_overrides.width or video_overrides.height: + video_frame_overrides = ImageDummyOptions( + width=video_overrides.width, + height=video_overrides.height, + ) + return { "image": self._get_dummy_images( width=image_width, @@ -823,7 +839,7 @@ class MiniCPMVDummyInputsBuilder(BaseDummyInputsBuilder[_I]): width=video_width, height=video_height, num_images=num_video_frames, - overrides=video_overrides, + overrides=video_frame_overrides, ) ] * num_videos,