@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 978a37c823
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 8, 16:30 UTC

[Model] GLM adaptation (#34124)

Jee Jee Li committed Feb 9, 2026 at 17:32 UTC 978a37c82387ce4a40aaadddcdbaf4a06fc4d590
7 files changed +13 -3
benchmarks/kernels/benchmark_moe.py
+1
@@ -686,6 +686,7 @@ def get_model_params(config):
686 "DeepseekV2ForCausalLM",
687 "DeepseekV3ForCausalLM",
688 "DeepseekV32ForCausalLM",
689 + "GlmMoeDsaForCausalLM",
690 "Glm4MoeForCausalLM",
691 "Glm4MoeLiteForCausalLM",
692 "NemotronHForCausalLM",
tests/models/registry.py
+3
@@ -275,6 +275,9 @@ _TEXT_GENERATION_EXAMPLE_MODELS = {
275 "zai-org/GLM-4.7-Flash",
276 min_transformers_version="5.0.0",
277 ),
278 + "GlmMoeDsaForCausalLM": _HfExamplesInfo(
279 + "zai-org/GLM-5", min_transformers_version="5.0.1", is_available_online=False
280 + ),
281 "GPT2LMHeadModel": _HfExamplesInfo("openai-community/gpt2", {"alias": "gpt2"}),
282 "GPTBigCodeForCausalLM": _HfExamplesInfo(
283 "bigcode/starcoder",
tests/models/test_initialization.py
+1 -1
@@ -97,7 +97,7 @@ def can_initialize(
97 "pickle error when loading `transformers.models.auto.CONFIG_MAPPING`"
98 )
99
100 - if model_arch == "DeepseekV32ForCausalLM":
100 + if model_arch in ["DeepseekV32ForCausalLM", "GlmMoeDsaForCausalLM"]:
101 from vllm.platforms import current_platform
102
103 capability = current_platform.get_device_capability()
vllm/config/speculative.py
+1 -1
@@ -181,7 +181,7 @@ class SpeculativeConfig:
181 @staticmethod
182 def hf_config_override(hf_config: PretrainedConfig) -> PretrainedConfig:
183 initial_architecture = hf_config.architectures[0]
184 - if hf_config.model_type in ("deepseek_v3", "deepseek_v32"):
184 + if hf_config.model_type in ("deepseek_v3", "deepseek_v32", "glm_moe_dsa"):
185 hf_config.model_type = "deepseek_mtp"
186 if hf_config.model_type == "deepseek_mtp":
187 n_predict = getattr(hf_config, "num_nextn_predict_layers", None)
vllm/model_executor/models/deepseek_v2.py
+5 -1
@@ -836,7 +836,7 @@ class DeepseekV2MLAAttention(nn.Module):
836 qk_rope_head_dim,
837 max_position=max_position_embeddings,
838 rope_parameters=config.rope_parameters,
839 - is_neox_style=True,
839 + is_neox_style=not getattr(config, "indexer_rope_interleave", True),
840 )
841 self.indexer = Indexer(
842 vllm_config,
@@ -1499,6 +1499,10 @@ class DeepseekV3ForCausalLM(DeepseekV2ForCausalLM):
1499 pass
1500
1501
1502 +class GlmMoeDsaForCausalLM(DeepseekV2ForCausalLM):
1503 + pass
1504 +
1505 +
1506 # Compatibility with
1507 # https://huggingface.co/deepseek-ai/DeepSeek-V3-Base/blob/main/configuration_deepseek.py
1508 def get_spec_layer_idx_from_weight_name(
vllm/model_executor/models/registry.py
+1
@@ -114,6 +114,7 @@ _TEXT_GENERATION_MODELS = {
114 "Glm4ForCausalLM": ("glm4", "Glm4ForCausalLM"),
115 "Glm4MoeForCausalLM": ("glm4_moe", "Glm4MoeForCausalLM"),
116 "Glm4MoeLiteForCausalLM": ("glm4_moe_lite", "Glm4MoeLiteForCausalLM"),
117 + "GlmMoeDsaForCausalLM": ("deepseek_v2", "GlmMoeDsaForCausalLM"),
118 "GptOssForCausalLM": ("gpt_oss", "GptOssForCausalLM"),
119 "GPT2LMHeadModel": ("gpt2", "GPT2LMHeadModel"),
120 "GPTBigCodeForCausalLM": ("gpt_bigcode", "GPTBigCodeForCausalLM"),
vllm/transformers_utils/model_arch_config_convertor.py
+1
@@ -237,6 +237,7 @@ class ModelArchConfigConvertorBase:
237 "deepseek_v3",
238 "deepseek_v32",
239 "deepseek_mtp",
240 + "glm_moe_dsa",
241 "glm4_moe_lite",
242 "glm4_moe_lite_mtp",
243 "kimi_k2",