Settings

Theme

Tok'n'Roll: Token-perfect tokenizers for Python, 100% written in Java

pypi.org

1 points by mukel · 1 comment

Reader

1 thread
mukelOP

pip install toknroll

How? Tok'n'Roll is written 100% in safe Java e.g. no Unsafe. It's compiled into a native library with GraalVM Native Image and wrapped for Python, the toknroll wheel is only ~5.6 MB.

Why? Tok'n'Roll exposes a simple and clean API and easily outperforms the industry standard libraries like Tiktoken and HF tokenizers, which are thin wrappers over Rust codebases riddled with unsafe usages.

It showcases how Java can be extremely performant and safe. It's heavily inspired on Florian Enner's work (StaticFX) that makes Native Image and C interop easy and seamless.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection