Skip to content

Commit aac372e

Browse files
committed
Fix
Signed-off-by: DarkLight1337 <[email protected]>
1 parent 7d394b5 commit aac372e

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

vllm/model_executor/models/llava.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
ProcessingMixin, PromptReplacement)
3232
from vllm.multimodal.profiling import BaseProfilingInfo, ProcessorInputs
3333
from vllm.sequence import IntermediateTensors
34+
from vllm.utils import is_list_of
3435

3536
from .clip import CLIPVisionModel
3637
from .interfaces import SupportsMultiModal, SupportsPP
@@ -521,7 +522,7 @@ def sampler(self):
521522
return get_sampler()
522523

523524
def _validate_pixel_values(self, data: torch.Tensor) -> torch.Tensor:
524-
# The image size may be different for Pixtral-HF
525+
# Only the longest edge is equal to image_size for Pixtral-HF
525526
if self.config.vision_config.model_type == "pixtral":
526527
return data
527528

@@ -550,10 +551,12 @@ def _parse_and_validate_image_input(
550551
raise ValueError("Incorrect type of pixel values. "
551552
f"Got type: {type(pixel_values)}")
552553

554+
pixel_values = flatten_bn(pixel_values,
555+
concat=is_list_of(pixel_values, list))
556+
553557
return LlavaImagePixelInputs(
554558
type="pixel_values",
555-
data=self._validate_pixel_values(
556-
flatten_bn(pixel_values, concat=True)),
559+
data=self._validate_pixel_values(pixel_values),
557560
)
558561

559562
if image_embeds is not None:

vllm/model_executor/models/utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,15 @@ def flatten_bn(
281281
...
282282

283283

284+
@overload
285+
def flatten_bn(
286+
x: Union[List[torch.Tensor], torch.Tensor],
287+
*,
288+
concat: bool = False,
289+
) -> Union[List[torch.Tensor], torch.Tensor]:
290+
...
291+
292+
284293
def flatten_bn(
285294
x: Union[List[torch.Tensor], torch.Tensor],
286295
*,

0 commit comments

Comments
 (0)