IncliToken
A simple Byte Pair Encoding (BPE) tokenizer implementation from scratch in Python.
Installation
uv add inclitoken
Or you can use pip:
pip install inclitoken
Usage
from inclitoken.tokenizer import BPETokenizer
# Initialize tokenizer
tokenizer = BPETokenizer()
# Train on your text
text = "Hello world! This is a simple example."
tokenizer.train(text, turns=100, verbose=False)
# Encode text to token IDs
ids = tokenizer.encode("Hello world!")
print(ids)
# Decode token IDs back to text
decoded = tokenizer.decode(ids)
print(decoded)
Features
- Train custom BPE tokenizers on your text
- Encode text into token IDs
- Decode token IDs back into text
- Track merge operations and vocabulary
Requirements
- Python >= 3.14
- tqdm
Author
Built by Adarsh Dubey
Metadata
Release files for inclitoken 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| inclitoken-0.1.0.tar.gz | 3.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| inclitoken-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.9 kB
Release files / inclitoken-0.1.0.tar.gz
| Download URL | inclitoken-0.1.0.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
044b61399c8c727726dc4e01c4b8a6cfe3a3dc9c95ec9bb582a9892c5842c070
|
|
BLAKE2b-256 checksum How to use checksums |
c659591c182d271f177727ef38993abbf6cfbe9bb0c12eac6d61dfae02c68582
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.7
|
Release files / inclitoken-0.1.0-py3-none-any.whl
| Download URL | inclitoken-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
930b64db0ebe9087fd8d6713524de46b6e243c5f79cc1e6b51862a648ed45144
|
|
BLAKE2b-256 checksum How to use checksums |
c2fec9242cfe53715ea14a8dac9e6e53723143f0086633bb7803ff2fa9d52e7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.7
|