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

ERROR occurs when running "tokenizer._tokenizer.model.clear_cache()" #1738

Open
nixonjin opened this issue Feb 21, 2025 · 0 comments
Open

ERROR occurs when running "tokenizer._tokenizer.model.clear_cache()" #1738

nixonjin opened this issue Feb 21, 2025 · 0 comments

Comments

@nixonjin
Copy link

nixonjin commented Feb 21, 2025

I met an OOM problem when using BertTokenizer as #1539 reports.

Then I use tokenizer._tokenizer.model.clear_cache() or tokenizer._tokenizer.model._clear_cache() to clear cache.

However, I met an error: AttributeError: 'tokenizers.models.WordPiece' object has no attribute 'clear_cache', could anyone tell me how to fix it?

In the source code, It seems like clear_cache only supports BPE and Unigram tokenizer, not wordpiece tokenizer, is it the reason? if it is, could anyone give me some advice to fix this problem?

environment:
run on linux with only cpu
tokenizers==0.21.0
transformers==4.49.0

@nixonjin nixonjin changed the title ERROR occur where running "tokenizer._tokenizer.model.clear_cache()" ERROR occurs where running "tokenizer._tokenizer.model.clear_cache()" Feb 21, 2025
@nixonjin nixonjin changed the title ERROR occurs where running "tokenizer._tokenizer.model.clear_cache()" ERROR occurs when running "tokenizer._tokenizer.model.clear_cache()" Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant