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

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

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 16, 03:15 UTC

[Bugfix] Validate and concatenate image embeddings in MiniCPMVBaseModel (#11631)

whyiug committed Dec 31, 2024 at 02:51 UTC 36e76700453924c8d421db99af70a88a1df835cd
1 file changed +6
vllm/model_executor/models/minicpmv.py
+6
@@ -487,6 +487,12 @@ class MiniCPMVBaseModel(nn.Module, SupportsMultiModal, SupportsPP):
487 image_embeds = kwargs.pop("image_embeds", None)
488
489 if image_embeds is not None:
490 + if not isinstance(image_embeds, (torch.Tensor, list)):
491 + raise ValueError(f"Incorrect type of image embeds. "
492 + f"Got type: {type(image_embeds)}")
493 + if isinstance(image_embeds, list):
494 + image_embeds = torch.concat(image_embeds)
495 +
496 return MiniCPMVImageEmbeddingInputs(
497 image_bounds=self._get_image_bounds(input_ids, im_start_id,
498 im_end_id, slice_start_id,