skillfed

tokie

Blazingly fast tokenizer — 50x faster, 10x smaller, 100% accurate

tokie v0.1.4 487.3K downloads/30d#6,386 on PyPI49
Permissive license MIT OR Apache-2.0 Active released

What it is and what it does

tokie is a tokenizer library written in Rust with Python bindings that converts text into token IDs and metadata for transformer models. It supports BPE (used by GPT-2 and tiktoken), WordPiece (BERT), and Unigram encoders, and can load any HuggingFace tokenizer model directly. The library is designed as a drop-in replacement for HuggingFace's tokenizers package, offering substantially faster encoding and decoding through its Rust implementation.

The package handles common tokenization workflows: single-text encoding, batch encoding across multiple CPU cores, pair encoding for cross-encoder models, padding and truncation, byte-offset tracking, and token counting. It also provides a compact binary .tkz format for model storage that is significantly smaller than the standard tokenizer.json format. No runtime dependencies are required beyond Python itself.

Use it for:

  • Accelerate batch tokenization in production NLP pipelines where throughput matters (e.g., preprocessing large datasets for model training).
  • Replace HuggingFace tokenizers in latency-sensitive applications like real-time inference or API endpoints.
  • Reduce model artifact size by storing tokenizers in .tkz format instead of tokenizer.json for deployment.
  • Tokenize text for BERT, GPT-2, Llama, Mistral, and other transformer models without rewriting tokenization logic.
  • Count tokens quickly without creating full encoding objects, useful for prompt length validation in LLM applications.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A fast, Rust-backed tokenizer library that encodes and decodes text using BPE, WordPiece, and Unigram algorithms, compatible with HuggingFace tokenizer models.

Yes, if you are tokenizing text for transformer models and speed or model size matters. The package is actively maintained, has no known vulnerabilities, supports current Python versions, and offers a permissive dual license. Install friction is moderate due to compiled wheels, but prebuilt binaries cover common platforms. Not necessary if your tokenization is already fast enough or if you need features not yet documented in the fact sheet.

Install

tokie on PyPI

pip

pip install tokie

uv

uv add tokie

poetry

poetry add tokie

Installing tokie

Before you install

Medium install friction due to compiled wheels, but prebuilt binaries are available for modern Python versions (3.10–3.14) across macOS, Linux, and Windows. Repository is active with a recent release (21 days old) and no known vulnerabilities.

License in practice

Dual-licensed under MIT OR Apache-2.0, both permissive; you may choose either license when using or distributing this package.

Quickstart

pip install tokie

import tokie
tokenizer = tokie.Tokenizer.from_pretrained("bert-base-uncased")
encoding = tokenizer("Hello, world!")
print(encoding.ids)  # [101, 7592, 1010, 2088, 999, 102]

Requires Python 3.10 or later; prebuilt wheels are available for CPython on common platforms.

Verify before relying

  • Whether .tkz format is backward-compatible across tokie versions or requires re-serialization after updates.
  • Performance characteristics on very large batches or streaming use cases beyond the provided benchmarks.
  • Whether all HuggingFace tokenizer edge cases (custom tokens, special token handling) are fully supported.

Package facts

License MIT OR Apache-2.0 (permissive)
Python support supports the current Python release (>=3.10)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 21 days since the last release
Last repo commit
First released
Downloads 487,336/month — #6,386 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: tokie-0.1.4-cp310-cp310-macosx_10_12_x86_64.whl; tokie-0.1.4-cp310-cp310-macosx_11_0_arm64.whl; tokie-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; tokie-0.1.4-cp310-cp310-manylinux_2_28_aarch64.whl; tokie-0.1.4-cp310-cp310-win_amd64.whl; tokie-0.1.4-cp311-cp311-macosx_10_12_x86_64.whl; tokie-0.1.4-cp311-cp311-macosx_11_0_arm64.whl; tokie-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; tokie-0.1.4-cp311-cp311-manylinux_2_28_aarch64.whl; tokie-0.1.4-cp311-cp311-win_amd64.whl; tokie-0.1.4-cp312-cp312-macosx_10_12_x86_64.whl; tokie-0.1.4-cp312-cp312-macosx_11_0_arm64.whl; tokie-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; tokie-0.1.4-cp312-cp312-manylinux_2_28_aarch64.whl; tokie-0.1.4-cp312-cp312-win_amd64.whl; tokie-0.1.4-cp313-cp313-macosx_10_12_x86_64.whl; tokie-0.1.4-cp313-cp313-macosx_11_0_arm64.whl; tokie-0.1.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; tokie-0.1.4-cp313-cp313-manylinux_2_28_aarch64.whl; tokie-0.1.4-cp313-cp313-win_amd64.whl

Keywords: tokenizer, tokenization, bpe, wordpiece, sentencepiece, bert, gpt2, llama, nlp, embedding, rag, transformers, huggingface, fast, rust

Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: RustTopic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Text ProcessingTopic :: Text Processing :: LinguisticTyping :: Typed

Tags

fast tokenizer for transformershuggingface tokenizer replacementbpe wordpiece tokenizationrust tokenizer pythontoken encoding decodingbatch tokenizationbert gpt2 tokenizer
rust-backedtransformersnlp

More Artificial Intelligence packages