-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
Adding Flash Attention 2 Support for GPT2 #29226
Merged
amyeroberts
merged 33 commits into
huggingface:main
from
EduardoPach:add-flash-attn-gpt2
Mar 28, 2024
Merged
Changes from 27 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
bfd9a8f
First commit to add flash attention 2 for GPT-2
EduardoPach 333a867
more improvements
EduardoPach b4a053a
Make GPT2 pass tests and fixed Decison Transformers copies
EduardoPach eaaa6e4
Fixed missing arg
EduardoPach b5ded2e
fix copies
EduardoPach 774414b
Added expected speedup
EduardoPach d405771
Update src/transformers/models/gpt2/modeling_gpt2.py
EduardoPach 06bf96e
Update src/transformers/models/gpt2/modeling_gpt2.py
EduardoPach ad65025
Update src/transformers/models/gpt2/modeling_gpt2.py
EduardoPach bc7f558
Added test
EduardoPach 19f171d
Fixed attn attribute
EduardoPach 78c78f6
Update docs/source/en/model_doc/gpt2.md
EduardoPach a895172
Update docs/source/en/model_doc/gpt2.md
EduardoPach 74fb9bd
Update Decision transformer attentions
EduardoPach fc1cf99
More updates
EduardoPach cafc0f1
Passing tests
EduardoPach dcde56c
Merge remote-tracking branch 'upstream/main' into add-flash-attn-gpt2
EduardoPach 2ea5301
Fix copies
EduardoPach a67557f
Fix copies part 2
EduardoPach 6fe34ab
Merge remote-tracking branch 'upstream/main' into add-flash-attn-gpt2
EduardoPach c043c27
Merge remote-tracking branch 'upstream/main' into add-flash-attn-gpt2
EduardoPach c36c60a
Decision transformer updates
EduardoPach 656561b
Update src/transformers/models/gpt2/modeling_gpt2.py
EduardoPach 9be39bf
Merge remote-tracking branch 'upstream/main' into add-flash-attn-gpt2
EduardoPach 54935c5
Merge branch 'add-flash-attn-gpt2' of https://github.com/EduardoPach/…
EduardoPach 97c04ec
Fix copies
EduardoPach 5fb3a3d
Merge remote-tracking branch 'upstream/main' into add-flash-attn-gpt2
EduardoPach a938fc9
Decision transformer not supporting flash attn
EduardoPach 0c42513
Merge remote-tracking branch 'upstream/main' into add-flash-attn-gpt2
EduardoPach 393d17f
Merge remote-tracking branch 'upstream/main' into add-flash-attn-gpt2
EduardoPach 94c2fe8
Addressed comments
EduardoPach 343c04e
Addressed comments
EduardoPach 2799988
Addressed comments
EduardoPach 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 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
EduardoPach marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,8 +40,10 @@ FlashAttention-2 is currently supported for the following architectures: | |
* [Bark](https://huggingface.co/docs/transformers/model_doc/bark#transformers.BarkModel) | ||
* [Bart](https://huggingface.co/docs/transformers/model_doc/bart#transformers.BartModel) | ||
* [Cohere](https://huggingface.co/docs/transformers/model_doc/cohere#transformers.CohereModel) | ||
* [DecisionTransformer](https://huggingface.co/docs/transformers/en/model_doc/decision_transformer) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be removed |
||
* [DistilBert](https://huggingface.co/docs/transformers/model_doc/distilbert#transformers.DistilBertModel) | ||
* [Gemma](https://huggingface.co/docs/transformers/model_doc/gemma#transformers.GemmaModel) | ||
* [GPT2](https://huggingface.co/docs/transformers/model_doc/gpt2) | ||
* [GPTBigCode](https://huggingface.co/docs/transformers/model_doc/gpt_bigcode#transformers.GPTBigCodeModel) | ||
* [GPTNeo](https://huggingface.co/docs/transformers/model_doc/gpt_neo#transformers.GPTNeoModel) | ||
* [GPTNeoX](https://huggingface.co/docs/transformers/model_doc/gpt_neox#transformers.GPTNeoXModel) | ||
|
Oops, something went wrong.
Oops, something went wrong.
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.
We should have the equivalent added for decision transformer too
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.
See message above