Skip to main content

High-performance C++ toolkit for tokenizer training and dataset pre-tokenization.

Project description

TokenFlux++

TokenFlux++ is a fast tokenizer toolkit (C++ core + Python bindings) for:

  • Training tokenizer models (byte_bpe, bpe, wordpiece, unigram)
  • High-throughput encoding and dataset pre-tokenization

Latest release: 0.3.3
Releases: https://github.com/TabNahida/TokenFluxPlusPlus/releases

Install

pip install .

Editable install:

pip install -e .

xmake and a C++ toolchain are required because native modules are built from source.

Quickstart (Python)

import tokenflux as tf

# train
cfg = tf.TrainConfig()
cfg.trainer = tf.TrainerKind.byte_bpe
cfg.vocab_size = 16000
cfg.output_json = "tokenizer.json"
cfg.output_vocab = "vocab.json"
cfg.output_merges = "merges.txt"
tf.train(cfg, ["data/train.jsonl"])

# encode
tok = tf.Tokenizer("tokenizer.json")
ids = tok.encode("hello TokenFlux++")
print(ids[:10], len(ids))

API Docs

Performance

python benchmarks/tokenfluxpp_vs_tiktoken_vs_tokenizer.py

Install compare dependencies:

python -m pip install tiktoken
python -m pip install tokenizers

Snapshot — encode throughput (docs/s) by thread count (higher is better):

Encode Throughput by threads

Latest encode latency speedup:

  • 4.32x vs OpenAI tiktoken
  • 11.89x vs HuggingFace tokenizers

Full benchmark report:
benchmarks/BENCHMARK_RESULTS_2026-03-01.md

CLI

Train:

xmake run TokenFluxTrain \
  --data-list "data/inputs.list" \
  --trainer byte_bpe \
  --vocab-size 16000 \
  --threads 8 \
  --output tokenizer.json \
  --vocab vocab.json

Tokenize:

xmake run TokenFluxTokenize \
  --data-list "data/inputs.list" \
  --tokenizer tokenizer.json \
  --out-dir data/tokens \
  --add-eos \
  --threads 8 \
  --max-tokens-per-shard 50000000

Tokenization output is a concatenated document stream in shard files.
--add-eos is enabled by default; use --no-eos to disable automatic EOS append per document.

Build

xmake

Python extension output is typically under build/.../tokenflux_cpp.pyd (Windows) or build/.../tokenflux_cpp.so (Linux/macOS).

Notes

  • To pick up binding updates (for example encode threading changes), rebuild:
xmake f -y -m release --pybind=y
xmake build -y tokenflux_cpp
  • .env defaults are supported for CLI workflows.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tokenflux-0.3.3-cp313-cp313-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.13Windows x86-64

tokenflux-0.3.3-cp313-cp313-manylinux_2_39_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

tokenflux-0.3.3-cp313-cp313-macosx_15_0_universal2.whl (497.2 kB view details)

Uploaded CPython 3.13macOS 15.0+ universal2 (ARM64, x86-64)

tokenflux-0.3.3-cp312-cp312-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.12Windows x86-64

tokenflux-0.3.3-cp312-cp312-manylinux_2_39_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

tokenflux-0.3.3-cp312-cp312-macosx_15_0_universal2.whl (497.0 kB view details)

Uploaded CPython 3.12macOS 15.0+ universal2 (ARM64, x86-64)

tokenflux-0.3.3-cp311-cp311-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.11Windows x86-64

tokenflux-0.3.3-cp311-cp311-manylinux_2_39_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

tokenflux-0.3.3-cp311-cp311-macosx_15_0_universal2.whl (496.6 kB view details)

Uploaded CPython 3.11macOS 15.0+ universal2 (ARM64, x86-64)

tokenflux-0.3.3-cp310-cp310-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.10Windows x86-64

tokenflux-0.3.3-cp310-cp310-manylinux_2_39_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.39+ x86-64

tokenflux-0.3.3-cp310-cp310-macosx_15_0_universal2.whl (495.1 kB view details)

Uploaded CPython 3.10macOS 15.0+ universal2 (ARM64, x86-64)

File details

Details for the file tokenflux-0.3.3-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: tokenflux-0.3.3-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tokenflux-0.3.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b911d4017e271ebc61d4708e7df70a35e346632bd2e5f58e890e421791139081
MD5 8d62d33ecb3c53c1f4ebfe0908f9a066
BLAKE2b-256 39e77a85c784f0aa4538657f4ae7ab5bd28bfb165ce93e967423acdd20bd4018

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.3-cp313-cp313-win_amd64.whl:

Publisher: release.yml on TabNahida/TokenFluxPlusPlus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tokenflux-0.3.3-cp313-cp313-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for tokenflux-0.3.3-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 2c674fc8b548a0e90dc91d6bb0fd62a63c99ce5229cc9e144dde842be0122008
MD5 16df8c7f569db3eef3403e98ef989204
BLAKE2b-256 8f9a175543cd1d29c6e515b2e387ed2ba53c3041bb71b13f864b72971c8c039e

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.3-cp313-cp313-manylinux_2_39_x86_64.whl:

Publisher: release.yml on TabNahida/TokenFluxPlusPlus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tokenflux-0.3.3-cp313-cp313-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for tokenflux-0.3.3-cp313-cp313-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 67d3db9fb1cb5c4b24895dc2930908721ff4534be24fc6ed2bc91f1c204b19e2
MD5 a28696866c2c266af1fccfd2bf8f3bcb
BLAKE2b-256 fb1305ac8f324bc8ff73294eb23bcad74ac28197611144a919d5cac036e6b07f

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.3-cp313-cp313-macosx_15_0_universal2.whl:

Publisher: release.yml on TabNahida/TokenFluxPlusPlus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tokenflux-0.3.3-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: tokenflux-0.3.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tokenflux-0.3.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b2c2d7b40fe4e8f6602d2f4c956342fd3836f8ff0992908d6012c5f20ec05ea6
MD5 d38bee67ad861d6e52972f60f633bf07
BLAKE2b-256 c3fbf9c06fc44b1e76df8a517f258a06cb011200894740bdbdc918f0c4844898

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.3-cp312-cp312-win_amd64.whl:

Publisher: release.yml on TabNahida/TokenFluxPlusPlus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tokenflux-0.3.3-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for tokenflux-0.3.3-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 0589ef3e9e2f695c2df2e5ef56d121d8faced4709da0d7136a3436bdda0a3130
MD5 e63c1a794e10d2a33a6d01ddd0b40db9
BLAKE2b-256 57aa196e3e4ef077cb5a043580bd85e3ea45c8097cca4c4c6ad85475cf75fd5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.3-cp312-cp312-manylinux_2_39_x86_64.whl:

Publisher: release.yml on TabNahida/TokenFluxPlusPlus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tokenflux-0.3.3-cp312-cp312-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for tokenflux-0.3.3-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 0e26c81865b62206d2ad6452f2e0209b6ebc96f6342b6fcd494c86297575c09f
MD5 2d6e3b709013547ca4028a2bd4b25296
BLAKE2b-256 e11ef1070173641f30c4de8195321291e2ba286b7af513fc2725b6c7c8034eb4

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.3-cp312-cp312-macosx_15_0_universal2.whl:

Publisher: release.yml on TabNahida/TokenFluxPlusPlus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tokenflux-0.3.3-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: tokenflux-0.3.3-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tokenflux-0.3.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f79e1704edbab606674600c82ed2bcf390196e6fcc4088a7d5714b41ddd86a13
MD5 31522ce1e30e02095da6c6cff394a62f
BLAKE2b-256 ae61acce8afed150173d49b693fc91c6e56fb7408eb3f5baba12432abba7cffe

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.3-cp311-cp311-win_amd64.whl:

Publisher: release.yml on TabNahida/TokenFluxPlusPlus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tokenflux-0.3.3-cp311-cp311-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for tokenflux-0.3.3-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 8415538071164e1c56badb6a6db515170c0267ffee89353b2394bf48e5501872
MD5 432ca294b4468bfb573ff67c15406959
BLAKE2b-256 f18214e6b6c5ed025181bc55e14b34e33f770ed80a0bdcebeccfc8640e9a8212

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.3-cp311-cp311-manylinux_2_39_x86_64.whl:

Publisher: release.yml on TabNahida/TokenFluxPlusPlus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tokenflux-0.3.3-cp311-cp311-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for tokenflux-0.3.3-cp311-cp311-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 98ac179d7efd364572758e9668dc8b89408131ba4e97cdfeb08c2857abb0d27e
MD5 bd1648629880f10ba8be4bdb4b5a6688
BLAKE2b-256 0f96db3574197527ab21ae3bc6da14491bb72118a24b4cf6567e447ae28f8d91

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.3-cp311-cp311-macosx_15_0_universal2.whl:

Publisher: release.yml on TabNahida/TokenFluxPlusPlus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tokenflux-0.3.3-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: tokenflux-0.3.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tokenflux-0.3.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1d03ca22656da56048c9e6b4a2ffa4282a4e5c6926d3ac8a59297d107850abae
MD5 01fa7bae7ec0230d7db86af105c7ff52
BLAKE2b-256 4de26407e47f3432e4a43c278c8d79ec75d4a4213bbfee515a862e2d2d5f55d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.3-cp310-cp310-win_amd64.whl:

Publisher: release.yml on TabNahida/TokenFluxPlusPlus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tokenflux-0.3.3-cp310-cp310-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for tokenflux-0.3.3-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 c45665752494e8c0756d52ebaab32d363e00a43a6bc14a533d5d2c0c1d99aed6
MD5 14ed186292b77d004ee8deb13f02a38c
BLAKE2b-256 50fab638def2a1ed44816a53f2090913ba893be596cf91a2a639a932725dff38

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.3-cp310-cp310-manylinux_2_39_x86_64.whl:

Publisher: release.yml on TabNahida/TokenFluxPlusPlus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tokenflux-0.3.3-cp310-cp310-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for tokenflux-0.3.3-cp310-cp310-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 5e88136d0e33c17fa8012e7839fb4dcdfa7caaf7c87caaecf7fdb1105e9f33bb
MD5 b0557b5d14f7c2eac2e18a53f1c17488
BLAKE2b-256 0abf65d92bd0661120b2f3db3f5f6dee66ab1ee1de83379356828c39f9f3a10d

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.3-cp310-cp310-macosx_15_0_universal2.whl:

Publisher: release.yml on TabNahida/TokenFluxPlusPlus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page