-
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
Contrastive Search peak memory reduction #24120
Merged
Merged
Changes from 1 commit
Commits
Show all changes
117 commits
Select commit
Hold shift + click to select a range
e9c05dc
added hidden subset
blbadger 9c4b96a
Merge pull request #1 from blbadger/master
blbadger fc52166
debugged hidden subset contrastive search
blbadger f16ac72
Merge pull request #2 from blbadger/master
blbadger 3906d60
added contrastive search compression
blbadger 40ebe76
Merge pull request #3 from blbadger/master
blbadger 2881aef
debugged compressed contrastive search
blbadger 4ddf45b
Merge pull request #4 from blbadger/master
blbadger 7d29c55
memory reduction for contrastive search
blbadger b0b98cb
Merge pull request #5 from blbadger/master
blbadger 57dfaac
debugged mem red
blbadger a419245
Merge pull request #6 from blbadger/master
blbadger fd0e19f
added low memory option feature
blbadger fc03ab2
Merge pull request #7 from blbadger/master
blbadger 802cfd4
debugged mem optmimization output stack
blbadger 0632f06
debugged mem optmimization output stack
blbadger 8318968
Merge pull request #8 from blbadger/master
blbadger 9bad256
debugged low mem
blbadger 8fa1731
Merge pull request #9 from blbadger/master
blbadger a89bb8e
added low mem cache
blbadger cdbd070
Merge pull request #10 from blbadger/master
blbadger f90f948
fixed 2047 tensor view
blbadger 65feec9
Merge pull request #11 from blbadger/master
blbadger e1718c3
debugged 2042 past key val inputs
blbadger 089a299
Merge pull request #12 from blbadger/master
blbadger 3fd54e6
reformatted tensors
blbadger 6d6ac75
Merge pull request #13 from blbadger/master
blbadger 12d5aea
changed low mem output
blbadger 89f9b13
Merge pull request #14 from blbadger/master
blbadger 44a9ec4
final clean
blbadger 37bb62d
removed subset hidden csearch
blbadger 68c1cd8
fixed hidden device
blbadger e199ddc
fixed hidden device
blbadger 8ace5a3
changed compressor dtype
blbadger 1ac80a0
removed hstate compression
blbadger 1c3aae7
integrated csearch in generate
blbadger f18bccd
test csearch integration into generation
blbadger abf0a72
fixed csearch kwarg integration with generation
blbadger e517d5f
final wrap and added doc
blbadger cc1ea6d
Update src/transformers/generation/utils.py
blbadger bd2e36b
Update src/transformers/generation/utils.py
blbadger b59ec6d
Update src/transformers/generation/utils.py
blbadger a7fb76e
added debug print
blbadger 961a1ba
direct hstate cat
blbadger 882b6d2
direct hstate cat
blbadger c3f3db3
direct hstate cat debug
blbadger 692b5e1
direct hstate cat debug
blbadger 349bbf9
expanded full hidden state stack
blbadger cd4bed0
expanded full hidden state stack
blbadger ae41c50
matched dims for hstates
blbadger 30baaa6
matched dims for hstates
blbadger ebc19ff
logits fix
blbadger 752a488
equality test
blbadger 4f973ba
equality hidden debug
blbadger b809415
debug
blbadger 9230061
added prints for debug
blbadger 2863471
added prints for debug
blbadger e653353
equality check
blbadger d790ea5
switched squeeze dim
blbadger f194221
input format debug
blbadger 665c323
tracing top_k_ids
blbadger 6259b56
removed trace
blbadger 55561bb
Merge pull request #16 from blbadger/equal-csearch
blbadger 7f52d87
Merge branch 'huggingface:main' into main
blbadger 6d2734c
added test context
blbadger a873dfd
Merge pull request #17 from blbadger/equal-csearch
blbadger 4033b19
added jitter
blbadger e2051a7
added jitter
blbadger e8f4cd1
added jitter
blbadger 6bed197
returned state
blbadger 67946f2
rebuilt past key value reconstruction
blbadger 3dbd776
debugged
blbadger 547df69
cleaned traces
blbadger f4b1f28
added selection for pkv
blbadger d1af0f0
changed output to dict
blbadger fbb11b5
Merge pull request #18 from blbadger/selected-pkv
blbadger ee94a31
cleaned
blbadger 5cfd454
cleaned
blbadger b63ec63
Merge pull request #19 from blbadger/selected-pkv
blbadger 2fbca35
cleaned up contrastive search test
blbadger 29b16f7
Merge pull request #20 from blbadger/selected-pkv
blbadger efcba6f
moved low_memory kwarg
blbadger 5a3b26c
debugged
blbadger fb337c3
Merge pull request #21 from blbadger/selected-pkv
blbadger cf12230
changed low mem test batch size to 1
blbadger 60fd185
removed output
blbadger 0e4fd99
Merge pull request #22 from blbadger/selected-pkv
blbadger a3355c1
debugged test input shape
blbadger 704e9b1
Merge pull request #23 from blbadger/selected-pkv
blbadger 87be0de
reformatted csearch test
blbadger 8564437
Merge pull request #24 from blbadger/selected-pkv
blbadger ab307f9
added trace
blbadger dfff73d
removed unsqueeze on final forward pass
blbadger 0334d12
replaced unsqueeze with view
blbadger 06dacc0
removed traces
blbadger 94d6dd9
cleaned
blbadger fe78f81
Merge pull request #25 from blbadger/selected-pkv
blbadger a2293dd
debugged model kwargs
blbadger 150d1a1
Merge pull request #26 from blbadger/selected-pkv
blbadger 0deba21
removed special models from test
blbadger 5237cf0
Merge pull request #27 from blbadger/selected-pkv
blbadger 05c408e
Merge branch 'main' into main
blbadger f9bd670
Merge branch 'huggingface:main' into main
blbadger 1aa7279
ran make quality
blbadger 8129e2a
Merge branch 'huggingface:main' into main
blbadger 871cf59
Update src/transformers/generation/configuration_utils.py
blbadger ef6bfd6
Update src/transformers/generation/configuration_utils.py
blbadger bad2d18
refactored
blbadger f16f2e7
refactored
blbadger af70bef
refactored
blbadger d82e792
Merge pull request #28 from blbadger/selected-pkv
blbadger 2d21e64
make fixup
blbadger f310f83
Merge pull request #29 from blbadger/selected-pkv
blbadger bf3a073
renamed flag sequential
blbadger b11c156
renamed flag sequential
blbadger c619204
Merge pull request #30 from blbadger/selected-pkv
blbadger 1ae9d4a
Merge branch 'huggingface:main' into main
blbadger 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
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.
These lines exit in both the if (low memory) and else (not low memory) code blocks, but note that they are not easily refactored because
next_hidden
andfull_hidden_states
must be returned iteratively for eachtop_k
token when low memory is activated, but otherwise they are only returned once batch-wise.