Comments (8)
Hey, could you share a reproducer?
Some things are related to the fact that we keep track of the offset and a lot of information, which tiktoken does not.
But we could only do this when ask and improve speed potentially.
from tokenizers.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
from tokenizers.
It's high in my priority to do benchmarks and improve our code if needed!
from tokenizers.
For HF, we use
from transformers import GPT2Tokenizer
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
text = "xxx"
start = time.time()
encoded_input = tokenizer.encode(truncated_text)
end = time.time()
For tiktoken, we just initialize the tokenizer by tiktoken, all the other are the same
tokenizer = tiktoken.encoding_for_model("gpt-2")
please let me know if you need any other information
from tokenizers.
You are using GPT2Tokenizer
which is the slow one. Use GPT2TokenizerFast 😅
from tokenizers.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
from tokenizers.
We actually dived a bit:
- Rayon parallelism is kinda broken
- we have concurency on the cache for GPT2
- We have memory allocation that are also slowing down
With #1560, was able to get similar performances as tiktoken, keep posted 😉
from tokenizers.
One thing tho, is that tiktoken forces the spilt of very long sequences. If you split them in batch you are already gonna have quite a lot better perfs
from tokenizers.
Related Issues (20)
- documentation of the `pattern` parameter in `pre_tokenizers.Split` is incorrect HOT 1
- Custom fast PreTokenizer, ported via PyO3 to Python HOT 2
- Tokenizer.from_bytes() not available in python bindings HOT 4
- BPE Split pretokenization rule is not reflected in the vocabulary HOT 2
- Truncation performs slowly. Tokenizer firstly encodes long sequence and then truncates it. HOT 2
- apply_chat_template api usage consult
- Issue with `SentencePieceUnigramTokenizer` Handling Unknown Tokens HOT 1
- `train_from_iterator` out of memory on WMT14 `de` dataset HOT 2
- return pytorch tensors like in transformers? HOT 5
- Risk of global variable memory leaks when calling train_from_iterator HOT 1
- [building on windows] onig_sys/oniguruma two or more data types in declaration specifiers HOT 2
- ValueError: The following `model_kwargs` are not used by the model: ['num_beans'] (note: typos in the generate arguments will also show up in this list)[06/Aug/2024 14:34:35] HOT 1
- Support for Golang now or support a cli for other languages? HOT 2
- Token ID Out of Range & Indexing Assertion Errors During Training HOT 4
- [test-infra] Enable Codecov for tokenizers
- `RefMutContainer` is unsound HOT 3
- Space after unnormalized token is added when `use_fast=True` for Llama tokenizer HOT 10
- Can I use SentencePieceBPETokenizer to replace google/sentencepiece? HOT 6
- .NET bindings
- BPE trainer ignoring special tokens. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tokenizers.