Rust implementation of the Mistral Tekken tokenizer
// readme
tekken
A Rust implementation of the Mistral Tekken tokenizer with image and audio support. This library provides fast and efficient tokenization capabilities for text, image and audio data, fully compatible with Mistral AI’s tokenizer.
Features
- Text Tokenization: Full compatibility with Mistral’s Tekken tokenizer
- Image Support: Resize and normalize images into
[IMG]token grids (imagefeature) - Audio Support: Encode and decode audio data with mel-scale spectrogram processing (
audiofeature) - Multiple Versions: Support for tokenizer versions V3, V7, V11, V13, and V15
- Special Tokens: Complete handling of special tokens (BOS, EOS, audio tokens, etc.)
- Model Settings: Parsing and validation of
model_settings_builderconstraints (V15+)
Installation
Add this to your Cargo.toml:
[dependencies]
tekken = "0.2.0"
Or use the Git repository directly:
[dependencies]
tekken = { git = "https://github.com/jorge-menjivar/tekken-rs" }
Feature Flags
The multimodal features are enabled by default. Turn them off to drop their dependencies:
| Feature | Default | Enables | Pulls in |
|---|---|---|---|
| … |