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

Feature request: ability to tokenize a list of strings _or_ keep the tokenizer warm #1763

Open
lsorber opened this issue Sep 25, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@lsorber
Copy link
Contributor

lsorber commented Sep 25, 2024

Situation: let's say you have a list of sentences you want to tokenize.

Current workaround:

from llama_cpp import Llama

embedder = Llama.from_pretrained(repo_id="lm-kit/bge-m3-gguf", filename="*F16.gguf", embedding=True)
sentences = ["Hello world"] * 1000
sentences_tokens = [embedder.tokenize(sentence.encode()) for sentence in sentences] 
# ↑ Each tokenize call has an overhead of 200-400ms

Problem: each call to tokenize appears to have an overhead of about 200-400ms. Which means tokenizing 1000 sentences will take 200-400 seconds 💥. Even tokenizing 10 sentences can take 4 seconds!

Feature request: either add the ability to tokenize a list of strings efficiently with tokenize, or add the ability to keep the tokenizer warm so that subsequent calls are not as slow as the first call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants