Skip to main content

tokenizers

C++ implementations for various tokenizers (sentencepiece, tiktoken etc). Useful for other PyTorch repos such as torchchat, ExecuTorch to build LLM runners using ExecuTorch stack or AOT Inductor stack.

Installation (from source)

git clone git@github.com:meta-pytorch/tokenizers.git
cd ~/tokenizers
git submodule update --init --recursive
pip install -e .

SentencePiece tokenizer

Depend on https://github.com/google/sentencepiece from Google.

Tiktoken tokenizer

Adapted from https://github.com/sewenew/tokenizer.

Huggingface tokenizer

Compatible with https://github.com/huggingface/tokenizers/.

Llama2.c tokenizer

Adapted from https://github.com/karpathy/llama2.c.

Tekken tokenizer

Mistral's Tekken tokenizer (v7) with full support for special tokens, multilingual text, and instruction-tuned conversations. Provides significant efficiency gains for AI workloads:

  • Special token recognition: [INST], [/INST], [AVAILABLE_TOOLS], etc. as single tokens
  • Multilingual support: Complete Unicode handling including emojis and complex scripts
  • Production-ready: 100% decode accuracy with comprehensive test coverage
  • Python bindings: Full compatibility with mistral-common ecosystem

License

tokenizers is released under the BSD 3 license. (Additional code in this distribution is covered by the MIT and Apache Open Source licenses.) However you may have other legal obligations that govern your use of content, such as the terms of service for third-party models.

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.

pytorch_tokenizers-1.4.1-cp314-cp314-win_amd64.whl (858.3 kB view details)

Uploaded CPython 3.14Windows x86-64

pytorch_tokenizers-1.4.1-cp314-cp314-manylinux_2_28_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

pytorch_tokenizers-1.4.1-cp314-cp314-manylinux_2_28_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

pytorch_tokenizers-1.4.1-cp314-cp314-macosx_14_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.14macOS 14.0+ ARM64

pytorch_tokenizers-1.4.1-cp313-cp313-win_amd64.whl (857.9 kB view details)

Uploaded CPython 3.13Windows x86-64

pytorch_tokenizers-1.4.1-cp313-cp313-manylinux_2_28_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

pytorch_tokenizers-1.4.1-cp313-cp313-manylinux_2_28_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

pytorch_tokenizers-1.4.1-cp313-cp313-macosx_14_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

pytorch_tokenizers-1.4.1-cp312-cp312-win_amd64.whl (857.9 kB view details)

Uploaded CPython 3.12Windows x86-64

pytorch_tokenizers-1.4.1-cp312-cp312-manylinux_2_28_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

pytorch_tokenizers-1.4.1-cp312-cp312-manylinux_2_28_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

pytorch_tokenizers-1.4.1-cp312-cp312-macosx_14_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

pytorch_tokenizers-1.4.1-cp311-cp311-win_amd64.whl (858.5 kB view details)

Uploaded CPython 3.11Windows x86-64

pytorch_tokenizers-1.4.1-cp311-cp311-manylinux_2_28_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

pytorch_tokenizers-1.4.1-cp311-cp311-manylinux_2_28_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

pytorch_tokenizers-1.4.1-cp311-cp311-macosx_14_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

pytorch_tokenizers-1.4.1-cp310-cp310-win_amd64.whl (856.2 kB view details)

Uploaded CPython 3.10Windows x86-64

pytorch_tokenizers-1.4.1-cp310-cp310-manylinux_2_28_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

pytorch_tokenizers-1.4.1-cp310-cp310-manylinux_2_28_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

pytorch_tokenizers-1.4.1-cp310-cp310-macosx_14_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

File details

Details for the file pytorch_tokenizers-1.4.1-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 ebc91f9c010d1eea5291028e2e0352e63e2ea147e2a1b05e308134f247d016dd
MD5 e7308af51d8a4f5c311d5d4f4ed27292
BLAKE2b-256 811d558212519a4704baad64535ad14d568b37c723664736c3127715b58b0955

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b2d99c7db1d0033cf76818cbc786cdcc2f8582677da74cf60bdef504e5b9dad2
MD5 e17fb34e3c369c80694d67a4ce158c22
BLAKE2b-256 587061ca1ccc90b7efcd998fb0fa5f1d446a21c0d3978101c60f514e3b65802b

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp314-cp314-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 60cbe48d2b81b250f2c2fc85cfa89f5f4247e451ee968a68d958855447dbc855
MD5 170689db976ff7d6cbc72509c6a77acf
BLAKE2b-256 4ae9a999083759060840880d441ee0c8ec7859fdf0ae3c87d35ce825c976f6d5

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp314-cp314-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp314-cp314-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 97ee2d2ae991a0ca7e26b4bc6215293bb6498d5090efffb8300064d0e4f874cb
MD5 b6a6164c19a4222dc4aba8eb6bf761ac
BLAKE2b-256 1823162945a49f2c9147c2db24bd9a6c21fc550571e0f9071ad3f24eb4625c44

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 75b16fe8bfb69686f4b5c5435deae6eeec859bd6aaf85b66bda743263db796bc
MD5 a84700f5e4dd65e3e88a1e9d0dc6644e
BLAKE2b-256 c6527e1bdab83e7c2a16846f2733c3f1b7ca386cb108e2f84c695ab26d9b1abe

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 944d149ece8fe278d7aee6520e82bed14f6d14c890af1f45cc3399fa4c31ad44
MD5 e6962539e30693a9b8ee4f6a32e29a18
BLAKE2b-256 ed3fae7e9d6ed87b3089aa88e8b00c5b474ab5f29c28875a3f44156a5caaf2aa

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a647af855ec93485a6f97074a78a906b0c4d227896f2a8498dd674d5e8be14fd
MD5 599823a9739f54bf5e60c2493d3bdd67
BLAKE2b-256 f7513494837ac254666e3c4dfca14d2bf8a08bd8a3d454f066ba7701462f5928

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 2561c5187e028d906fc24c98288d183e05e8b2b27d565e5462cc2f5611801653
MD5 6c95fb3e41f11ed15cd71c5b1123c85d
BLAKE2b-256 a4c8b811e0990964e82d0616707bf53bc6fce4692580aef42351ca1ae3041b8a

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 40affc76c3f98ef5c26910b68b4dcd27b5d9209e2eccfd18e4a9cdc0f0048f47
MD5 de794bd846b20e5833820645fd3712a3
BLAKE2b-256 44588ab61ce7f666b4b06016a1517836c24f2dd06b7e6d7d5255200aeacd2656

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3feb33e04dcaa2cea6dcbe99aba22da2ad81d1ed305bc0af52acab5b3f8ff094
MD5 a88fcc37abd9a97691fb79b0a938fd53
BLAKE2b-256 adb34d38b4e5cd951df08511e0a11637baad56dec6ca82bca7b594c8d0c85e59

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 84ee954611ec869f875dd23618c66c15b718c2a4eed639fefb72e7806091ff76
MD5 30331b8f483ccff113ebaa7d77008f9f
BLAKE2b-256 d6cf69d6d3c6fad65f0f1c63a8f0f0db85009a9db4e25fa50d573ead4e527cbb

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 e3ad0a9c474396267e0f70273d74fec402cb88541afb6617f98c6042e71faedb
MD5 7e9af1344076009d230077a36a0f8258
BLAKE2b-256 2691c3d2564c80587fa501c29652c317e8a4eec6f7b13c7b53f1de6bc0abddc0

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bed58a70253ffa675e11343e9b7c24cbb923e49b245bb4882616351545858bf0
MD5 cb5fcdacd8ad0dc816e59718e9d1d677
BLAKE2b-256 2eace5c5920fe16dcc98c2d22964a39ea9461b2426db41a8b9e0d4473988f37f

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1a6dd8e02561f4ce1006925f918af416ff24c895da2bd50bd09f8201a53acb2c
MD5 b9e7a2094cc7ac85e2e65f492d462903
BLAKE2b-256 83790b2b8e5176adce7ec82a3413748ab18dd6ec8a2f8b6c1c9930b19efd08c0

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9451627c17c5a7b24cf9d8105c0ce9ab054a0512512d622e11c03f2957264713
MD5 9461595a5a60aa52ee9c27b7f4e1a8a4
BLAKE2b-256 872202a003ff38f0c55f869f845dd7c010a9bb6e815a83ced689503a9ce55607

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 87415adb8ff5bc6a8a2312c978d7d86b8033b7c6885985133d62099dce7656fe
MD5 70bcdb1c525d9bb6ba2469302458ad4a
BLAKE2b-256 6c503ebd4bc851ec7721113e9103b53b1aacb1a87914dbba5c36f843ae586cb8

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2de8fd2e1018ad509f65ff1c41ea88eda6a691c124c689b493d822f7cc46bc57
MD5 9fec3008026b7e5fde14667bdea6ec83
BLAKE2b-256 c6494a5f5c1ac9f76ebfdf5d1b739f7228b3233ef25705559fad1929b0c55d07

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a102ebaba8f150f09b49e28a964dc7c24a36aeb28bc3d84752f7031461fed6ce
MD5 2e579af1efbb7ec4c3b55e608629dc6d
BLAKE2b-256 a304f829663e2a786a8766657d2fb5fa345bc78cb77aa1020c75cda5905b6ae4

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7117f6ad50ab052282be076973fc235672325fa3f7de99024415e22018182003
MD5 a63daf1314dd040420e75fb9053c35a0
BLAKE2b-256 c832b7a99821c0ccdad95857d20acf3b690a1baa1a8073eac70fc655c8a747cf

See more details on using hashes here.

File details

Details for the file pytorch_tokenizers-1.4.1-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.4.1-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 b49e3a93d48aaecb2ff87e5767a0210bfd42e6c40ce012cbee23d517ef1c73eb
MD5 e2fb6165c92573fdc5a5d063b802fc81
BLAKE2b-256 e8e7de344486cddc2f9730dec67aa194d19023d3a6f5bba23be0658aff3face5

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.4.1 This release

20 files

1.4.0

16 files

1.3.0

16 files

1.2.0

16 files

1.1.0

24 files

1.0.1

23 files

1.0.0

6 files

Supported by

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