A highly efficient tokenizer framework (training, runtime)
  • Rust 95%
  • Shell 5%
Find a file
Andrés Correa Casablanca 6118bd5504
docs(trainer): document forced_tokens in the crate README
Signed-off-by: Andres Correa Casablanca <andreu@ctrlback.coop>
2026-06-06 21:41:38 +02:00
.hooks devex: avoid running benchmarks on pre-push 2026-06-06 17:14:11 +02:00
apps/tok3niz3r-cli feat(cli): add --force-token to pin 2-byte code points to their own token 2026-06-06 21:34:47 +02:00
data chore: wire tests 2026-06-06 17:09:16 +02:00
libs docs(trainer): document forced_tokens in the crate README 2026-06-06 21:41:38 +02:00
.gitignore chore: init repository 2026-06-06 16:43:06 +02:00
Cargo.lock chore: init repository 2026-06-06 16:43:06 +02:00
Cargo.toml chore: prepare for publishing 2026-06-06 17:32:32 +02:00
deny.toml chore: init repository 2026-06-06 16:43:06 +02:00
LICENSE.md chore: prepare for publishing 2026-06-06 17:32:32 +02:00
README.md chore: prepare for publishing 2026-06-06 17:32:32 +02:00
rustfmt.toml chore: init repository 2026-06-06 16:43:06 +02:00

tok3niz3r

A byte-level BPE tokenizer for Rust. Train a vocabulary from text, then encode and decode with it. It reads and writes HuggingFace tokenizer.json files, and it also has its own binary format that loads without parsing JSON and can be memory-mapped.

The project is split into separate crates so you depend only on the part you need.

Quick start

Command-line tool:

cargo install tok3niz3r-cli
tok3 encode --tokenizer tokenizer.json --text "Hello, world!"

Library (encode and decode an existing tokenizer):

[dependencies]
tok3niz3r-runtime = { version = "0.1", features = ["hf-compat"] }

Crates

Crate Use it when you want to
tok3niz3r-cli Do the above from the command line (the tok3 binary).
tok3niz3r-runtime Load a tokenizer and encode/decode text.
tok3niz3r-trainer Train a tokenizer from a corpus.
tok3niz3r-core Build your own tooling on the shared types. Usually a transitive dependency only.

Each crate has its own README with a short example, and full API docs are on docs.rs.

License

MIT. See LICENSE.md.