-
Notifications
You must be signed in to change notification settings - Fork 31.1k
[Refactor Attention mask handling] Moves attention mask processing to the Attention class
#28132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
2518876
refactor attention in LlamaAttention for now
ArthurZucker 7bf5962
update mask in the correct places
ArthurZucker a9734d7
cleanup
ArthurZucker db35c83
fixup0
ArthurZucker d5ace03
nits
ArthurZucker 3dc777a
pass more tests
ArthurZucker e126711
fix nit
ArthurZucker 24e07d4
nit
ArthurZucker e63bf49
one more nit
ArthurZucker d276285
nits
ArthurZucker 98c9080
this passes the test but control flow might not be the best
ArthurZucker 5bb4662
Merge branch 'main' of github.com:huggingface/transformers into refac…
ArthurZucker 1dc571d
the simplest fix yet
ArthurZucker 53888f8
style as well
ArthurZucker 1e323f8
revert
ArthurZucker 5d51dc0
YES
ArthurZucker 5580e29
nits
ArthurZucker 00917b2
revert wrong change
ArthurZucker 5d6d031
nit
ArthurZucker a446a09
giga nit
ArthurZucker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as seen with you offline, this cannot work as-is due to sharing across model instances
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes will either not cache it at the class level but instance level a tril. Or pass it as kwargs. Jax does not seem to care so should not be too bad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we pass the
attention_maskjust into thecache.update(...)function?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check that as well, but that doesn't help for all type of attention we have which need a pre-processed mask, will work after the pre-processing tho