Fix Phi-3.5-vision eos token temporary fix#1804
Open
dhandhalyabhavik wants to merge 1 commit into
Open
Conversation
rkazants
reviewed
Jun 19, 2026
| generation_config = getattr(model, "generation_config", None) | ||
| if generation_config is not None: | ||
| try: | ||
| # Todo: delete this check once phi-3 eos token get fixed in generation_configs.json |
Collaborator
There was a problem hiding this comment.
can you please provide discussion raised in Github or HF about this issue? And refer with the link.
Author
There was a problem hiding this comment.
I found following discussion on HF,
https://huggingface.co/microsoft/Phi-3.5-vision-instruct/discussions/40
No discussion on GitHub transformers repo.
The script sample_inference.py on HF official repo replaces EOS token at generation, checkout this line - https://huggingface.co/microsoft/Phi-3.5-vision-instruct/blob/main/sample_inference.py#L58
f9f6138 to
28fc402
Compare
Author
@rkazants Done, added EOS specific tests with issue number. If upstream HF gets updated then we can later on remove the temp fix. Rebased the repo to inherit latest changes. |
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.
What does this PR do?
As pointed our correctly in issue #1630 with default config provided by
microsoft/Phi-3.5-vision-instructresults into infinite generation loop. The issue is mismatch in staleeos_token_id=2ingeneration_config.jsonwhile tokenizer's actual eos token is32000. This fix modifieseos_token_idto be[2, 32000]. I have added#TODOto remove it in future when upstream config gets fixed.Fixes # (issue)
#1630
Before submitting