From 36e76700453924c8d421db99af70a88a1df835cd Mon Sep 17 00:00:00 2001 From: whyiug Date: Tue, 31 Dec 2024 02:51:04 +0800 Subject: [PATCH] [Bugfix] Validate and concatenate image embeddings in MiniCPMVBaseModel (#11631) --- vllm/model_executor/models/minicpmv.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vllm/model_executor/models/minicpmv.py b/vllm/model_executor/models/minicpmv.py index 1e8f9bd4cf418..712022502539b 100644 --- a/vllm/model_executor/models/minicpmv.py +++ b/vllm/model_executor/models/minicpmv.py @@ -487,6 +487,12 @@ def _parse_and_validate_inputs( image_embeds = kwargs.pop("image_embeds", None) if image_embeds is not None: + if not isinstance(image_embeds, (torch.Tensor, list)): + raise ValueError(f"Incorrect type of image embeds. " + f"Got type: {type(image_embeds)}") + if isinstance(image_embeds, list): + image_embeds = torch.concat(image_embeds) + return MiniCPMVImageEmbeddingInputs( image_bounds=self._get_image_bounds(input_ids, im_start_id, im_end_id, slice_start_id,