Skip to content

Commit

Permalink
[FA-2 / Mistral] Supprot fa-2 + right padding + forward (huggingf…
Browse files Browse the repository at this point in the history
…ace#26912)

supprot fa-2 + right padding + forward
  • Loading branch information
younesbelkada authored and staghado committed Oct 24, 2023
1 parent abcfe35 commit 8fd2bf3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/transformers/models/mistral/modeling_mistral.py
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,7 @@ def forward(
padding_mask is not None
and hasattr(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
if is_padding_right:
Expand Down

0 comments on commit 8fd2bf3

Please sign in to comment.