[Model] add GLM-5.3-Flash support (#53906)
This commit is contained in:
@@ -10,6 +10,7 @@ from types import SimpleNamespace
|
||||
from typing import cast
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
from transformers import PretrainedConfig
|
||||
|
||||
from vllm.config.model import ModelConfig
|
||||
@@ -19,6 +20,59 @@ from vllm.transformers_utils.config import (
|
||||
get_safetensors_params_metadata,
|
||||
try_get_generation_config,
|
||||
)
|
||||
from vllm.transformers_utils.configs.glm5_next import (
|
||||
Glm5NextConfig,
|
||||
Glm5NextTextConfig,
|
||||
Glm5NextVisionConfig,
|
||||
)
|
||||
|
||||
|
||||
def test_glm5_next_accepts_deepseek_sparse_attention_layers():
|
||||
layer_types = ["linear_attention", "deepseek_sparse_attention"]
|
||||
|
||||
config = Glm5NextTextConfig(
|
||||
num_hidden_layers=len(layer_types), layer_types=layer_types
|
||||
)
|
||||
|
||||
assert config.layer_types == layer_types
|
||||
assert config.layers_block_type == ["linear_attention", "attention"]
|
||||
|
||||
|
||||
def test_glm5_next_accepts_prebuilt_subconfigs():
|
||||
text_config = Glm5NextTextConfig(hidden_size=1024)
|
||||
vision_config = Glm5NextVisionConfig(hidden_size=768)
|
||||
|
||||
config = Glm5NextConfig(
|
||||
text_config=text_config,
|
||||
vision_config=vision_config,
|
||||
)
|
||||
|
||||
assert config.text_config is text_config
|
||||
assert config.vision_config is vision_config
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("kwargs", "option"),
|
||||
[
|
||||
(
|
||||
{"index_topk": 2048, "index_dsa_use_layernorm": False},
|
||||
"index_dsa_use_layernorm",
|
||||
),
|
||||
(
|
||||
{"index_topk": 2048, "index_kpool_compress": False},
|
||||
"index_kpool_compress",
|
||||
),
|
||||
(
|
||||
{"index_topk": 2048, "index_kpool_always_select_tail": False},
|
||||
"index_kpool_always_select_tail",
|
||||
),
|
||||
({"hres_vwnstyle": False}, "hres_vwnstyle"),
|
||||
({"mhc_no_norm_weight": True}, "mhc_no_norm_weight"),
|
||||
],
|
||||
)
|
||||
def test_glm5_next_rejects_unimplemented_config_options(kwargs, option):
|
||||
with pytest.raises(NotImplementedError, match=option):
|
||||
Glm5NextTextConfig(**kwargs)
|
||||
|
||||
|
||||
def test_get_llama3_eos_token():
|
||||
|
||||
Reference in New Issue
Block a user