Skip to content
Merged
2 changes: 1 addition & 1 deletion tests/config/base_model_arch_groundtruth.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
"text_model_type": "step3p5",
"hidden_size": 4096,
"total_num_hidden_layers": 45,
"total_num_attention_heads": 64,
"total_num_attention_heads": 96,
"head_size": 128,
"vocab_size": 128896,
"total_num_kv_heads": 8,
Expand Down
3 changes: 2 additions & 1 deletion tests/config/test_model_arch_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,8 @@ def test_deepseek_v4_convertor_splits_vision_architecture():
text-only DeepSeek-V4; the convertor routes it to the VL wrapper class
by rewriting hf_config.architectures (model-class resolution reads the
raw attribute)."""
from vllm.transformers_utils.configs.deepseek_v4 import DeepseekV4Config
from transformers import DeepseekV4Config
Comment thread
hmellor marked this conversation as resolved.
Resolved

from vllm.transformers_utils.model_arch_config_convertor import (
DeepseekV4ModelArchConfigConvertor,
)
Expand Down
4 changes: 1 addition & 3 deletions tests/kernels/attention/test_minimax_m3.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,9 +862,7 @@ def test_msa_indexer_impl_matches_triton(topk, index_dtype, monkeypatch):
vllm_config = create_vllm_config(
block_size=BLOCK_SIZE, max_model_len=8192, max_num_batched_tokens=8192
)
vllm_config.model_config.hf_config.sparse_attention_config = {
"sparse_num_index_heads": num_idx_heads
}
vllm_config.model_config.hf_config.index_n_heads = num_idx_heads

# Decode-first mixed batch: 2 decode reqs (q_len 1) then 2 prefill reqs. Long
# prefixes so every token sees > TOPK causal blocks (non-trivial selection).
Expand Down
11 changes: 6 additions & 5 deletions tests/model_executor/layers/test_fused_shared_expert.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import pytest
import torch
from torch import nn
from transformers import Qwen3_5MoeTextConfig
from transformers import MiniMaxM3VLTextConfig, Qwen3_5MoeTextConfig

import vllm.config as vllm_config_module
from vllm.config import ParallelConfig, VllmConfig, set_current_vllm_config
Expand All @@ -34,7 +34,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

pytestmark = pytest.mark.skipif(
current_platform.is_xpu(),
Expand Down Expand Up @@ -155,7 +154,7 @@ def get_fse_test_model_config(
) -> tuple[object, type[nn.Module]]:
config: object
if model_type == "minimax_m3":
config = MiniMaxM3TextConfig(
config = MiniMaxM3VLTextConfig(
hidden_size=128,
intermediate_size=32,
dense_intermediate_size=32,
Expand All @@ -165,9 +164,11 @@ def get_fse_test_model_config(
head_dim=128,
num_local_experts=2,
num_experts_per_tok=1,
moe_layer_freq=[0, 1],
sparse_attention_config=None,
mlp_layer_types=["dense", "sparse"],
rotary_dim=64,
n_shared_experts=1,
scoring_func="sigmoid",
use_routing_bias=True,
quantization_config=quantization_config,
)
return config, minimax_m3_model.MiniMaxM3Model
Expand Down
20 changes: 17 additions & 3 deletions tests/models/multimodal/processing/test_deepseek_v4_vl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,27 @@
"""DeepSeek-V4 VL processing helpers."""

from PIL import Image
from transformers import DeepseekV4Config

from vllm.models.deepseek_v4.common.mm_preprocess import (
DeepseekV4VLProcessingInfo,
DeepseekV4VLProcessor,
build_image_block_pad_free,
)
from vllm.transformers_utils.configs.deepseek_v4 import DeepseekV4Config

# Vision fields of deepseek-ai/DeepSeek-V4-Flash-Vision-Exp
VISION_CONFIG = dict(
vision_n_layers=24,
vision_dim=1024,
vision_n_heads=16,
vision_inter_dim=2816,
vision_patch_size=14,
vision_rope_theta=10000.0,
vision_downsample_ratio=3,
vision_max_n_token=384,
vision_min_pixels=147456,
vision_max_wh_ratio=8,
)


class _ConfigCtx:
Expand All @@ -34,7 +48,7 @@ def test_get_image_size_with_most_features_beats_wide_real_image():

A square under-counts because each aligner row pays an IMAGE_NEW_LINE.
"""
config = DeepseekV4Config(vision_n_layers=24)
config = DeepseekV4Config(**VISION_CONFIG)
info = DeepseekV4VLProcessingInfo(_ConfigCtx(config))
processor = DeepseekV4VLProcessor(config)

Expand All @@ -47,7 +61,7 @@ def test_get_image_size_with_most_features_beats_wide_real_image():


def test_get_image_size_with_most_features_respects_max_wh_ratio():
config = DeepseekV4Config(vision_n_layers=24)
config = DeepseekV4Config(**VISION_CONFIG)
info = DeepseekV4VLProcessingInfo(_ConfigCtx(config))
dummy = info.get_image_size_with_most_features()
assert dummy.width / dummy.height <= config.vision_max_wh_ratio
47 changes: 6 additions & 41 deletions tests/models/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,7 @@ def check_available_online(
"CohereLabs/c4ai-command-r7b-12-2024",
trust_remote_code=True,
),
"Cohere2MoeForCausalLM": _HfExamplesInfo(
"CohereLabs/North-Mini-Code",
trust_remote_code=True,
is_available_online=False,
),
"Cohere2MoeForCausalLM": _HfExamplesInfo("CohereLabs/North-Mini-Code-1.0"),
"CwmForCausalLM": _HfExamplesInfo("facebook/cwm"),
# FIXME: databricks/dbrx-instruct has been deleted
"DbrxForCausalLM": _HfExamplesInfo(
Expand Down Expand Up @@ -661,6 +657,7 @@ def check_available_online(
"ModernVBERT/colmodernvbert-merged",
),
"ColPaliForRetrieval": _HfExamplesInfo("vidore/colpali-v1.3-hf"),
"ModernVBertModel": _HfExamplesInfo("ModernVBERT/colmodernvbert-merged"),
"ColQwen3": _HfExamplesInfo(
"TomoroAI/tomoro-colqwen3-embed-4b", trust_remote_code=True
),
Expand Down Expand Up @@ -813,8 +810,6 @@ def check_available_online(
"Cosmos3EdgeForConditionalGeneration": _HfExamplesInfo(
"nvidia/Cosmos3-Edge",
max_model_len=4096,
use_original_num_layers=True,
hf_overrides={"text_config": {"layers_block_type": ["full_attention", "mlp"]}},
),
"DeepseekVLV2ForCausalLM": _HfExamplesInfo(
"deepseek-ai/deepseek-vl2-tiny",
Expand Down Expand Up @@ -860,21 +855,10 @@ def check_available_online(
"FireRedASR2ForConditionalGeneration": _HfExamplesInfo(
"allendou/FireRedASR2-LLM-vllm",
trust_remote_code=True,
max_transformers_version="5.1",
transformers_version_reason={
"vllm": "Incompatible with transformers v5.2+ "
"(dict object has no attribute '__name__').",
},
),
"FunASRForConditionalGeneration": _HfExamplesInfo(
"FunAudioLLM/Fun-ASR-Nano-2512-vllm",
trust_remote_code=True,
max_transformers_version="5.15",
transformers_version_reason={
"vllm": "The official Fun-ASR-Nano vLLM package is validated "
"through transformers v5.15.0; newer versions require separate "
"validation.",
},
),
"FunAudioChatForConditionalGeneration": _HfExamplesInfo(
"funaudiochat", is_available_online=False
Expand Down Expand Up @@ -952,11 +936,6 @@ def check_available_online(
extras={"0.2-2B-Preview": "PerceptronAI/Isaac-0.2-2B-Preview"},
max_transformers_version="4.57",
transformers_version_reason={
"vllm": (
"Custom Isaac code is not compatible with Transformers v5. "
"The model should be upstreamed to Transformers for "
"long-term support."
),
"hf": (
"Isaac's remote model and processor code import or configure "
"APIs that changed in Transformers v5."
Expand All @@ -966,20 +945,13 @@ def check_available_online(
"InternS1ForConditionalGeneration": _HfExamplesInfo(
"internlm/Intern-S1",
trust_remote_code=True,
max_transformers_version="4.57",
transformers_version_reason={
"vllm": "Custom tokenizer code is not compatible with Transformers v5."
},
),
"InternS1ProForConditionalGeneration": _HfExamplesInfo(
"internlm/Intern-S1-Pro",
trust_remote_code=True,
max_transformers_version="5.14.1",
transformers_version_reason={
"vllm": (
"Remote video processor code imports "
"`BASE_VIDEO_PROCESSOR_DOCSTRING`, removed in Transformers 5.15."
)
"hf": "Remote modeling code imports `OutputRecorder`, removed in v5."
},
),
"InternS2MobiusForConditionalGeneration": _HfExamplesInfo(
Expand Down Expand Up @@ -1216,9 +1188,10 @@ def check_available_online(
"OpenCUAForConditionalGeneration": _HfExamplesInfo(
"xlangai/OpenCUA-7B",
trust_remote_code=True,
revision="refs/pr/10",
max_transformers_version="4.57",
transformers_version_reason={
"vllm": "Tokenizer cannot be initialised in Transformers v5."
"hf": "Remote modeling code is not compatible with Transformers v5."
},
),
"OpenPanguVLForConditionalGeneration": _HfExamplesInfo(
Expand Down Expand Up @@ -1283,15 +1256,7 @@ def check_available_online(
"Phi4ForCausalLMV": _HfExamplesInfo(
"microsoft/Phi-4-reasoning-vision-15B",
trust_remote_code=True,
max_transformers_version="5.3",
transformers_version_reason={
"vllm": (
"vllm upgraded transformers above v5.4 where HF model "
"custom code uses siglip2 internals "
"(filter_out_non_signature_kwargs) removed "
"by huggingface/transformers#43514"
)
},
revision="refs/pr/8",
),
"Phi4MMForCausalLM": _HfExamplesInfo(
"microsoft/Phi-4-multimodal-instruct", trust_remote_code=True
Expand Down
6 changes: 2 additions & 4 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2046,9 +2046,7 @@ def test_draft_inherits_ep_only_for_moe(
draft_is_moe: bool,
):
"""Validate final draft configs without loading weights or mocking validation."""
from transformers import LlamaConfig, MixtralConfig

from vllm.transformers_utils.configs.deepseek_v4 import DeepseekV4Config
from transformers import DeepseekV4Config, LlamaConfig, MixtralConfig

common = dict(
hidden_size=128,
Expand All @@ -2065,7 +2063,7 @@ def test_draft_inherits_ep_only_for_moe(
n_routed_experts=4,
num_experts_per_tok=2,
num_nextn_predict_layers=1,
compress_ratios=[1, 1],
layer_types=["sliding_attention"] * 2,
head_dim=32,
**common,
)
Expand Down
29 changes: 29 additions & 0 deletions tests/transformers_utils/test_deepseek_v4_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import pytest
from transformers import DeepseekV4Config

from vllm.transformers_utils.deepseek_v4_utils import (
get_compress_ratios,
get_mm_prefix_clamp_sliding_window,
get_num_hash_layers,
)

# Legacy fields as shipped by deepseek-ai/DeepSeek-V4-Flash-Vision-Exp
COMPRESS_RATIOS = [0, 0] + [4, 128] * 20 + [4, 0, 0, 0]


@pytest.mark.parametrize("vision_n_layers", [0, 32])
def test_legacy_fields_survive_upstream_config(vision_n_layers):
"""Upstream pops the legacy fields; the helpers must recover them."""
config = DeepseekV4Config(
num_hidden_layers=43,
num_nextn_predict_layers=3,
compress_ratios=COMPRESS_RATIOS,
num_hash_layers=3,
vision_n_layers=vision_n_layers,
)
assert not hasattr(config, "compress_ratios")
assert get_compress_ratios(config) == COMPRESS_RATIOS
assert get_num_hash_layers(config) == 3
assert get_mm_prefix_clamp_sliding_window(config) == (vision_n_layers > 0)
Loading
Loading