[Llama FA2] Re-add _expand_attention_mask and clean a couple things#27074
Merged
patrickvonplaten merged 12 commits intomainfrom Oct 26, 2023
Merged
[Llama FA2] Re-add _expand_attention_mask and clean a couple things#27074patrickvonplaten merged 12 commits intomainfrom
patrickvonplaten merged 12 commits intomainfrom
Conversation
4 tasks
Contributor
Author
|
@ArthurZucker could you give this a quick review? It'd make the Bart FA PR much easier to continue and should also fix the better transformers problem with optimum |
|
The documentation is not available anymore as the PR was closed or merged. |
Collaborator
|
Of course! |
ArthurZucker
approved these changes
Oct 26, 2023
Comment on lines
+67
to
+71
| def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Optional[int] = None): | ||
| warnings.warn( | ||
| "Calling `transformers.models.llama.modeling_llama._expand_mask` is deprecated and will be removed in v4.37. Use `transformers.models.llama.modeling_llama.AttnMaskConverter._expand_mask" | ||
| ) | ||
| return AttnMaskConverter._expand_mask(mask=mask, dtype=dtype, tgt_len=tgt_len) |
Collaborator
There was a problem hiding this comment.
Nice! We should probably do the same for falcon and mistral as well
Contributor
Author
There was a problem hiding this comment.
Think in optimum only the llama mask utils are imported: https://github.com/huggingface/optimum/blob/313e1bd0de2b44aaa71797464f1e8b6a041a6f18/optimum/bettertransformer/models/attention.py#L25
EduardoPach
pushed a commit
to EduardoPach/transformers
that referenced
this pull request
Nov 19, 2023
…uggingface#27074) * clean * clean llama * fix more * make style * Apply suggestions from code review * Apply suggestions from code review * Update src/transformers/models/llama/modeling_llama.py * Update src/transformers/models/llama/modeling_llama.py * Apply suggestions from code review * finish * make style
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR cleans the attention mask converter a bit more, corrects some docstrings and removes outdated comments and deprecates
_expand_attention_maskto fix optimum.