Skip to content

Commit

Permalink
bug fix in fast attention
Browse files Browse the repository at this point in the history
  • Loading branch information
VarunGumma committed Aug 9, 2024
1 parent 390bb36 commit ad64f6d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion fairseq/modules/fast_grouped_query_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ def forward(
tgt_len, bsz, embed_dim = query.size()
src_len = tgt_len

dropout_p = self.dropout_p if self.training else 0

assert list(query.size()) == [tgt_len, bsz, embed_dim]
if key is not None:
src_len, key_bsz, _ = key.size()
Expand Down Expand Up @@ -378,7 +380,7 @@ def forward(
value=v,
is_causal=False,
attn_mask=combined_mask,
dropout_p=self.dropout_p,
dropout_p=dropout_p,
)

attn = rearrange(
Expand Down
4 changes: 3 additions & 1 deletion fairseq/modules/fast_multihead_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ def forward(
tgt_len, bsz, embed_dim = query.size()
src_len = tgt_len

dropout_p = self.dropout_p if self.training else 0

assert list(query.size()) == [tgt_len, bsz, embed_dim]
if key is not None:
src_len, key_bsz, _ = key.size()
Expand Down Expand Up @@ -337,7 +339,7 @@ def forward(
value=v,
is_causal=False,
attn_mask=combined_mask,
dropout_p=self.dropout_p,
dropout_p=dropout_p
)

attn = rearrange(
Expand Down

0 comments on commit ad64f6d

Please sign in to comment.