Repository navigation
fix(cache): honor configured disk cache capacity - #2400
Open
DiadkoShmek wants to merge 2 commits into
Open
DiadkoShmek wants to merge 2 commits into
DiadkoShmek wants to merge 2 commits into
Conversation
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
LlamaDiskCache accepts
capacity_bytesbut opens its diskcache backend without asize_limit.The backend can therefore evict a state below the requested capacity because it still uses its default 1 GiB limit or a smaller persisted limit.
Pass the requested capacity to diskcache when opening it and disable backend batch culling so the existing manual trim keeps recent states that fit.
Fixes #1402.
The regression uses a real SQLite-backed cache with a small persisted budget, reopens it with a larger requested budget, and checks that a serialized LlamaState which fits the new budget survives.
Adjacent tests verify that oversized states are still evicted and a full cache retains the newest fitting states.
Validation: the new regression fails before the fix; 9 cache/speculative/chat-format/grammar tests and 2 official native version/tokenization tests pass after it;
make lintpasses.Built the pinned CPU backend on Linux x86_64 / Python 3.13 with four build jobs.
No model was downloaded; the full model-backed suite was not run locally.