[Chore] Remove vendored code made redundant by Transformers 5.16.1 (#60623)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Harry Mellor
2026-10-09 09:29:03 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent bc713cf8cc
commit 2c99ee9333
76 changed files with 719 additions and 3268 deletions
+5 -11
View File
@@ -10,13 +10,11 @@ from typing import cast
from unittest.mock import Mock
import pytest
from transformers import PreTrainedConfig
from transformers import DiffusionGemmaConfig, PreTrainedConfig
from transformers.models.gemma4.configuration_gemma4 import Gemma4TextConfig
from vllm.config import ModelConfig, ParallelConfig, SpeculativeConfig
from vllm.config.model_arch import ModelArchitectureConfig
from vllm.transformers_utils.configs.diffusion_gemma import DiffusionGemmaConfig
from vllm.transformers_utils.configs.gemma4 import gemma4_layer_config
from vllm.transformers_utils.model_arch_config_convertor import (
MODEL_ARCH_CONFIG_CONVERTORS,
Gemma4ModelArchConfigConvertor,
@@ -318,11 +316,7 @@ def _gemma4_text_config(**overrides) -> Gemma4TextConfig:
def test_gemma4_head_dims_vary_by_layer_type():
"""Gemma4's full attention layers are wider than its sliding ones.
Transformers >= 5.15.0 says so in the config; this exercises the convertor
building the same per-layer view from the flat attributes used before that.
"""
"""Gemma4's full attention layers are wider than its sliding ones."""
text_config = _gemma4_text_config(
num_global_key_value_heads=8, attention_k_eq_v=True
)
@@ -332,9 +326,9 @@ def test_gemma4_head_dims_vary_by_layer_type():
assert (arch.head_size, arch.total_num_kv_heads) == (32, 8)
assert [arch[i].head_size for i in range(6)] == [16] * 5 + [32]
assert [arch[i].total_num_kv_heads for i in range(6)] == [4] * 5 + [8]
# The model files resolve each layer through the same helper, so the KV cache
# vLLM allocates and the projections the model builds cannot disagree.
assert [gemma4_layer_config(text_config, i).head_dim for i in range(6)] == [
# The model files read the same per-layer configs, so the KV cache vLLM
# allocates and the projections the model builds cannot disagree.
assert [text_config.per_layer_config[i].head_dim for i in range(6)] == [
arch[i].head_size for i in range(6)
]
@@ -14,7 +14,6 @@ from transformers import AutoTokenizer
import vllm.envs as envs
from tests.utils import RemoteOpenAIServer
from vllm.config import ModelConfig
from vllm.config.utils import getattr_iter
from vllm.v1.engine.detokenizer import check_stop_strings
MODEL_NAME = "Qwen/Qwen3-0.6B"
@@ -402,14 +401,7 @@ async def test_same_response_as_chat_completions(client, tokenizer, messages):
# Post-EOS generation is undefined and may differ
eos_tokens = {
tokenizer.eos_token_id,
*getattr_iter(
tokenizer,
[
"extra_special_tokens_ids", # Transformers v5
"additional_special_tokens_ids", # Transformers v4
],
[],
),
*tokenizer.extra_special_tokens_ids,
}
# Find first EOS in generated tokens
eos_pos = None
@@ -12,6 +12,7 @@ from unittest.mock import patch
import pytest
import torch
from torch import nn
from transformers import Qwen3_5MoeTextConfig
import vllm.config as vllm_config_module
from vllm.config import ParallelConfig, VllmConfig, set_current_vllm_config
@@ -34,7 +35,6 @@ from vllm.models.deepseek_v4 import quant_config as deepseek_v4_quant_config
from vllm.models.minimax_m3.amd import model as minimax_m3_model
from vllm.platforms import current_platform
from vllm.transformers_utils.configs.minimax_m3 import MiniMaxM3TextConfig
from vllm.transformers_utils.configs.qwen3_5_moe import Qwen3_5MoeTextConfig
pytestmark = pytest.mark.skipif(
current_platform.is_xpu(),
@@ -9,14 +9,12 @@ from collections import defaultdict
from pathlib import PosixPath
import pytest
from packaging.version import Version
from transformers import (
AutoModel,
AutoModelForCausalLM,
AutoModelForImageTextToText,
AutoModelForTextToWaveform,
)
from transformers import __version__ as TRANSFORMERS_VERSION
from vllm.platforms import current_platform
from vllm.utils.func_utils import identity
@@ -818,8 +816,7 @@ VLM_TEST_SETTINGS = {
patch_hf_runner=model_utils.paddleocr_vl_patch_hf_runner,
image_size_factors=[(0.25,)],
marks=[
pytest.mark.skipif(
Version(TRANSFORMERS_VERSION) >= Version("5.0.0"),
pytest.mark.skip(
reason="Model's custom code uses ROPE_INIT_FUNCTIONS"
"['default'] which was removed in transformers v5",
),
@@ -249,9 +249,9 @@ def test_repeated_image_hits_the_processor_cache():
"BAAI/Emu3-Chat-hf",
"<image> and more text",
marks=pytest.mark.xfail(
reason="Emu3Processor prepends its BOS token only when images are "
"passed, so the unexpanded prompt vLLM tokenizes never "
"gets one. Fixed by huggingface/transformers#47924, unreleased.",
reason="Emu3Processor prepends the BOS token itself because the "
"tokenizer doesn't, so the unexpanded prompt vLLM tokenizes "
"never gets one.",
strict=False,
),
),
+2 -10
View File
@@ -775,10 +775,7 @@ _MULTIMODAL_EXAMPLE_MODELS = {
# [Decoder-only]
"AriaForConditionalGeneration": _HfExamplesInfo("rhymes-ai/Aria"),
"AudioFlamingo3ForConditionalGeneration": _HfExamplesInfo(
"nvidia/audio-flamingo-3-hf",
transformers_version_reason={
"vllm": "Needs https://github.com/huggingface/transformers/pull/43538"
},
"nvidia/audio-flamingo-3-hf"
),
"BagelForConditionalGeneration": _HfExamplesInfo("ByteDance-Seed/BAGEL-7B-MoT"),
"BailingMoeV3VLForConditionalGeneration": _HfExamplesInfo(
@@ -817,12 +814,7 @@ _MULTIMODAL_EXAMPLE_MODELS = {
"nvidia/Cosmos3-Edge",
max_model_len=4096,
use_original_num_layers=True,
hf_overrides={
"text_config": {
"num_hidden_layers": 2,
"hybrid_override_pattern": "*-",
}
},
hf_overrides={"text_config": {"layers_block_type": ["full_attention", "mlp"]}},
),
"DeepseekVLV2ForCausalLM": _HfExamplesInfo(
"deepseek-ai/deepseek-vl2-tiny",
@@ -6,9 +6,7 @@ import types
from unittest.mock import MagicMock, patch
import pytest
from packaging.version import Version
from transformers import BitsAndBytesConfig
from transformers import __version__ as TRANSFORMERS_VERSION
from vllm_bnb_plugin import bitsandbytes_loader as bnb
from vllm.platforms import current_platform
@@ -174,8 +172,7 @@ def test_load_pp_4bit_bnb_model(
)
@pytest.mark.skipif(
Version(TRANSFORMERS_VERSION) >= Version("5.0.0"),
@pytest.mark.skip(
reason="Need to add support for quantizing MoE experts with bnb in "
"transformers v5. See https://github.com/bitsandbytes-foundation/"
"bitsandbytes/issues/1849",
+1 -2
View File
@@ -6,7 +6,7 @@ from types import SimpleNamespace
from unittest.mock import patch
import pytest
from transformers import AutoConfig
from transformers import AutoConfig, Qwen3_5MoeConfig
from transformers.models.auto.configuration_auto import CONFIG_MAPPING
from vllm.tokenizers import TokenizerLike
@@ -18,7 +18,6 @@ from vllm.tokenizers.registry import (
get_tokenizer,
resolve_tokenizer_args,
)
from vllm.transformers_utils.configs.qwen3_5_moe import Qwen3_5MoeConfig
class TestTokenizer(TokenizerLike):