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 6, 15:45 UTC
[Bugfix] Make siglip/clip compatible with transformers v5 (#37200)
Signed-off-by: raushan <raushan@huggingface.co>
Raushan Turganbay committed
Mar 16, 2026 at 17:48 UTC
55e6d3d5c035b4c0035108b3a51f7a474cae379b
2 files changed
+12
-4
tests/models/multimodal/pooling/test_clip.py
+6
-2
@@ -2,6 +2,7 @@
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
4
import pytest
5
+import torch
6
from transformers import CLIPModel
7
8
from ....conftest import IMAGE_ASSETS, HfRunner, PromptImageInput, VllmRunner
@@ -50,13 +51,16 @@ def _run_test(
51
if "pixel_values" in inputs:
52
pooled_output = hf_model.model.get_image_features(
53
pixel_values=inputs.pixel_values,
53
- ).squeeze(0)
54
+ )
55
else:
56
pooled_output = hf_model.model.get_text_features(
57
input_ids=inputs.input_ids,
58
attention_mask=inputs.attention_mask,
58
- ).squeeze(0)
59
+ )
60
61
+ if not isinstance(pooled_output, torch.Tensor):
62
+ pooled_output = pooled_output.pooler_output
63
+ pooled_output = pooled_output.squeeze(0)
64
all_outputs.append(pooled_output.tolist())
65
66
hf_outputs = all_outputs
tests/models/multimodal/pooling/test_siglip.py
+6
-2
@@ -4,6 +4,7 @@
4
from typing import Any
5
6
import pytest
7
+import torch
8
from transformers import SiglipModel
9
10
from ....conftest import IMAGE_ASSETS, HfRunner, PromptImageInput, VllmRunner
@@ -68,12 +69,15 @@ def _run_test(
69
if "pixel_values" in inputs:
70
pooled_output = hf_model.model.get_image_features(
71
pixel_values=inputs.pixel_values,
71
- ).squeeze(0)
72
+ )
73
else:
74
pooled_output = hf_model.model.get_text_features(
75
input_ids=inputs.input_ids,
75
- ).squeeze(0)
76
+ )
77
78
+ if not isinstance(pooled_output, torch.Tensor):
79
+ pooled_output = pooled_output.pooler_output
80
+ pooled_output = pooled_output.squeeze(0)
81
all_outputs.append(pooled_output.tolist())
82
83
hf_outputs = all_outputs