What problem does it solve? Tokenizing multilingual or CJK text usually requires language-specific pre-processing rules that are brittle and hard to reproduce. SentencePiece trains tokenizers directly on raw text, treating whitespace as a symbol, so one deterministic vocabulary works across all languages. ## Core Features & Use Cases - BPE and Unigram Training: Train subword vocabularies from raw corpora via the command line or Python API, with configurable vocab size, character coverage, and special tokens. - Deterministic Encoding and Decoding: Encode text to pieces or IDs and decode back losslessly at roughly 50,000 sentences per second with about 6MB memory. - Subword Regularization: Sample alternative tokenizations during training for data augmentation and model robustness. - Use Case: Train a 32k Unigram tokenizer on a multilingual corpus with T5-style sentinel tokens, then load it through the transformers T5Tokenizer for model pretraining. ## Quick Start Train a SentencePiece Unigram tokenizer with 8000 vocabulary on my corpus.txt file and show me how to encode and decode a sample sentence with it.