Skip to content

Commit

Permalink
Fix a bug for gqa (#101)
Browse files Browse the repository at this point in the history
* test

* test

* test
  • Loading branch information
ydli-ai authored Oct 11, 2023
1 parent f3d0f2c commit 1c09bcc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tencentpretrain/layers/multi_headed_attn.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ def unshape(x):

query, key, value = [linear_layer(x) for linear_layer, x in zip(self.linear_layers, [query, key, value])]

query = query.view(batch_size, seq_length, heads_num, per_head_size)
key = key.view(batch_size, seq_length, self.local_kv_heads_num, per_head_size)
value = value.view(batch_size, seq_length, self.local_kv_heads_num, per_head_size)
query = query.view(batch_size, -1, heads_num, per_head_size)
key = key.view(batch_size, -1, self.local_kv_heads_num, per_head_size)
value = value.view(batch_size, -1, self.local_kv_heads_num, per_head_size)

query = query.transpose(1, 2)
key = repeat_kv(key, self.repeat_num).transpose(1, 2)
Expand Down

0 comments on commit 1c09bcc

Please sign in to comment.