Repository navigation
Fix: Added check the type of tokenizer.json's model_merges - #987
NEWTON MALLICK (N-E-W-T-O-N) wants to merge 12 commits into
Conversation
|
Mistral |
|
Gpt-2
|
awesome, thanks for this! could you add a unit test here as well to ensure expected functionality: https://github.com/microsoft/onnxruntime-extensions/tree/main/test? |
|
/azp run onnxruntime-extensions.CI |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Using phi-4 as an example |
4bc89ad to
deb1721
Compare
|
The following Functions is only called when |
Sayan Shaw (sayanshaw24)
left a comment
There was a problem hiding this comment.
please use test/data/phi-4-base or test/data/phi-4-mini-reasoning, we'd like to minimize tokenizer files checked into the repo; (also, FYI onnxruntime-extensions only needs the tokenizer.json and tokenizer_config.json files to load tokenizers).
09be3ba to
275b820
Compare
|
Commenter does not have sufficient privileges for PR 987 in repo microsoft/onnxruntime-extensions |
|
Hi Sayan Shaw (@sayanshaw24) |
|
/azp run onnxruntime-extensions.CI |
|
Azure Pipelines successfully started running 1 pipeline(s). |
NEWTON MALLICK (N-E-W-T-O-N)
left a comment
There was a problem hiding this comment.
Merge the latest code .Please rerun the pipeline
|
/azp where |
|
Azure DevOps orgs getting events for this repository: |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
A critical merge-format bug remains, and string-merge coverage is missing.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
Updates Hugging Face tokenizer conversion to support alternate merge formats and adds Phi-4 tokenizer coverage.
Changes:
- Handles nested-list and string merge representations.
- Adds a local Phi-4 tokenizer regression test.
| File | Summary |
|---|---|
test/test_autotokenizer.py |
Adds Phi-4 coverage, but does not test string merges. Nit: Add representative string-merge cases. |
onnxruntime_extensions/_hf_cvt.py |
Handles tokenizer merge formats. Critical: The generator condition is always truthy and can corrupt string merges. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The list-of-lists check tested a generator object, which is always truthy, so flat string merges (e.g. phi-4-base, GPT-2) were split into single characters. Move the logic into HFTokenizerConverter.normalize_merges and add a phi-4-base test with text that needs BPE merges.
|
Sayan Shaw (@sayanshaw24) could you please re-review? Your earlier comments are addressed: the tests only use the existing |


Modern Tokenizer store merge's value as list of lists of strings. But models like GPT-2 or gemma-2 store as a list of strings
Ex Mistral
Added a check for this fix