-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
Reducing memory usage: removing useless logits computation in generate() #31292
Merged
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
1748ff1
Add .float() in all generation methods logit outputs
Cyrilvallez 3f4f4e8
Switch float-casting of logits to training only for main models
Cyrilvallez 727c7e4
Add `num_logits_to_keep` in Llama and add it by default in generate
Cyrilvallez 222017d
Apply style
Cyrilvallez dc709c6
Add num_logits_to_keep as arg in prepare_input_for_generation
Cyrilvallez d2f1566
Add support for Mistral
Cyrilvallez f2ef90c
Revert models except llama and mistral
Cyrilvallez ce7b980
Fix default None value in _supports_num_logits_to_keep()
Cyrilvallez d4201f4
Fix dimension of dummy input
Cyrilvallez b15b5de
Add exception for prophetnet in _supports_num_logits_to_keep()
Cyrilvallez 95e0807
Update _supports_num_logits_to_keep() to use inspect.signature()
Cyrilvallez 12db045
Add deprecation cycle + remove modification with pretraining_tp
Cyrilvallez b224e24
Apply style
Cyrilvallez f0e1034
Add most used models
Cyrilvallez 9ac57db
Apply style
Cyrilvallez f7421b6
Make `num_logits_to_keep` an int in all cases to remove if-else clause
Cyrilvallez c8f9177
Add compile check for the warning
Cyrilvallez 5e1589e
Fix torch versions
Cyrilvallez 7998b65
style
Cyrilvallez 8fa8018
Add gemma2
Cyrilvallez b49fe76
Update warning version
Cyrilvallez cf9378a
Add comment about .float operations in generation utils
Cyrilvallez 66e3e9d
Add tests in GenerationTesterMixin and ModelTesterMixin
Cyrilvallez e4c5a71
Fix batch size for assisted decoding in tests
Cyrilvallez b68ee16
fix small issues in test
Cyrilvallez e837425
refacor test
Cyrilvallez 26863ca
fix slicing removing dim issue
Cyrilvallez 3c3eeaa
Add nemotron support (should fix check-copy issue in CIs)
Cyrilvallez c400865
Trigger new CIs
Cyrilvallez 802eca8
Trigger new CIs
Cyrilvallez 4d6fae6
Bump version
Cyrilvallez f12f172
Bump version in TODO
Cyrilvallez 7b1a26c
Trigger CIs
Cyrilvallez b11b048
remove blank space
Cyrilvallez f03adfb
Trigger CIs
Cyrilvallez 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
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
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
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
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
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
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.
Maybe let's comment that we need .float() for full precision soft