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
[Model] Switch to Fused RMSNorm in GLM-4.1V model (#24733)
Signed-off-by: SamitHuang <285365963@qq.com>
Samit committed
Sep 13, 2025 at 00:12 UTC
f17c075884009a3bfb7c66cb0897719b8e18f196
1 file changed
+3
-2
vllm/model_executor/models/glm4_1v.py
+3
-2
@@ -419,15 +419,16 @@ class Glm4vVisionBlock(nn.Module):
419
max_seqlen: Optional[int] = None, # Only used for Flash Attention
420
seqlens: Optional[list[int]] = None, # Only used for xFormers
421
) -> torch.Tensor:
422
- x = x + self.attn(
422
+ x_attn = self.attn(
423
self.norm1(x),
424
cu_seqlens=cu_seqlens,
425
rotary_pos_emb=rotary_pos_emb,
426
max_seqlen=max_seqlen,
427
seqlens=seqlens,
428
)
429
+ x_fused_norm, residual = self.norm2(x, residual=x_attn)
430
+ x = residual + self.mlp(x_fused_norm)
431
430
- x = x + self.mlp(self.norm2(x))
432
return x
433
434