Skip to content
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

feat: limit tokenizers cache size #3577

Merged

Conversation

jacopo-chevallard
Copy link
Collaborator

We limit the number of preloaded tokenizers to 3 and the maximum size to 50 MB

Copy link

linear bot commented Jan 29, 2025

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jan 29, 2025
_cache: dict[
int, tuple["LLMTokenizer", int, float]
] = {} # {hash: (tokenizer, size_bytes, last_access_time)}
_max_cache_size_mb: int = 50
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tu peux mettre un peu plus gros je pense - 100MB par exemple

@StanGirard StanGirard merged commit e2a3bcb into main Jan 29, 2025
6 checks passed
@StanGirard StanGirard deleted the feature/ent-524-implement-lru-cache-tokenizer-max-size-3 branch January 29, 2025 15:05
StanGirard added a commit that referenced this pull request Jan 30, 2025
🤖 I have created a release *beep* *boop*
---


##
[0.0.31](core-0.0.30...core-0.0.31)
(2025-01-30)


### Features

* cache tokenizers
([#3558](#3558))
([699dc2e](699dc2e))
* limit tokenizers cache size
([#3577](#3577))
([e2a3bcb](e2a3bcb))
* remove pympler dependency and add better way to calculate size of
tokenizer cache ([#3580](#3580))
([2fbd5d4](2fbd5d4))
* remove tokenizer load
([#3576](#3576))
([05e212a](05e212a))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants