@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 55d6d3fdb8
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 15, 13:30 UTC

[Bugfix] Fix GLM rotary_dim issue and support v1 (#16912)

Signed-off-by: isotr0py <2037008807@qq.com>

Isotr0py committed Apr 21, 2025 at 22:26 UTC 55d6d3fdb8a08aec7c0b09be95c4982705921ab3
1 file changed +2 -3
vllm/model_executor/models/glm.py
+2 -3
@@ -3,13 +3,13 @@
3 from vllm.config import VllmConfig
4 from vllm.model_executor.models.llama import LlamaForCausalLM
5
6 -from .interfaces import SupportsV0Only
6 from .utils import PPMissingLayer
7
8
10 -class GlmForCausalLM(LlamaForCausalLM, SupportsV0Only):
9 +class GlmForCausalLM(LlamaForCausalLM):
10
11 def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
12 + vllm_config.model_config.hf_config.partial_rotary_factor = 0.5
13 super().__init__(vllm_config=vllm_config, prefix=prefix)
14 # Hack Llama model to fit HF format GLM implementation
15 # Attention difference between GLM and Llama:
@@ -17,7 +17,6 @@ class GlmForCausalLM(LlamaForCausalLM, SupportsV0Only):
17 # 2. There is no bias for o_proj in attention
18 for layer in self.model.layers:
19 if not isinstance(layer, PPMissingLayer):
20 - layer.self_attn.rotary_emb.rotary_dim //= 2
20 layer.self_attn.rotary_emb.is_neox_style = False
21 layer.self_attn.o_proj.bias = None
22 layer.self_attn.o_proj.skip_bias_add = True