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.4
Releases: https://github.com/TabNahida/TokenFluxPlusPlus/releases

Install

From PyPI:

pip install tokenflux

From source (local repo):

pip install .

Editable source install:

pip install -e .

If no prebuilt wheel is available for your platform, installation falls back to source build and requires xmake + a C++ toolchain.

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.4-cp313-cp313-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.13Windows x86-64

tokenflux-0.3.4-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.4-cp313-cp313-macosx_15_0_universal2.whl (511.5 kB view details)

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

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

Uploaded CPython 3.12Windows x86-64

tokenflux-0.3.4-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.4-cp312-cp312-macosx_15_0_universal2.whl (511.6 kB view details)

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

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

Uploaded CPython 3.11Windows x86-64

tokenflux-0.3.4-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.4-cp311-cp311-macosx_15_0_universal2.whl (510.7 kB view details)

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

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

Uploaded CPython 3.10Windows x86-64

tokenflux-0.3.4-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.4-cp310-cp310-macosx_15_0_universal2.whl (509.3 kB view details)

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

File details

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

File metadata

  • Download URL: tokenflux-0.3.4-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.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2573c46ac0649aabcab75bcf5e54c64c3409ed605324c45d67c9a70297e27e7f
MD5 9213e85ae1d75b333fa7109d2a1459d3
BLAKE2b-256 5a93a61a6cea0c8467481fbc8dc4969c245ed40de7cb70bb28622130800b3536

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.4-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.4-cp313-cp313-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for tokenflux-0.3.4-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 44b3879d6b982ed0f625ff24acf14afeb4466f44cfbf0c09539e4237c79c1dad
MD5 991ab7defb916a85ad8993a493345837
BLAKE2b-256 e859dd22eeb15abbeb9ee8b705baf44b9b487e4d8681835f9b39ced3bec20a9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.4-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.4-cp313-cp313-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for tokenflux-0.3.4-cp313-cp313-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 fd8d37c23fffcfbfc4f222319a49d4ce5877c0cf33ff240e7a91170a9588fa7f
MD5 724e58aa54ad97f417c32abd45048c02
BLAKE2b-256 cdebb53d3671693ec3968a49f6d0c67d5848a1c317127a25de9a7aac34181560

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.4-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.4-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: tokenflux-0.3.4-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.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ffd26bdc828888bc0d89517b20a356c2ce87057592b593b3e920302f2932df14
MD5 91bbd5e1f35ee5ee7ac492695edf3aab
BLAKE2b-256 dd60b81c265fd0c96d5206aa489919abd4a5735b1601a8a3f1888653502d6d6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.4-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.4-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for tokenflux-0.3.4-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 102d1053b26df7f4e7b08a8cdcb37ec476fc5027da33e7a5503872a83bfd1fc6
MD5 731cce0736227dc4eeee815645d78738
BLAKE2b-256 160e4ee5f3cf7c37801cac69de421f7344d53b487bd358db6f8ea3d899b1f740

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.4-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.4-cp312-cp312-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for tokenflux-0.3.4-cp312-cp312-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 8967b5173bf8f612648279443303858c361be8e9a1f28bb9a06687d3f9bdbce3
MD5 0b27880d0ff8477f0a8f986c45ebb297
BLAKE2b-256 753a39b32d59be8c51dcfa72280bb95a491b82c5bc50c3cb70ec47f4a3fc809e

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.4-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.4-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: tokenflux-0.3.4-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.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7601a7f02d78c16c1bb18e8a5da8444710dbc2fe99c02cd9b18dd0b07415a2a9
MD5 ec6f522885fc98161a4dd666e57ab157
BLAKE2b-256 4ca540081481ae37a9859d718efab85d5463576f915f7d7aa0dd41dab110f3a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.4-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.4-cp311-cp311-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for tokenflux-0.3.4-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 12e8751f17da0f952204d290dc6eadc3ebf2937a17c8717193c6c2b6a459483e
MD5 037996cffcb45c5638ea9723246f91fd
BLAKE2b-256 cf26d9c2d1b424bc6450b02d45fcaab921c323374641c658fba6ec147f03a304

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.4-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.4-cp311-cp311-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for tokenflux-0.3.4-cp311-cp311-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 11e9fa11380dff007c3c10ec5e6e7b8c6a86c4c376f77b751e6b88b74aace4d9
MD5 41feeaea86ce78066bf499e58f0472cc
BLAKE2b-256 ef7227d8b15607603ea7c6a754fbfea5e3540c0314d6a151c41e70f647960365

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.4-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.4-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: tokenflux-0.3.4-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.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7af82a64f632de76cdff8ccaf8e71ded280624923494bc3baa6f0bd8aacacf1e
MD5 66ee594c2df2ae46ed44d33e28e84f3f
BLAKE2b-256 32ef0cbe247794227593b0c2dbe891cefecf80f7b0fc814507251c20e74b3536

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.4-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.4-cp310-cp310-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for tokenflux-0.3.4-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 ba6b39dd8ed2addcb1aebd466d834202c0d540820aa26272c5a3d51026caf7a1
MD5 007f13fadde67d5b1324e4b6fe0a1d80
BLAKE2b-256 7491dcb1391b8c1d1bbe1e68f761f72979ab952dabfe782df51fe35a326e3ed4

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.4-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.4-cp310-cp310-macosx_15_0_universal2.whl.

File metadata

File hashes

Hashes for tokenflux-0.3.4-cp310-cp310-macosx_15_0_universal2.whl
Algorithm Hash digest
SHA256 db54164660f56d6817856ac8cd458b12a8262ff314c82cb00442f80745107361
MD5 f5d75e85d529176c67ae26dca42295d6
BLAKE2b-256 a4952bcb785e9408f9679fc58a85082fe3880ef430954be56d25bf3aa77a8c34

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenflux-0.3.4-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