mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-10 04:05:01 +08:00
[Model] Switch to Fused RMSNorm in GLM-4.1V model (#24733)
Signed-off-by: SamitHuang <285365963@qq.com>
This commit is contained in:
parent
b0d1213ac3
commit
f17c075884
@ -419,15 +419,16 @@ class Glm4vVisionBlock(nn.Module):
|
|||||||
max_seqlen: Optional[int] = None, # Only used for Flash Attention
|
max_seqlen: Optional[int] = None, # Only used for Flash Attention
|
||||||
seqlens: Optional[list[int]] = None, # Only used for xFormers
|
seqlens: Optional[list[int]] = None, # Only used for xFormers
|
||||||
) -> torch.Tensor:
|
) -> torch.Tensor:
|
||||||
x = x + self.attn(
|
x_attn = self.attn(
|
||||||
self.norm1(x),
|
self.norm1(x),
|
||||||
cu_seqlens=cu_seqlens,
|
cu_seqlens=cu_seqlens,
|
||||||
rotary_pos_emb=rotary_pos_emb,
|
rotary_pos_emb=rotary_pos_emb,
|
||||||
max_seqlen=max_seqlen,
|
max_seqlen=max_seqlen,
|
||||||
seqlens=seqlens,
|
seqlens=seqlens,
|
||||||
)
|
)
|
||||||
|
x_fused_norm, residual = self.norm2(x, residual=x_attn)
|
||||||
|
x = residual + self.mlp(x_fused_norm)
|
||||||
|
|
||||||
x = x + self.mlp(self.norm2(x))
|
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user