[Bugfix][MM] Fix MiniCPM-o image processor reuse on Transformers v5 (#54501)

Signed-off-by: Andreas Karatzas <Andreas.Karatzas@amd.com>
This commit is contained in:
Andreas Karatzas
2026-08-31 17:07:52 +08:00
committed by GitHub
parent 5bfd76372d
commit 399247cc88
3 changed files with 41 additions and 23 deletions
@@ -7,6 +7,7 @@ import numpy as np
import pytest
from vllm.multimodal import MULTIMODAL_REGISTRY
from vllm.multimodal.parse import ImageSize
from ...utils import build_model_context
@@ -27,21 +28,36 @@ def test_get_hf_processor_for_same_model_different_kwargs(model_id: str):
@pytest.mark.parametrize(
"model_ids", [("openbmb/MiniCPM-Llama3-V-2_5", "openbmb/MiniCPM-V-4")]
"model_ids",
[
("openbmb/MiniCPM-Llama3-V-2_5", "openbmb/MiniCPM-V-4"),
("openbmb/MiniCPM-Llama3-V-2_5", "openbmb/MiniCPM-o-2_6"),
],
)
def test_image_processor_for_dif_model(model_ids):
model_id_25, model_id_4 = model_ids
def test_image_processor_for_different_models(model_ids):
first_model_id, second_model_id = model_ids
ctx_25 = build_model_context(model_id_25, limit_mm_per_prompt={"image": 1})
processor_25 = MULTIMODAL_REGISTRY.create_processor(ctx_25.model_config)
image_processor_25 = processor_25.info.get_image_processor()
first_ctx = build_model_context(
first_model_id,
limit_mm_per_prompt={"image": 1},
)
first_processor = MULTIMODAL_REGISTRY.create_processor(first_ctx.model_config)
first_image_processor = first_processor.info.get_image_processor()
ctx_4 = build_model_context(model_id_4, limit_mm_per_prompt={"image": 1})
processor_4 = MULTIMODAL_REGISTRY.create_processor(ctx_4.model_config)
image_processor_4 = processor_4.info.get_image_processor()
second_ctx = build_model_context(
second_model_id,
limit_mm_per_prompt={"image": 1},
)
second_processor = MULTIMODAL_REGISTRY.create_processor(second_ctx.model_config)
second_image_processor = second_processor.info.get_image_processor()
assert type(image_processor_25) is not type(image_processor_4)
assert type(image_processor_25).__module__ != type(image_processor_4).__module__
second_processor.info.get_sliced_grid(ImageSize(width=128, height=128))
assert type(first_image_processor) is not type(second_image_processor)
assert (
type(first_image_processor).__module__
!= type(second_image_processor).__module__
)
@pytest.mark.parametrize("model_id", ["openbmb/MiniCPM-V-4"])