@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / aa1df36c53
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Fix/minicpmv46 missing version (#44980)

Signed-off-by: wjinxu <1299461899@qq.com> Co-authored-by: Cursor <cursoragent@cursor.com>

王金旭 committed Jun 11, 2026 at 17:20 UTC aa1df36c5316aa1f15187ead2f1ad65898f83bdb
3 files changed +32 -2
vllm/model_executor/models/minicpmv4_6.py
+20
@@ -424,6 +424,26 @@ class MiniCPMV4_6ProcessingInfo(MiniCPMVProcessingInfo):
424 def get_hf_config(self):
425 return self.ctx.get_hf_config()
426
427 + def get_hf_processor(self, **kwargs: object):
428 + # MiniCPM-V 4.6 keeps the native transformers MiniCPMV4_6Processor:
429 + # this model has its own image/video handling and prompt-update logic
430 + # below, so it does not need (and is incompatible with) the vendored
431 + # MiniCPMVProcessor used by 2.x/4.0/4.5, whose __init__ assumes a
432 + # legacy `image_processor.version` attribute that 4.6 no longer has.
433 + hf_processor = self.ctx.get_hf_processor(**kwargs)
434 +
435 + # NumPy arrays are considered as Iterable but not Sequence in
436 + # https://github.com/huggingface/transformers/blob/main/src/transformers/image_transforms.py#L428
437 + image_processor = getattr(hf_processor, "image_processor", None)
438 + if image_processor is not None:
439 + # transformers v5+ renamed `mean`/`std` -> `image_mean`/`image_std`
440 + for attr in ("mean", "std", "image_mean", "image_std"):
441 + val = getattr(image_processor, attr, None)
442 + if isinstance(val, np.ndarray):
443 + setattr(image_processor, attr, val.tolist())
444 +
445 + return hf_processor
446 +
447 def _get_expected_hidden_size(self) -> int:
448 config = self.get_hf_config()
449 if hasattr(config, "text_config") and config.text_config is not None:
vllm/transformers_utils/processors/minicpmo.py
+6 -1
@@ -64,7 +64,12 @@ class MiniCPMOProcessor(ProcessorMixin):
64 pool_step=2,
65 ):
66 super().__init__(image_processor, feature_extractor, tokenizer)
67 - self.version = image_processor.version
67 + # Mirror the MiniCPMVProcessor guard: newer (transformers v5.7+)
68 + # MiniCPM image processors may drop the legacy `version` attribute,
69 + # so fall back to None instead of hard-crashing. `version` only
70 + # special-cases the 2.5 tokenization path; other values take the
71 + # default branch.
72 + self.version = getattr(image_processor, "version", None)
73 self.pool_step = pool_step
74
75 def _safe_get_token_id(self, attr_name, default_token_str):
vllm/transformers_utils/processors/minicpmv.py
+6 -1
@@ -58,7 +58,12 @@ class MiniCPMVProcessor(ProcessorMixin):
58
59 def __init__(self, image_processor=None, tokenizer=None):
60 super().__init__(image_processor, tokenizer)
61 - self.version = image_processor.version
61 + # Newer (transformers v5.7+) MiniCPM-V image processors, e.g.
62 + # MiniCPMV4_6ImageProcessor, no longer carry a `version` attribute.
63 + # Fall back to None instead of hard-crashing: `version` is only used
64 + # to special-case the 2.5 tokenization path in `_convert`, and any
65 + # value other than 2.5 takes the default branch anyway.
66 + self.version = getattr(image_processor, "version", None)
67
68 def __call__(
69 self,