Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
flash-attention
Commits
19d12610
You need to sign in or sign up before continuing.
Commit
19d12610
authored
Aug 09, 2022
by
Tri Dao
Browse files
Add back need_weights in FlashMHA
parent
6cc73425
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
flash_attn/flash_attention.py
flash_attn/flash_attention.py
+1
-1
No files found.
flash_attn/flash_attention.py
View file @
19d12610
...
@@ -98,7 +98,7 @@ class FlashMHA(nn.Module):
...
@@ -98,7 +98,7 @@ class FlashMHA(nn.Module):
self
.
inner_attn
=
FlashAttention
(
attention_dropout
=
attention_dropout
,
**
factory_kwargs
)
self
.
inner_attn
=
FlashAttention
(
attention_dropout
=
attention_dropout
,
**
factory_kwargs
)
self
.
out_proj
=
nn
.
Linear
(
embed_dim
,
embed_dim
,
bias
=
bias
,
**
factory_kwargs
)
self
.
out_proj
=
nn
.
Linear
(
embed_dim
,
embed_dim
,
bias
=
bias
,
**
factory_kwargs
)
def
forward
(
self
,
x
,
key_padding_mask
=
None
):
def
forward
(
self
,
x
,
key_padding_mask
=
None
,
need_weights
=
False
):
"""x: (batch, seqlen, hidden_dim) (where hidden_dim = num heads * head dim)
"""x: (batch, seqlen, hidden_dim) (where hidden_dim = num heads * head dim)
key_padding_mask: bool tensor of shape (batch, seqlen)
key_padding_mask: bool tensor of shape (batch, seqlen)
"""
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment