A pure JavaScript tokenizer running in your browser that can load tokenizer.json and tokenizer_config.json from any repository on HuggingFace. You can use it to count tokens and compare how different large language model vocabularies work. It's also useful for debugging prompt templates.
Copy model names from HuggingFace (e.g., from the title of model pages like "microsoft/Phi-3-mini-4k-instruct") and paste into the input field. Press Enter or click "Add tokenizer from HuggingFace".
Click the red "🗑️ Delete" button next to any model. You'll get a confirmation prompt and cannot delete the last model.
Click the "📋 Share" button to copy a URL containing your current text and model selection. Share this URL with others to let them see the same tokenization.
You can link directly to specific configurations using URL parameters:
?text=your%20text&models=model1,model2,model3
Promise.all() instead of sequentially, to improve startup time<ruby> elements with text above and token numbers belowThe project consists of three main files:
index.html - Main HTML structure and UItokenizer.css - Styling including dark mode supporttokenizer.js - Core tokenization logic using transformers.jsSimply open index.html in a modern web browser. No build step required.
Works in all modern browsers that support:
If you're wondering why there are so many models under Xenova, it's because they work for HuggingFace and re-upload just the tokenizers, so it's possible to load them without agreeing to model licences.
Contributions are welcome! Please feel free to submit a Pull Request.
See LICENCE file for details.
Try it at: danieldemmel.me/tokenizer
6 commits
JavaScript
53.8%
HTML
31.5%
CSS
14.7%
A pure JavaScript tokenizer running in your browser that can load tokenizer.json and tokenizer_config.json from any repository on HuggingFace. You can use it to count tokens and compare how different large language model vocabularies work. It's also useful for debugging prompt templates.
Copy model names from HuggingFace (e.g., from the title of model pages like "microsoft/Phi-3-mini-4k-instruct") and paste into the input field. Press Enter or click "Add tokenizer from HuggingFace".
Click the red "🗑️ Delete" button next to any model. You'll get a confirmation prompt and cannot delete the last model.
Click the "📋 Share" button to copy a URL containing your current text and model selection. Share this URL with others to let them see the same tokenization.
You can link directly to specific configurations using URL parameters:
?text=your%20text&models=model1,model2,model3
Promise.all() instead of sequentially, to improve startup time<ruby> elements with text above and token numbers belowThe project consists of three main files:
index.html - Main HTML structure and UItokenizer.css - Styling including dark mode supporttokenizer.js - Core tokenization logic using transformers.jsSimply open index.html in a modern web browser. No build step required.
Works in all modern browsers that support:
If you're wondering why there are so many models under Xenova, it's because they work for HuggingFace and re-upload just the tokenizers, so it's possible to load them without agreeing to model licences.
Contributions are welcome! Please feel free to submit a Pull Request.
See LICENCE file for details.
Try it at: danieldemmel.me/tokenizer
6 commits
JavaScript
53.8%
HTML
31.5%
CSS
14.7%