SDPA
This commit is contained in:
parent
fcb884643b
commit
74d7fc65c6
2 changed files with 2 additions and 0 deletions
|
|
@ -309,6 +309,7 @@ def LlamaAttention_fast_forward(
|
|||
V = V.transpose(1, 2)
|
||||
A = flash_attn_func(Q, K, V, causal = True)
|
||||
else:
|
||||
print("0", end = "")
|
||||
# Grouped query attention
|
||||
if n_groups != 1:
|
||||
K = K[:, :, None, :, :].expand(bsz, n_kv_heads, n_groups, kv_seq_len, head_dim)
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ def MistralAttention_fast_forward(
|
|||
window = (-1, -1) if (kv_seq_len <= sw) else (sw, sw)
|
||||
A = flash_attn_func(Q, K, V, causal = True, window_size = window)
|
||||
else:
|
||||
print("0", end = "")
|
||||
# Grouped query attention
|
||||
# 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