Use Phi-4-mini's own BOS and EOS ids in its example config - #22042
Use Phi-4-mini's own BOS and EOS ids in its example config#22042john-rocky wants to merge 1 commit into
Conversation
🔗 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
|
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|>).
3e14c95 to
0f4c3f1
Compare
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.