@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 4fb349f66a
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 15, 09:45 UTC

Fix copy-paste error in phi4mm image processing (#18315)

Signed-off-by: Lifu Huang <lifu.hlf@gmail.com>

Lifu Huang committed May 18, 2025 at 07:00 UTC 4fb349f66afc2587d470d4d1974d58f801db16af
1 file changed +7 -19
vllm/model_executor/models/phi4mm.py
+7 -19
@@ -415,15 +415,6 @@ class Phi4MMImagePixelInputs(TypedDict):
415 """Shape: `(batch_size * num_images, H_mask, W_mask)`"""
416
417
418 -class Phi4MMImageEmbeddingInputs(TypedDict):
419 - type: Literal["image_embeds"]
420 - data: Union[torch.Tensor, list[torch.Tensor]]
421 - """Shape: `(batch_size * num_images, image_feature_size, hidden_size)`
422 -
423 - `hidden_size` must match the hidden size of language model backbone.
424 - """
425 -
426 -
418 class Phi4MMAudioFeatureInputs(TypedDict):
419 type: Literal["audio_features"]
420 data: Union[torch.Tensor, list[torch.Tensor]]
@@ -436,7 +427,6 @@ class Phi4MMAudioEmbeddingInputs(TypedDict):
427 """Shape: `(batch_size, num_audios, audio_feature_size, hidden_size)"""
428
429
439 -Phi4MMImageInput = Union[Phi4MMImagePixelInputs, Phi4MMImageEmbeddingInputs]
430 Phi4MMAudioInputs = Union[Phi4MMAudioFeatureInputs, Phi4MMAudioEmbeddingInputs]
431
432
@@ -1112,15 +1102,13 @@ class Phi4MMForCausalLM(nn.Module, SupportsLoRA, SupportsMultiModal):
1102
1103 def _process_image_input(
1104 self, image_input: Phi4MMImagePixelInputs) -> list[torch.Tensor]:
1115 - if image_input["type"] == "image_embeds":
1116 - image_embeds = image_input["image_embeds"].type(self.visual.dtype)
1117 - else:
1118 - dtype = next(self.vision_encoder.parameters()).dtype
1119 - pixel_values = image_input['data'].to(dtype)
1120 - image_sizes = image_input['image_sizes']
1121 - image_attention_mask = image_input['image_attention_mask']
1122 - image_embeds = self.vision_encoder(pixel_values, image_sizes,
1123 - image_attention_mask)
1105 +
1106 + dtype = next(self.vision_encoder.parameters()).dtype
1107 + pixel_values = image_input['data'].to(dtype)
1108 + image_sizes = image_input['image_sizes']
1109 + image_attention_mask = image_input['image_attention_mask']
1110 + image_embeds = self.vision_encoder(pixel_values, image_sizes,
1111 + image_attention_mask)
1112 return image_embeds
1113
1114 def get_multimodal_embeddings(