Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions vllm/model_executor/models/glm4_1v.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,15 +419,16 @@ def forward(
max_seqlen: Optional[int] = None, # Only used for Flash Attention
seqlens: Optional[list[int]] = None, # Only used for xFormers
) -> torch.Tensor:
x = x + self.attn(
x_attn = self.attn(
self.norm1(x),
cu_seqlens=cu_seqlens,
rotary_pos_emb=rotary_pos_emb,
max_seqlen=max_seqlen,
seqlens=seqlens,
)
x_fused_norm, residual = self.norm2(x, residual=x_attn)
x = residual + self.mlp(x_fused_norm)
Comment on lines +429 to +430
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The original code x = residual + self.mlp(x_fused_norm) might introduce a correctness issue. It seems that the residual x from the input of norm2 is not considered in the calculation. It is crucial to add the initial x before applying the MLP to maintain the residual connection properly. This could lead to incorrect results in the model's output.

Consider changing the calculation to x = x + residual + self.mlp(x_fused_norm) to address this issue.

x = x + residual + self.mlp(x_fused_norm)


x = x + self.mlp(self.norm2(x))
return x


Expand Down
Loading