Tokenizers
Introduction
dynamo-tokenizers provides efficient, versatile tokenization for NLP workloads. It supports HuggingFace and TikToken tokenizers (plus a FastTokenizer hybrid mode) through a streamlined encoding/decoding API.
Features
- Hash Verification: Ensures tokenization consistency and accuracy across different models.
- Simple Encoding and Decoding: Facilitates the conversion of text to token IDs and back.
- Sequence Management: Manage sequences of tokens for complex NLP tasks effectively.
Quick Start
HuggingFace Tokenizer
use HuggingFaceTokenizer;
let hf_tokenizer = from_file
.expect;
Encoding and Decoding Text
use ;
let tokenizer = from_file
.expect;
let text = "Your sample text here";
let encoding = tokenizer.encode
.expect;
println!;
let decoded_text = tokenizer.decode
.expect;
assert_eq!;
// Using the Sequence object for encoding and decoding
use ;
use ;
let tokenizer = from;
let mut sequence = new;
sequence.append_text
.expect;
let delta = sequence.append_token_id
.expect;