Skip to content

Commit

Permalink
[BugFix] Add value.contiguous in attention to avoid some accuracy pro…
Browse files Browse the repository at this point in the history
…blems. (#95)

fix an accuracy problem caused by missing of value contiguous

Signed-off-by: hw_whx <[email protected]>
Co-authored-by: hw_whx <[email protected]>
  • Loading branch information
whx-sjtu and hw_whx authored Feb 19, 2025
1 parent 65c2795 commit 36e9d6e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions vllm_ascend/attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,8 @@ def forward(
query = query.view(-1, self.num_heads, self.head_size)
key = key.view(-1, self.num_kv_heads, self.head_size)
value = value.view(-1, self.num_kv_heads, self.head_size)
# TODO: Remove this contiguous in the future.
value = value.contiguous()

output = torch.empty(num_tokens,
self.num_heads,
Expand Down

0 comments on commit 36e9d6e

Please sign in to comment.