Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #7337
Phi-4 model is using the Tiktoken tokenizer with the Cl100K_Base encoding file (like gpt-4 tokenizer). It uses different special tokens though
<|im_start|>,<|im_end|>, and<|im_sep|>.The tokenizer can be created by:
Note
The Phi-4 model on Hugging Face (https://huggingface.co/microsoft/phi-4/tree/main) converts the CL100K_Base encoding vocabulary into
vocab.jsonandmerges.txt, which are compatible with theGPT2TokenizerFasttokenizer in Python. This is likely intended for users who are not using the Tiktoken tokenizer, though both should generally produce the same results.