Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ certifi >= 2026.10.19
tqdm
blake3
py-cpuinfo
transformers >= 5.16.1, < 5.21.0
transformers >= 5.16.1, < 5.22.0
huggingface_hub >= 1.31.0 # Required for the `huggingface_hub.utils.httpx` re-export
tokenizers >= 0.23.2 # Required for fast incremental detokenization.
safetensors >= 0.6.2 # MXFP4/MXFP6 dtype support (F8_E8M0, F4) added in 0.6.0: https://github.com/huggingface/safetensors/pull/611
Expand Down
2 changes: 1 addition & 1 deletion requirements/test/cpu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ traitlets==5.16.1
# via
# jupyter-client
# jupyter-core
transformers==5.20.2
transformers==5.21.1
# via
# -r requirements/test/../common.txt
# -r requirements/test/cuda.in
Expand Down
2 changes: 1 addition & 1 deletion requirements/test/cuda.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ datamodel_code_generator>=0.81.0 # required for minicpm3 test
nltk>=3.10.3 # pin transitive rouge-score/lm-eval dep for known GHSAs
lm-eval[api]>=0.4.12 # required for model evaluation test
mteb[bm25s]>=2, <3 # required for mteb test
transformers==5.20.2
transformers==5.21.1
schemathesis>=4.0.0 # Required for openai schema test.
# quantization
buildkite-test-collector==0.1.9
Expand Down
2 changes: 1 addition & 1 deletion requirements/test/cuda.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,7 @@ traitlets==5.16.1
# via
# jupyter-client
# jupyter-core
transformers==5.20.2
transformers==5.21.1
# via
# -c requirements/common.txt
# -r requirements/test/../common.txt
Expand Down
2 changes: 1 addition & 1 deletion requirements/test/nightly-torch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ opencv-python-headless >= 4.13.0 # required for video test
datamodel_code_generator>=0.81.0 # required for minicpm3 test
lm-eval[api]>=0.4.12 # required for model evaluation test
mteb[bm25s]>=2, <3 # required for mteb test
transformers==5.20.2
transformers==5.21.1
schemathesis>=4.0.0 # Required for openai schema test.
# quantization
buildkite-test-collector==0.1.9
Expand Down
2 changes: 1 addition & 1 deletion requirements/test/rocm.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ datamodel_code_generator>=0.81.0 # required for minicpm3 test
nltk>=3.10.3 # pin transitive rouge-score/lm-eval dep for known GHSAs
lm-eval[api]>=0.4.12 # required for model evaluation test
mteb[bm25s]>=2, <3 # required for mteb test
transformers==5.20.2
transformers==5.21.1
schemathesis>=4.0.0 # Required for openai schema test
# quantization
bitsandbytes==0.50.0
Expand Down
2 changes: 1 addition & 1 deletion requirements/test/rocm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ traitlets==5.16.1
# via
# jupyter-client
# jupyter-core
transformers==5.20.2
transformers==5.21.1
# via
# -c requirements/common.txt
# -r requirements/test/../common.txt
Expand Down
2 changes: 1 addition & 1 deletion requirements/test/xpu.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ nltk>=3.10.3 # pin transitive rouge-score/lm-eval dep for known GHSAs
modelscope<1.38
runai-model-streamer[s3,gcs,azure]>=0.15.7
tensorizer==2.10.1
transformers==5.20.2
transformers==5.21.1

# --- Audio Processing ---
av
Expand Down
2 changes: 1 addition & 1 deletion requirements/test/xpu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ traitlets==5.16.1
# via
# jupyter-client
# jupyter-core
transformers==5.20.2
transformers==5.21.1
# via
# -c requirements/common.txt
# -r requirements/test/../common.txt
Expand Down
14 changes: 14 additions & 0 deletions vllm/model_executor/models/minicpmv4_6.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import numpy as np
import torch
import transformers
from packaging.version import Version
from PIL import Image as PILImage
from torch import nn
from transformers import MiniCPMV4_6Config
Expand Down Expand Up @@ -122,6 +124,12 @@ def _expand_flags(value: object, num_items: int) -> list[bool | None]:
return [any(bool(v) for v in raw)] * num_items


# Transformers >= 5.21 sizes images by the `downsample_mode` merge factor
RESIZE_TAKES_DOWNSAMPLE_MODE = Version(transformers.__version__) >= Version(
"5.21.0.dev0"
)


def _vision_downsample_mode(flag: bool | None) -> str | None:
if flag is None:
return None
Expand Down Expand Up @@ -739,6 +747,9 @@ def _compute_visual_tokens(
scale_res = image_processor.scale_resolution
downsample_mode = self._get_downsample_mode(downsample_mode)
token_divisor = 4 if downsample_mode == "4x" else 16
resize_kwargs = (
{"downsample_mode": downsample_mode} if RESIZE_TAKES_DOWNSAMPLE_MODE else {}
)

# vLLM ImageSize is (width, height); transformers expects (height, width)
hf_image_size = (image_size.height, image_size.width)
Expand All @@ -762,6 +773,7 @@ def _compute_visual_tokens(
scale_res,
patch_size,
allow_upscale=True,
**resize_kwargs,
)
source_tokens = (
best_size[0] * best_size[1] // (patch_size * patch_size * token_divisor)
Expand All @@ -772,6 +784,7 @@ def _compute_visual_tokens(
hf_image_size,
scale_res,
patch_size,
**resize_kwargs,
)
source_tokens = (
best_resize[0] * best_resize[1] // (patch_size * patch_size * token_divisor)
Expand All @@ -782,6 +795,7 @@ def _compute_visual_tokens(
scale_res,
patch_size,
allow_upscale=True,
**resize_kwargs,
)
patch_w = refine_size[0] // grids[0]
patch_h = refine_size[1] // grids[1]
Expand Down