Tokenizers documentation
Installation
Getting started
API
Installation
Python
Rust
Node
🤗 Tokenizers is tested on Python 3.10+.
We highly recommend using uv for virtual environment installs.
Installation with pip
🤗 Tokenizers can be installed using pip as follows:
pip install tokenizers
Installation from sources
To use this method, you need to have the Rust language installed. You can follow the official guide for more information.
If you are using a unix based OS, the installation should be as simple as running:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shOr you can easily update it with the following command:
rustup update
Once rust is installed, we can start retrieving the sources for 🤗 Tokenizers:
git clone https://github.com/huggingface/tokenizersThen we go into the python bindings folder:
cd tokenizers/bindings/pythonAt this point you should have your virtual environment already activated. In order to compile 🤗 Tokenizers, you need to:
pip install -e .
or, if you want to dev you need to install maturin and run:
maturin dev