huggingface-tokenizers
Agent skill fromOrchestra-Research/AI-Research-SKILLs
Fast tokenizers optimized for research and production. Rust-based implementation tokenizes 1GB in <20 seconds. Supports BPE, WordPiece, and Unigram algorithms. Train custom vocabularies, track alignments, handle padding/truncation. Integrates seamlessly with transformers. Use when you need high-performance tokenization or custom tokenizer training.
How to install huggingface-tokenizers
install huggingface-tokenizers
# install the AI-Research-SKILLs pack with the skills CLI
npx skills add Orchestra-Research/AI-Research-SKILLs# or add only this skill to Claude Code: copy the folder
02-tokenization/huggingface-tokenizers/
# into
~/.claude/skills/huggingface-tokenizers/ (all projects)
.claude/skills/huggingface-tokenizers/ (one project)
1# HuggingFace Tokenizers - Fast Tokenization for NLP23Fast, production-ready tokenizers with Rust performance and Python ease-of-use.45## When to use HuggingFace Tokenizers67**Use HuggingFace Tokenizers when:**8- Need extremely fast tokenization (<20s per GB of text)9- Training custom tokenizers from scratch10- Want alignment tracking (token → original text position)11- Building production NLP pipelines12- Need to tokenize large corpora efficiently1314**Performance**:15- **Speed**: <20 seconds to tokenize 1GB on CPU16- **Implementation**: Rust core with Python/Node.js bindings17- **Efficiency**: 10-100× faster than pure Python implementations1819**Use alternatives instead**:20- **SentencePiece**: Language-independent, used by T5/ALBERT21- **tiktoken**: OpenAI's BPE tokenizer for GPT models22- **transformers AutoTokenizer**: Loading pretrained only (uses this library internally)2324## Quick start2526### Installation2728```bash29# Install tokenizers30pip install tokenizers3132# With transformers integration33pip install tokenizers transformers34```3536### Load pretrained tokenizer3738```python39from tokenizers import Tokenizer4041# Load from HuggingFace Hub42tokenizer = Tokenizer.from_pretrained("bert-base-uncased")4344# Encode text45output = tokenizer.encode("Hello, how are you?")46print(output.tokens) # ['hello', ',', 'how', 'are', 'you', '?']47print(output.ids) # [7592, 1010, 2129, 2024, 2017, 1029]4849# Decode back50text = tokenizer.decode(output.ids)51print(text) # "hello, how are you?"52```53…
Excerpt shown under the repository's MIT license.
