-
Notifications
You must be signed in to change notification settings - Fork 31.4k
New DynamicSlidingWindowLayer & associated Cache #40039
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
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
534a6a4 to
41d55aa
Compare
|
All good now, slow tests on mistral, gemma2 and t5gemma are all similar to main (only a slight fa2 issue that surfaced on a slow test for mistral, but it's unrelated and solved by #40002) |
ArthurZucker
left a comment
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.
Perfect! This is long due especially for mistral models, but will also be effective for gpt oss (hybrid sliding I think, sliding window is 128 so would generate the graph for this one as well!)
|
[For maintainers] Suggested jobs to run (before merge) run-slow: arcee, aria, bitnet, cohere, cohere2, csm, deepseek_v2, deepseek_v3, diffllama, doge, dots1, emu3, ernie4_5, exaone4, fsmt, gemma2 |
What does this PR do?
As per the title. To avoid wasting memory for models with sliding window. As I don't want to reintroduce static hybrid caches by default to avoid all the pitfalls of automatic compilation, but don't want to waste that memory, this is definitely the way to go.
The only change that is needed is to pass the
configtoDynamicCache, to be able to parsesliding_window/layer_types. If we don't, then the behavior is exactly the same as before.See the following figures for an illustration:
Bonus:
Adding the benchmark script for posterity: