Repository navigation
fix(unlimited-ocr): don't add a second <image> to a prompt that has one - #4822
Merged
jundot merged 1 commit intoOct 26, 2026
Merged
Conversation
The Unlimited-OCR prompt patch prepended <image> to every user message with images. The model card's documented prompt already starts with <image>, so a one-image request carried two tokens, failed the processor's token count assertion and returned HTTP 500.
Contributor
Author
|
The two failing cluster tests pass for me locally. Main's CI on the same commit is red too, on a different timing test: https://github.com/jundot/omlx/actions/runs/40111714156 |
jundot
approved these changes
Oct 26, 2026
jundot
left a comment
Owner
There was a problem hiding this comment.
I reproduced the 500 on main with the model card prompt <image>document parsing., and this branch returns 200 with the same output as plain document parsing.. Really appreciate the clear repro and the small fix @tc3oliver. LGTM, merging.
@noonkho this fixes the <image> 500 from #3740. The dropped extra images part is still open.
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.
Refs #3740
If you send the prompt from the Unlimited-OCR model card,
<image>document parsing., with one image, the server returns 500. The prompt patch always prepends<image>, so the processor sees two tokens for one image and its assert fails:This only adds the token when the text doesn't already have one. It doesn't touch the other half of #3740, where extra images get dropped.
I tried it on a local server with mlx-community/Unlimited-OCR-4bit. On main that prompt gives the 500 above. On this branch it gives 200 with 488 prompt tokens and the same output as
document parsing.without the token. The new test fails on main with<image><image>document parsing..Request I used