@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / a6022e6fbc
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 14, 05:30 UTC

GLM-4.5V with new class name at transformers (#22520)

Signed-off-by: zRzRzRzRzRzRzR <2448370773@qq.com> Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn> Co-authored-by: Isotr0py <mozf@mail2.sysu.edu.cn>

Yuxuan Zhang committed Aug 9, 2025 at 15:50 UTC a6022e6fbcbdba65e3c0e6dce5c9e3cbc8120e90
5 files changed +13 -6
docs/models/supported_models.md
+2 -2
@@ -352,6 +352,7 @@ th {
352 | `Gemma3nForConditionalGeneration` | Gemma 3n | `google/gemma-3n-E2B-it`, `google/gemma-3n-E4B-it`, etc. | | | ✅︎ |
353 | `GlmForCausalLM` | GLM-4 | `zai-org/glm-4-9b-chat-hf`, etc. | ✅︎ | ✅︎ | ✅︎ |
354 | `Glm4ForCausalLM` | GLM-4-0414 | `zai-org/GLM-4-32B-0414`, etc. | ✅︎ | ✅︎ | ✅︎ |
355 +| `Glm4MoeForCausalLM` | GLM-4.5 | `zai-org/GLM-4.5`, etc. | ✅︎ | ✅︎ | ✅︎ |
356 | `GPT2LMHeadModel` | GPT-2 | `gpt2`, `gpt2-xl`, etc. | | ✅︎ | ✅︎ |
357 | `GPTBigCodeForCausalLM` | StarCoder, SantaCoder, WizardCoder | `bigcode/starcoder`, `bigcode/gpt_bigcode-santacoder`, `WizardLM/WizardCoder-15B-V1.0`, etc. | ✅︎ | ✅︎ | ✅︎ |
358 | `GPTJForCausalLM` | GPT-J | `EleutherAI/gpt-j-6b`, `nomic-ai/gpt4all-j`, etc. | | ✅︎ | ✅︎ |
@@ -609,8 +610,7 @@ These models primarily accept the [`LLM.generate`](./generative_models.md#llmgen
610 | `Gemma3ForConditionalGeneration` | Gemma 3 | T + I<sup>+</sup> | `google/gemma-3-4b-it`, `google/gemma-3-27b-it`, etc. | ✅︎ | ✅︎ | ⚠️ |
611 | `GLM4VForCausalLM`<sup>^</sup> | GLM-4V | T + I | `zai-org/glm-4v-9b`, `zai-org/cogagent-9b-20241220`, etc. | ✅︎ | ✅︎ | ✅︎ |
612 | `Glm4vForConditionalGeneration` | GLM-4.1V-Thinking | T + I<sup>E+</sup> + V<sup>E+</sup> | `zai-org/GLM-4.1V-9B-Thinking`, etc. | ✅︎ | ✅︎ | ✅︎ |
612 -| `Glm4MoeForCausalLM` | GLM-4.5 | T + I<sup>E+</sup> + V<sup>E+</sup> | `zai-org/GLM-4.5`, etc. | ✅︎ | ✅︎ | ✅︎ |
613 -| `Glm4v_moeForConditionalGeneration` | GLM-4.5V | T + I<sup>E+</sup> + V<sup>E+</sup> | `zai-org/GLM-4.5V`, etc. | ✅︎ | ✅︎ | ✅︎ |
613 +| `Glm4vMoeForConditionalGeneration` | GLM-4.5V | T + I<sup>E+</sup> + V<sup>E+</sup> | `zai-org/GLM-4.5V`, etc. | ✅︎ | ✅︎ | ✅︎ |
614 | `GraniteSpeechForConditionalGeneration` | Granite Speech | T + A | `ibm-granite/granite-speech-3.3-8b` | ✅︎ | ✅︎ | ✅︎ |
615 | `H2OVLChatModel` | H2OVL | T + I<sup>E+</sup> | `h2oai/h2ovl-mississippi-800m`, `h2oai/h2ovl-mississippi-2b`, etc. | | ✅︎ | ✅︎ |
616 | `Idefics3ForConditionalGeneration` | Idefics3 | T + I | `HuggingFaceM4/Idefics3-8B-Llama3`, etc. | ✅︎ | | ✅︎ |
tests/models/registry.py
+1 -1
@@ -396,7 +396,7 @@ _MULTIMODAL_EXAMPLE_MODELS = {
396 trust_remote_code=True,
397 hf_overrides={"architectures": ["GLM4VForCausalLM"]}), # noqa: E501
398 "Glm4vForConditionalGeneration": _HfExamplesInfo("zai-org/GLM-4.1V-9B-Thinking"), # noqa: E501
399 - "Glm4v_moeForConditionalGeneration": _HfExamplesInfo("zai-org/GLM-4.5V",
399 + "Glm4vMoeForConditionalGeneration": _HfExamplesInfo("zai-org/GLM-4.5V",
400 is_available_online=False), # noqa: E501
401 "H2OVLChatModel": _HfExamplesInfo("h2oai/h2ovl-mississippi-800m",
402 trust_remote_code=True,
vllm/model_executor/models/glm4_moe.py
+7 -1
@@ -372,7 +372,13 @@ class Glm4MoeDecoderLayer(nn.Module):
372 return hidden_states, residual
373
374
375 -@support_torch_compile
375 +@support_torch_compile(
376 + dynamic_arg_dims={
377 + "input_ids": 0,
378 + "positions": -1,
379 + "intermediate_tensors": 0,
380 + "inputs_embeds": 0,
381 + })
382 class Glm4MoeModel(nn.Module):
383
384 def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
vllm/model_executor/models/registry.py
+1 -1
@@ -207,7 +207,7 @@ _MULTIMODAL_MODELS = {
207 "Gemma3ForConditionalGeneration": ("gemma3_mm", "Gemma3ForConditionalGeneration"), # noqa: E501
208 "GLM4VForCausalLM": ("glm4v", "GLM4VForCausalLM"),
209 "Glm4vForConditionalGeneration": ("glm4_1v", "Glm4vForConditionalGeneration"), # noqa: E501
210 - "Glm4v_moeForConditionalGeneration": ("glm4_1v", "Glm4vForConditionalGeneration"), # noqa: E501
210 + "Glm4vMoeForConditionalGeneration": ("glm4_1v", "Glm4vForConditionalGeneration"), # noqa: E501
211 "GraniteSpeechForConditionalGeneration": ("granite_speech", "GraniteSpeechForConditionalGeneration"), # noqa: E501
212 "H2OVLChatModel": ("h2ovl", "H2OVLChatModel"),
213 "InternVLChatModel": ("internvl", "InternVLChatModel"),
vllm/transformers_utils/config.py
+2 -1
@@ -254,7 +254,8 @@ def _uses_mrope(config: PretrainedConfig) -> bool:
254
255 def uses_mrope(config: PretrainedConfig) -> bool:
256 """Detect if the model with this config uses M-ROPE."""
257 - return _uses_mrope(config) or thinker_uses_mrope(config)
257 + return _uses_mrope(config) or _uses_mrope(
258 + config.get_text_config()) or thinker_uses_mrope(config)
259
260
261 def thinker_uses_mrope(config: PretrainedConfig) -> bool: