tokenizer-checker
Tests and verifies the accuracy of HuggingFace tokenizers converted to OpenVINO formats.
Install
mkdir -p .claude/skills/tokenizer-checker && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10649" && unzip -o skill.zip -d .claude/skills/tokenizer-checker && rm skill.zipInstalls to .claude/skills/tokenizer-checker
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Validate a HuggingFace tokenizer with OpenVINO Tokenizers and OpenVINO GenAI. Use when: checking if a tokenizer converts and works correctly, verifying tokenizer/detokenizer accuracy, testing normalization steps, checking GenAI Tokenizer compatibility.Key capabilities
- →Validate tokenizer conversion
- →Test normalization steps
- →Verify encoding/decoding accuracy
- →Check GenAI compatibility
How it works
Compares HuggingFace and OpenVINO tokenizer outputs across various string categories to ensure consistency.
Inputs & outputs
When to use tokenizer-checker
- →Verifying tokenizer conversion
- →Testing normalization steps
- →Checking tokenizer compatibility
- →Debugging encoding mismatches
About this skill
OpenVINO Tokenizer Checker
Validates that a HuggingFace tokenizer converts to OpenVINO correctly and produces matching outputs for encoding, decoding, normalization, and GenAI compatibility.
When to Use
- Verify a HuggingFace tokenizer converts to OpenVINO and matches HF outputs
- Check if a newly supported tokenizer works end-to-end with OpenVINO GenAI
- Diagnose which test categories (English, multilingual, emoji, whitespace) fail
- Test normalization steps individually to isolate mismatches
Inputs
The user must provide:
- model_id: HuggingFace model identifier or local path (e.g.
zai-org/GLM-4.7)
Optional flags the user may request (pass through to the CLI):
--trust-remote-code— required for some models with custom tokenizer code--subfolder— tokenizer subfolder inside a HuggingFace repo or local model directory (used when tokenizer is in a subfolder)--no-detokenizer— skip detokenizer conversion and testing--use-sentencepiece-backend— use SentencePiece backend during conversion--no-special-tokens— encode without special tokens--no-skip-special-tokens— decode keeping special tokens--skip-missing-outputs— ignore HF outputs absent in OV result (e.g. token_type_ids)--use-fast-false— load the legacy (slow) tokenizer--max-length— max length for conversion and HF truncation checks (default: None)
Prerequisites
Activate the Python virtual environment before running any commands.
- Locate the virtual environment — check for common directories at the repository root:
.venv/,venv/,env/. Uselist_dirto find it. If none is found, ask the user for its location. - Activate based on the current platform:
- Linux/macOS:
source <venv_path>/bin/activate - Windows (cmd):
<venv_path>\Scripts\activate.bat - Windows (PowerShell):
<venv_path>\Scripts\Activate.ps1
- Linux/macOS:
Procedure
Step 1: Run the tokenizer check
Run from the repository root:
openvino_tokenizers check <model_id> [flags]
This executes:
- [1/5] Load HF tokenizer — downloads and loads the tokenizer via
AutoTokenizer.from_pretrained - [2/5] Convert to OpenVINO — converts to OV tokenizer + detokenizer models
- [3/5] Test against 31 strings — compares HF vs OV encode/decode on English, multilingual, emoji, and edge-case strings
- [4/5] GenAI Tokenizer encode + decode — tests
openvino_genai.Tokenizerencode/decode with and without special tokens (skipped ifopenvino_genaiis not installed) - [5/5] GenAI padding + pair inputs — checks batch padding and pair-input behaviour. For tokenizers-backend tokenizers (
PreTrainedTokenizerFast/TokenizersBackend), mismatches are reported as errors and affect the exit code. For other tokenizers, mismatches are reported as warnings only (skipped ifopenvino_genaiis not installed)
[Optional] Step 2: Run the normalization check
Run this step if there are issues in the [3/5] Test against 31 strings step of the previous command:
openvino_tokenizers check_normalization <model_id> [flags]
This executes:
- [1/3] Load HF tokenizer — same as above
- [2/3] Parse normalizer pipeline — extracts individual normalizer steps from
tokenizer.jsonand prints the HF → OV mapping - [3/3] Test normalizer steps — tests each normalizer step independently, then tests the full stacked pipeline
Step 3: Interpret Results
Both commands print ✓ / ✗ per step and exit with code 0 (all passed) or 1 (any failure).
Pass criteria:
- Exit code 0 for each command
- All test strings matched in step 3 of
check - All normalizer steps matched in step 3 of
check_normalization
Failure output includes:
- The input string that failed
- Expected (HF) vs actual (OV) values — token IDs, decoded text, or normalized text
- Shape mismatches, value mismatches, or missing output keys
Step 5 results (padding + pair inputs):
- Batch padding mismatches across different configurations (longest, max_length, left/right padding)
- Pair-input encode mismatches
- For tokenizers-backend tokenizers (
PreTrainedTokenizerFast/TokenizersBackend): these are errors that affect the exit code - For other tokenizers (e.g. SentencePiece-only): these are warnings that do NOT affect the exit code but should be reported
Step 4: Report Results
Provide a structured report to the user:
If all steps pass:
- State that the tokenizer is fully compatible
- Note whether GenAI steps were tested or skipped (if
openvino_genaiis not installed) - Note any step-5 warnings if present
If any step fails, build a failure report covering:
- Which step failed — conversion, tokenizer comparison, detokenizer, GenAI encode/decode, or normalization
- Which string categories failed — identify patterns:
- English strings only → basic tokenization issue
- Multilingual strings → Unicode/encoding issue
- Emoji strings → multi-byte / surrogate handling issue
- Empty/whitespace strings → edge-case handling issue
- All strings → fundamental conversion issue
- Nature of the mismatch — token ID mismatch, shape mismatch, missing output key, decode mismatch, or normalization mismatch
- Normalization isolation — if
check_normalizationidentifies a specific normalizer step as the root cause, report which step type (e.g.NFC,Lowercase,Precompiled) and its parameters
Security
- NEVER install any packages. Assume the environment is pre-configured.
- NEVER modify
model_id— pass it exactly as provided by the user. - NEVER call internal Python functions directly — always use the
openvino_tokenizersCLI commands.
When not to use it
- →Modifying model_id
- →Installing packages
Prerequisites
Limitations
- →Requires pre-configured environment
- →GenAI steps skipped if not installed
How it compares
Provides automated end-to-end validation of tokenizer conversion instead of manual testing.
Compared to similar skills
tokenizer-checker side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| tokenizer-checker (this skill) | 0 | 3mo | No flags | Intermediate |
| langsmith-observability | 4 | 7mo | Review | Intermediate |
| mflux-debugging | 3 | 2mo | No flags | Advanced |
| debug-distributed | 1 | 6mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by openvinotoolkit
View all by openvinotoolkit →You might also like
langsmith-observability
davila7
LLM observability platform for tracing, evaluation, and monitoring. Use when debugging LLM applications, evaluating model outputs against datasets, monitoring production systems, or building systematic testing pipelines for AI applications.
mflux-debugging
filipstrand
Debug MLX ports by comparing against a PyTorch/diffusers reference via exported tensors/images (export-then-compare).
debug-distributed
inclusionAI
Guide for debugging distributed training issues in AReaL. Use when user encounters hangs, wrong results, OOM, or communication errors.
aoti-debug
pytorch
Debug AOTInductor (AOTI) errors and crashes. Use when encountering AOTI segfaults, device mismatch errors, constant loading failures, or runtime errors from aot_compile, aot_load, aoti_compile_and_package, or aoti_load_package.
benchmark-kernel
flashinfer-ai
Guide for benchmarking FlashInfer kernels with CUPTI timing
debug-model
vladmandic
Debug a broken SD.Next or Diffusers model integration. Use when a newly added or ported model fails to load, misdetects, crashes during prompt encoding or sampling, or produces incorrect outputs.