Hacker News new | ask | show | jobs
Tok'n'Roll: Token-perfect tokenizers for Python, 100% written in Java (pypi.org)
1 points by mukel 4 days ago
1 comments

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.