Update llama.py
This commit is contained in:
parent
5d4182c774
commit
ebf8187d70
1 changed files with 2 additions and 2 deletions
|
|
@ -449,12 +449,12 @@ def LlamaAttention_fast_forward(
|
|||
else:
|
||||
# Grouped query attention
|
||||
if SDPA_HAS_GQA:
|
||||
print(attention_mask)
|
||||
# Needs (batch_size, n_heads, seq_len, head_dim)
|
||||
# is_casual and attention_mask must not be both set!
|
||||
Q, K, V = Q.contiguous(), K.contiguous(), V.contiguous()
|
||||
A = scaled_dot_product_attention(Q, K, V, attn_mask = attention_mask, is_causal = False, enable_gqa = n_groups != 1)
|
||||
# Go back to (batch_size, seq_len, n_heads, head_dim)
|
||||
A = A.transpose(1, 2)#.contiguous()
|
||||
A = A.transpose(1, 2).contiguous()
|
||||
else:
|
||||
if n_groups != 1:
|
||||
K = K[:, :, None, :, :].expand(bsz, n_kv_heads, n_groups, kv_seq_len, head_dim)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue