Skip to content

Commit 004203e

Browse files
[CI/Build] Fix registry tests (#21934)
Signed-off-by: DarkLight1337 <[email protected]>
1 parent 5c765ae commit 004203e

File tree

6 files changed

+70
-19
lines changed

6 files changed

+70
-19
lines changed

tests/models/registry.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,10 @@ def check_available_online(
170170
min_transformers_version="4.54"),
171171
"Ernie4_5_MoeForCausalLM": _HfExamplesInfo("baidu/ERNIE-4.5-21B-A3B-PT",
172172
min_transformers_version="4.54"),
173-
"ExaoneForCausalLM": _HfExamplesInfo("LGAI-EXAONE/EXAONE-3.0-7.8B-Instruct"), # noqa: E501
174-
"Exaone4ForCausalLM": _HfExamplesInfo("LGAI-EXAONE/EXAONE-4.0-32B"), # noqa: E501
173+
"ExaoneForCausalLM": _HfExamplesInfo("LGAI-EXAONE/EXAONE-3.0-7.8B-Instruct",
174+
trust_remote_code=True),
175+
"Exaone4ForCausalLM": _HfExamplesInfo("LGAI-EXAONE/EXAONE-4.0-32B",
176+
min_transformers_version="4.54"),
175177
"Fairseq2LlamaForCausalLM": _HfExamplesInfo("mgleize/fairseq2-dummy-Llama-3.2-1B"), # noqa: E501
176178
"FalconForCausalLM": _HfExamplesInfo("tiiuae/falcon-7b"),
177179
"FalconH1ForCausalLM":_HfExamplesInfo("tiiuae/Falcon-H1-0.5B-Base",
@@ -199,8 +201,10 @@ def check_available_online(
199201
trust_remote_code=True),
200202
"HunYuanMoEV1ForCausalLM": _HfExamplesInfo("tencent/Hunyuan-A13B-Instruct",
201203
trust_remote_code=True),
204+
# TODO: Remove is_available_online once their config.json is fixed
202205
"HunYuanDenseV1ForCausalLM":_HfExamplesInfo("tencent/Hunyuan-7B-Instruct-0124",
203-
trust_remote_code=True),
206+
trust_remote_code=True,
207+
is_available_online=False),
204208
"HCXVisionForCausalLM": _HfExamplesInfo(
205209
"naver-hyperclovax/HyperCLOVAX-SEED-Vision-Instruct-3B",
206210
trust_remote_code=True),
@@ -275,7 +279,8 @@ def check_available_online(
275279
"StableLMEpochForCausalLM": _HfExamplesInfo("stabilityai/stablelm-zephyr-3b"), # noqa: E501
276280
"StableLmForCausalLM": _HfExamplesInfo("stabilityai/stablelm-3b-4e1t"),
277281
"Starcoder2ForCausalLM": _HfExamplesInfo("bigcode/starcoder2-3b"),
278-
"SolarForCausalLM": _HfExamplesInfo("upstage/solar-pro-preview-instruct"),
282+
"SolarForCausalLM": _HfExamplesInfo("upstage/solar-pro-preview-instruct",
283+
trust_remote_code=True),
279284
"TeleChat2ForCausalLM": _HfExamplesInfo("Tele-AI/TeleChat2-3B",
280285
trust_remote_code=True),
281286
"TeleFLMForCausalLM": _HfExamplesInfo("CofeAI/FLM-2-52B-Instruct-2407",
@@ -449,7 +454,8 @@ def check_available_online(
449454
max_model_len=4096),
450455
"Qwen2_5OmniModel": _HfExamplesInfo("Qwen/Qwen2.5-Omni-3B"),
451456
"Qwen2_5OmniForConditionalGeneration": _HfExamplesInfo("Qwen/Qwen2.5-Omni-7B-AWQ"), # noqa: E501
452-
"SkyworkR1VChatModel": _HfExamplesInfo("Skywork/Skywork-R1V-38B"),
457+
"SkyworkR1VChatModel": _HfExamplesInfo("Skywork/Skywork-R1V-38B",
458+
trust_remote_code=True),
453459
"SmolVLMForConditionalGeneration": _HfExamplesInfo("HuggingFaceTB/SmolVLM2-2.2B-Instruct"), # noqa: E501
454460
"UltravoxModel": _HfExamplesInfo("fixie-ai/ultravox-v0_5-llama-3_2-1b", # noqa: E501
455461
trust_remote_code=True),

vllm/model_executor/models/mpt.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import torch
1010
import torch.nn as nn
11-
from transformers import PretrainedConfig
11+
from transformers import MptConfig
1212

1313
from vllm.attention import Attention
1414
from vllm.compilation.decorators import support_torch_compile
@@ -50,7 +50,7 @@ class MPTAttention(nn.Module):
5050

5151
def __init__(
5252
self,
53-
config: PretrainedConfig,
53+
config: MptConfig,
5454
cache_config: Optional[CacheConfig] = None,
5555
quant_config: Optional[QuantizationConfig] = None,
5656
prefix: str = "",
@@ -59,15 +59,15 @@ def __init__(
5959
self.d_model = config.d_model
6060
self.total_num_heads = config.n_heads
6161
self.head_dim = self.d_model // self.total_num_heads
62-
self.clip_qkv = config.attn_config["clip_qkv"]
63-
self.qk_ln = config.attn_config["qk_ln"]
64-
self.alibi_bias_max = config.attn_config["alibi_bias_max"]
62+
self.clip_qkv = config.attn_config.clip_qkv
63+
self.qk_ln = config.attn_config.qk_ln
64+
self.alibi_bias_max = config.attn_config.alibi_bias_max
6565
if "kv_n_heads" in config.attn_config:
66-
self.total_num_kv_heads = config.attn_config['kv_n_heads']
66+
self.total_num_kv_heads = config.attn_config.kv_n_heads
6767
else:
6868
self.total_num_kv_heads = self.total_num_heads
69-
assert not config.attn_config["prefix_lm"]
70-
assert config.attn_config["alibi"]
69+
assert not config.attn_config.prefix_lm
70+
assert config.attn_config.alibi
7171

7272
# pylint: disable=invalid-name
7373
self.Wqkv = QKVParallelLinear(
@@ -144,7 +144,7 @@ class MPTMLP(nn.Module):
144144

145145
def __init__(
146146
self,
147-
config: PretrainedConfig,
147+
config: MptConfig,
148148
quant_config: Optional[QuantizationConfig] = None,
149149
):
150150
super().__init__()
@@ -176,7 +176,7 @@ class MPTBlock(nn.Module):
176176

177177
def __init__(
178178
self,
179-
config: PretrainedConfig,
179+
config: MptConfig,
180180
cache_config: Optional[CacheConfig] = None,
181181
quant_config: Optional[QuantizationConfig] = None,
182182
prefix: str = "",

vllm/model_executor/models/telechat2.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,20 @@
3737
class TeleChat2Model(LlamaModel):
3838

3939
def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
40+
hf_config = vllm_config.model_config.hf_config
41+
42+
vllm_config.model_config.hf_config.attribute_map = {
43+
"num_hidden_layers": "n_layer",
44+
"num_attention_heads": "n_head",
45+
"intermediate_size": "ffn_hidden_size",
46+
"rms_norm_eps": "layer_norm_epsilon"
47+
}
48+
vllm_config.model_config.hf_config.hidden_act = "silu"
49+
4050
# 1. Initialize the LlamaModel with bias
41-
vllm_config.model_config.hf_config.bias = True
42-
vllm_config.model_config.hf_config.mlp_bias = True
51+
hf_config.bias = True
52+
hf_config.mlp_bias = True
53+
4354
super().__init__(vllm_config=vllm_config, prefix=prefix)
4455
# 2. Remove the bias from the qkv_proj and gate_up_proj based on config
4556
# Telechat2's gate_up_proj and qkv_proj don't have bias

vllm/transformers_utils/config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
KimiVLConfig, MedusaConfig,
3535
MllamaConfig, MLPSpeculatorConfig,
3636
Nemotron_Nano_VL_Config,
37-
NemotronConfig, RWConfig,
38-
UltravoxConfig)
37+
NemotronConfig, NVLM_D_Config,
38+
RWConfig, UltravoxConfig)
3939
# yapf: enable
4040
from vllm.transformers_utils.configs.mistral import adapt_config_dict
4141
from vllm.transformers_utils.utils import check_gguf_file
@@ -81,6 +81,7 @@ def _get_hf_token() -> Optional[str]:
8181
"medusa": MedusaConfig,
8282
"eagle": EAGLEConfig,
8383
"nemotron": NemotronConfig,
84+
"NVLM_D": NVLM_D_Config,
8485
"ultravox": UltravoxConfig,
8586
**_CONFIG_REGISTRY_OVERRIDE_HF
8687
}

vllm/transformers_utils/configs/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from vllm.transformers_utils.configs.nemotron import NemotronConfig
2424
from vllm.transformers_utils.configs.nemotron_h import NemotronHConfig
2525
from vllm.transformers_utils.configs.nemotron_vl import Nemotron_Nano_VL_Config
26+
from vllm.transformers_utils.configs.nvlm_d import NVLM_D_Config
2627
from vllm.transformers_utils.configs.ultravox import UltravoxConfig
2728

2829
__all__ = [
@@ -39,5 +40,6 @@
3940
"NemotronConfig",
4041
"NemotronHConfig",
4142
"Nemotron_Nano_VL_Config",
43+
"NVLM_D_Config",
4244
"UltravoxConfig",
4345
]
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3+
4+
# Adapted from
5+
# https://huggingface.co/nvidia/NVLM-D-72B/blob/main/configuration_nvlm_d.py
6+
# --------------------------------------------------------
7+
# NVLM-D
8+
# Copyright (c) 2024 NVIDIA
9+
# Licensed under Apache 2.0 License [see LICENSE for details]
10+
# --------------------------------------------------------
11+
from transformers import Qwen2Config
12+
from transformers.configuration_utils import PretrainedConfig
13+
14+
15+
class NVLM_D_Config(PretrainedConfig):
16+
model_type = 'NVLM_D'
17+
is_composition = True
18+
19+
def __init__(self, vision_config=None, llm_config=None, **kwargs):
20+
super().__init__(**kwargs)
21+
22+
# Handle vision_config initialization
23+
if vision_config is None:
24+
vision_config = {}
25+
26+
# Handle llm_config initialization
27+
if llm_config is None:
28+
llm_config = {}
29+
30+
self.vision_config = PretrainedConfig(**vision_config)
31+
self.text_config = Qwen2Config(**llm_config)

0 commit comments

Comments
 (0)