-
Notifications
You must be signed in to change notification settings - Fork 33.1k
[cache] make all classes cache compatible finally #38635
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
Merged
zucchini-nlp
merged 65 commits into
huggingface:main
from
zucchini-nlp:cache-class-finalize
Jul 16, 2025
Merged
Changes from all commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
5d14a87
dump
zucchini-nlp 5c5825b
push other models
zucchini-nlp 051fe7f
fix simple greedy generation
zucchini-nlp b04ddbc
xmod
zucchini-nlp 6a289a7
add fmst and clean up some mentions of old cache format
zucchini-nlp b3be72b
gpt-bigcode now follows standards
zucchini-nlp 85061bc
delete tuple cache reference in generation
zucchini-nlp 1424600
fix some models
zucchini-nlp 02fb0d2
fix some models
zucchini-nlp f7494bc
fix mambas and support cache in tapas
zucchini-nlp 576fb7b
fix some more tests
zucchini-nlp 8757e84
fix copies
zucchini-nlp bcf0cc7
delete `_reorder_cache`
zucchini-nlp 91d92f1
another fix copies
zucchini-nlp edf5f6e
fix typos and delete unnecessary test
zucchini-nlp b236e90
fix rag generate, needs special cache reordering
zucchini-nlp 1893f8a
fix tapas and superglue
zucchini-nlp 46e50b5
reformer create special cache
zucchini-nlp 204ed55
recurrent gemma `reorder_cache` was a no-op, delete
zucchini-nlp 7b61dfd
fix-copies
zucchini-nlp 69c20ae
fix blio and musicgen pipeline tests
zucchini-nlp d281a6c
Merge branch 'main' into cache-class-finalize
zucchini-nlp b508814
fix reformer
zucchini-nlp b7deae6
fix reformer, again...
zucchini-nlp ae88ecc
delete `_supports_cache_class`
zucchini-nlp f1ec0ba
delete `supports_quantized_cache`
zucchini-nlp 8f5d8a0
fix failing tests
zucchini-nlp 08ad1b0
fix copies
zucchini-nlp dfdf50b
some minor clean up
zucchini-nlp e9a281f
style
zucchini-nlp e735b87
merge main, so many conflicts
zucchini-nlp e1a3fc4
style
zucchini-nlp 3190a9e
fix copies
zucchini-nlp 2f942f8
fix tests
zucchini-nlp 0fc0159
merge main
zucchini-nlp ccdd784
fix copies
zucchini-nlp 63f1bd3
create causal mask now needs positions?
zucchini-nlp 2dc3b01
fixc copies
zucchini-nlp f050810
merge main
zucchini-nlp e945d2f
style
zucchini-nlp 8a7a05b
Update tests/test_modeling_common.py
zucchini-nlp ce665c0
clean-up of non-generative model after merging main
zucchini-nlp d0f68d0
check `is_decoder` for cache
zucchini-nlp 72bc51a
delete transpose for scores
zucchini-nlp ac73959
remove tuple cache from docs everywhere
zucchini-nlp fd84e67
fix tests
zucchini-nlp 7c2d5b6
fix copies
zucchini-nlp 122564e
fix copies once more
zucchini-nlp b265287
properly deprecate `encoder_attention_mask` in Bert-like models
zucchini-nlp 8218c5b
import `deprecate_kwarg` where needed
zucchini-nlp bb1866c
fix copies again
zucchini-nlp b9fe72c
Merge branch 'main' into cache-class-finalize
zucchini-nlp b67a4c3
fix copies
zucchini-nlp 5eeeeb3
delete `nex_decoder_cache`
zucchini-nlp 5231ed5
fix copies asks to update for PLM
zucchini-nlp 27e9539
merge main
zucchini-nlp 5a74509
fix copies
zucchini-nlp 011ee19
rebasing had a few new models, fix them and merge asap!
zucchini-nlp 91f8072
fix copies once more
zucchini-nlp ec311c3
fix slow tests
zucchini-nlp 78d44b4
Merge branch 'main' into cache-class-finalize
zucchini-nlp f9592f6
fix tests and updare PLM checkpoint
zucchini-nlp abccbee
add read token and revert accidentally removed line
zucchini-nlp 327b9e1
oh com -on, style
zucchini-nlp 651febb
just skip it, read token has no access to PLM yet
zucchini-nlp 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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1971,13 +1971,9 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, PushToHubMixin, PeftAdapterMi | |
| # Flex Attention support | ||
| _supports_flex_attn = False | ||
|
|
||
| # Has support for a `Cache` instance as `past_key_values`? Does it support a `StaticCache`? | ||
| _supports_cache_class = False | ||
| # Has support `torch.compile(fullgraph=True)` | ||
|
Contributor
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. +1 to renaming this flag into |
||
| _supports_static_cache = False | ||
|
|
||
| # Has support for a `QuantoQuantizedCache` instance as `past_key_values` | ||
| _supports_quantized_cache = False | ||
|
|
||
| # A tensor parallel plan to be applied to the model when TP is enabled. For | ||
| # top-level models, this attribute is currently defined in respective model | ||
| # code. For base models, this attribute comes from | ||
|
|
||
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
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
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
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
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.
models like rag or reformer have their own special cache reorder logic, which I didn't remove. I don't think it is worth aligning these models with
past_key_values.reorder_cachebecause they're pretty low usage