Use Phi-4-mini's own BOS and EOS ids in its example config - #22042
Open
john-rocky wants to merge 1 commit into
Open
Use Phi-4-mini's own BOS and EOS ids in its example config#22042john-rocky wants to merge 1 commit into
john-rocky wants to merge 1 commit into
Conversation
The config carries 151643 for both, which is Qwen's <|endoftext|>. In Phi-4-mini's vocabulary that id is the subword 'Ġprzyp', so the runner is told to start on a fragment of a Polish word and to stop on one. Phi-4-mini's generation_config.json gives bos_token_id 199999 (<|endoftext|>) and eos_token_id [200020, 199999] (<|end|>, <|endoftext|>).
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22042
Note: Links to docs will display an error until the docs builds have been completed.
|
|
This PR needs a
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
examples/models/phi_4_mini/config/phi_4_mini_xnnpack.yaml carries
151643 is Qwen's
<|endoftext|>. Phi-4-mini has a different vocabulary, and in it that id is a subword:So the runner is told to begin on a fragment of a Polish word and to stop on one, and it never sees the token the model actually ends turns with.
microsoft/Phi-4-mini-instruct/generation_config.jsongives:{"bos_token_id": 199999, "eos_token_id": [200020, 199999]}which are
<|endoftext|>and<|end|>. This patch uses those.Exported with the corrected ids (executorch 1.4.0, XNNPACK, 8da4w + 8-bit embedding, 2597.9 MB), the model answers and stops where it should:
The generation ends after 10 tokens because
<|end|>is reached, which is the part that does not happen with 151643.