This commit is contained in:
Daniel Han-Chen 2024-02-04 02:03:23 +11:00
commit 74d7fc65c6
2 changed files with 2 additions and 0 deletions

View file

@ -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)

View file

@ -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)