@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / e30859dff3
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 12, 13:30 UTC

[Bugfix] Fix handling of image embeds in models (#29480)

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>

Cyrus Leung committed Nov 26, 2025 at 21:00 UTC e30859dff3d93bd3e289f6e996afbb59ac475b72
3 files changed +4 -15
vllm/model_executor/models/deepseek_vl2.py
+2 -13
@@ -48,7 +48,6 @@ from vllm.transformers_utils.configs.deepseek_vl2 import (
48 )
49 from vllm.transformers_utils.processors.deepseek_vl2 import DeepseekVLV2Processor
50 from vllm.transformers_utils.tokenizer import cached_tokenizer_from_config
51 -from vllm.utils.collection_utils import is_list_of
51 from vllm.utils.tensor_schema import TensorSchema, TensorShape
52 from vllm.utils.torch_utils import set_default_torch_dtype
53
@@ -595,19 +594,9 @@ class DeepseekVLV2ForCausalLM(nn.Module, SupportsMultiModal, SupportsPP):
594
595 def _process_image_input(
596 self, image_input: DeepseekVL2ImageInputs
598 - ) -> list[torch.Tensor]:
597 + ) -> torch.Tensor | list[torch.Tensor]:
598 if image_input["type"] == "image_embeds":
600 - image_data = image_input["data"]
601 - if is_list_of(image_data, torch.Tensor):
602 - # it's already a list of tensors
603 - return image_data
604 - if len(image_data.shape) == 3:
605 - # 3D tensor
606 - return list(torch.unbind(image_data, dim=0))
607 - raise ValueError(
608 - "We expect batched 2D tensors; "
609 - "this can be either a list of 2D tensors or a single 3D tensor."
610 - )
599 + return image_input["data"]
600
601 pixel_values = image_input["data"]
602 images_spatial_crop = image_input["images_spatial_crop"]
vllm/model_executor/models/llava_next.py
+1 -1
@@ -460,7 +460,7 @@ class LlavaNextForConditionalGeneration(nn.Module, SupportsMultiModal, SupportsP
460 image_input: LlavaNextImageInputs,
461 ) -> torch.Tensor | list[torch.Tensor]:
462 if image_input["type"] == "image_embeds":
463 - return [image_input["data"]]
463 + return image_input["data"]
464
465 patch_embeddings = self._process_image_pixels(image_input)
466
vllm/model_executor/models/llava_onevision.py
+1 -1
@@ -763,7 +763,7 @@ class LlavaOnevisionForConditionalGeneration(nn.Module, SupportsMultiModal, Supp
763 image_input: LlavaOnevisionImageInputs,
764 ) -> torch.Tensor | list[torch.Tensor]:
765 if image_input["type"] == "image_embeds":
766 - return [image_input["data"]]
766 + return image_input["data"]
767
768 patch_embeddings = self._process_image_pixels(image_input)
769