Skip to main content

A package with common tokenizers in Python and C++

Project description

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.

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.

pytorch_tokenizers-1.3.0-cp313-cp313-win_amd64.whl (848.5 kB view details)

Uploaded CPython 3.13Windows x86-64

pytorch_tokenizers-1.3.0-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.3.0-cp313-cp313-manylinux_2_28_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.13macOS 14.0+ ARM64

pytorch_tokenizers-1.3.0-cp312-cp312-win_amd64.whl (848.6 kB view details)

Uploaded CPython 3.12Windows x86-64

pytorch_tokenizers-1.3.0-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.3.0-cp312-cp312-manylinux_2_28_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.12macOS 14.0+ ARM64

pytorch_tokenizers-1.3.0-cp311-cp311-win_amd64.whl (849.2 kB view details)

Uploaded CPython 3.11Windows x86-64

pytorch_tokenizers-1.3.0-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.3.0-cp311-cp311-manylinux_2_28_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.11macOS 14.0+ ARM64

pytorch_tokenizers-1.3.0-cp310-cp310-win_amd64.whl (847.1 kB view details)

Uploaded CPython 3.10Windows x86-64

pytorch_tokenizers-1.3.0-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.3.0-cp310-cp310-manylinux_2_28_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

pytorch_tokenizers-1.3.0-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.3.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pytorch_tokenizers-1.3.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 0af9478ccc8a658349226e5efe22e6d4b5a3166fab751ae78635f5718ef7ef82
MD5 2f0dcc5be3ca932379c5093a2d60a532
BLAKE2b-256 5549ffdf81cf55e6a3f5031cc0ac2571c93fb12f73fff921f6a4f124e1dba360

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytorch_tokenizers-1.3.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5996aff5010b28485927574f0619a005ce603281bc501e9873a282f055bf9a70
MD5 31db78429547fba03c3489e120eb94db
BLAKE2b-256 fd6d50e073307e0996ba4ee5f4fda10989f89a8f47043e27b828bddd184f1284

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytorch_tokenizers-1.3.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d274eb8e603074cd2f07c695737b102ebf10f1f93ea40c242e602a03f1246eb6
MD5 44b45b29d41f6739f82879839e7cdde1
BLAKE2b-256 78622664c185bd9aea70b96fe084a7b913e2710e7445c50c97ec54f4f0ea14e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytorch_tokenizers-1.3.0-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 2d057c3190c05808cf4954de457acce47162d8f6d5719334337e3e972b5e06c8
MD5 8226c5a3577f08bee674c59f52963c08
BLAKE2b-256 b716b7270314ff16699e54f19c8b31a86c91453a0859ae19ceadadec41548199

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytorch_tokenizers-1.3.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8c45f3e0c2a5ff2371f096773c1826d286b6f28bb16de66628a69f40808d4c61
MD5 24818d77002249970719d0a4a4436835
BLAKE2b-256 e4b0d493f064ce13bc5f65653018b8d0ca6911914d7b5918f75f88b5a0422b8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytorch_tokenizers-1.3.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 14287f48c36f69ebbee127b58278b5a02b2297765cf9ad4c9d8b4d314a9f4b19
MD5 4f6d1f12851878c6be9b29c6c2bbdbfd
BLAKE2b-256 dae95717dbc1dce92144c13c2c1c68218b21dc2c97a299546111fe3bcdb9e359

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytorch_tokenizers-1.3.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1eb7926c59e5fee560f107ae97baa0b67ce1c891bea89b19ec0d260f8fad06bf
MD5 221e29764acdc497f82cc691c6eb7776
BLAKE2b-256 e41c517e2e2bad7b1a0a8c03d3f8842ba3c8dc24c13504d0ee48e3ad954bbcf0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytorch_tokenizers-1.3.0-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 0b1fc638e864b32490565ac810e6a71384b897e3450601f4d03a19d3cc3ad517
MD5 e86e071d50cfe445cbfbadc4f6bda1ab
BLAKE2b-256 6734e4e258789f1873b6ab863dd73e2e42f1613351565aba5e751b67ed8ff66a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytorch_tokenizers-1.3.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 32accf5284a3459ac2a1a0c6661e9dbb949aba5bd37307e6046b5857ba460ba5
MD5 91b7e13967e75579d6007c7e2ddc660b
BLAKE2b-256 982f84bafb973c8f041f860ea8403d4c9aaad4eac22b6950401baab378a7639e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytorch_tokenizers-1.3.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c67ac5d90c93bcea620e9fc720cb158a5649cd4faa509de072f2e2255f57d622
MD5 4e0313aac47e3769000fa2b0569f13da
BLAKE2b-256 3dbd9c6ad7777f9df2876c139ba289b0028ae6368e9aa53a30543af0081bd9ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytorch_tokenizers-1.3.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 df502a38d183a1ecc1ff6ae438b89c3752fd32ebbfb0df32a388d257e9ba2a28
MD5 b1e03d44622527ac15af19b2cf861b66
BLAKE2b-256 bfd27b3eaa21e53cc654acb62ba09ce991d3fe2c7a6d81af5ecb235773805e57

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytorch_tokenizers-1.3.0-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 1c6808950271cf7b8b775d9a03ac95de72ec4665feb4af50322686a74f415d64
MD5 ab59e12274a76b6a35667e6695c05e03
BLAKE2b-256 ea196bb091d8f0c013a63a425f91c7280b413d512343b8c2466fda562870ef78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytorch_tokenizers-1.3.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9fd83bf74a62beb47b44b9f7f3e560627c97eb26348c70abfc1173bd2242e780
MD5 cfb2a8fe931ab2847182a131c1db681d
BLAKE2b-256 4eb82dd300278c87a0e0bdab024a204692445d55524dba61929335400ad80119

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytorch_tokenizers-1.3.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f4d477e525828b29047c15a0218168c62779515692cf833b516ffe45e87421a2
MD5 a5975e01e2753bcd259e9545958968a2
BLAKE2b-256 f64642e32ea1b874b426e4e3a4c815fdd4133d3bee196a807e703d12923b397f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytorch_tokenizers-1.3.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3d3945f7a04624f9b7b0b419efc9fd67fba031396dea9a5f6365c7fff5bc3a01
MD5 1719a7bf0bf485bcd616d8d480adcc42
BLAKE2b-256 2af2f032c6b08b4063498969bd677dbce679e4fcdcb7cda4561ae95d9da47c2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytorch_tokenizers-1.3.0-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 151f5a71f003805d2129377c41634f2a2b7219cdea2019dc798455e2c29b6ce5
MD5 ca9635d114722dcd6af007e8820e1e1a
BLAKE2b-256 7847862c35bb51a0bfc38a68bbf012a9344f6e801358391117415bdb89f390b1

See more details on using hashes here.

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