Skip to content

Commit

Permalink
[Bugfix] Validate and concatenate image embeddings in MiniCPMVBaseMod…
Browse files Browse the repository at this point in the history
…el (vllm-project#11631)

Signed-off-by: xcnick <[email protected]>
  • Loading branch information
whyiug authored and xcnick committed Dec 31, 2024
1 parent a3a52f9 commit f486422
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions vllm/model_executor/models/minicpmv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f486422

Please sign in to comment.