Skip to content

Commit

Permalink
supprot fa-2 + right padding + forward
Browse files Browse the repository at this point in the history
  • Loading branch information
younesbelkada committed Oct 18, 2023
1 parent 5a73316 commit df8ebb2
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 @@ -876,6 +876,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 df8ebb2

Please sign in to comment.