What problem does it solve?
This Skill provides high-performance tokenization optimized for research and production, allowing users to tokenize large corpora quickly and efficiently.
Core Features & Use Cases
- Fast Tokenization: Tokenizes 1GB in <20 seconds using Rust-based implementation.
- Custom Vocabulary Training: Allows users to train custom vocabularies, track alignments, and handle padding/truncation.
- Integration with Transformers: Seamlessly integrates with HuggingFace's transformer models for advanced NLP tasks.
- Use Case: Ideal for building production NLP pipelines, training custom models, or working with large text corpora.
Quick Start
Install the tokenizers:
pip install tokenizers
Train a custom BPE tokenizer:
from tokenizers import Tokenizer, models, trainers, pre_tokenizers
tokenizer = Tokenizer(models.BPE())
tokenizer.pre_tokenizer = pre_tokenizers.Whitespace()
trainer = trainers.BpeTrainer(vocab_size=30000, min_frequency=2)
tokenizer.train(files=["train.txt", "validation.txt"], trainer=trainer)
tokenizer.save("my-tokenizer.json")