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
chenpangpang
transformers
Commits
bc4bbd9f
Unverified
Commit
bc4bbd9f
authored
Oct 19, 2023
by
Younes Belkada
Committed by
GitHub
Oct 19, 2023
Browse files
[`FA-2` / `Mistral`] Supprot fa-2 + right padding + forward (#26912)
supprot fa-2 + right padding + forward
parent
cbd278f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
0 deletions
+1
-0
src/transformers/models/mistral/modeling_mistral.py
src/transformers/models/mistral/modeling_mistral.py
+1
-0
No files found.
src/transformers/models/mistral/modeling_mistral.py
View file @
bc4bbd9f
...
@@ -879,6 +879,7 @@ class MistralModel(MistralPreTrainedModel):
...
@@ -879,6 +879,7 @@ class MistralModel(MistralPreTrainedModel):
padding_mask
is
not
None
padding_mask
is
not
None
and
hasattr
(
self
.
config
,
"_flash_attn_2_enabled"
)
and
hasattr
(
self
.
config
,
"_flash_attn_2_enabled"
)
and
self
.
config
.
_flash_attn_2_enabled
and
self
.
config
.
_flash_attn_2_enabled
and
past_key_values
is
not
None
):
):
is_padding_right
=
padding_mask
[:,
-
1
].
sum
().
item
()
!=
batch_size
is_padding_right
=
padding_mask
[:,
-
1
].
sum
().
item
()
!=
batch_size
if
is_padding_right
:
if
is_padding_right
:
...
...
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