[Model] Support Unlimited OCR - #46564
Conversation
Signed-off-by: Tianyu Guo <guoty9@mail2.sysu.edu.cn>
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Signed-off-by: Tianyu Guo <guoty9@mail2.sysu.edu.cn>
|
Documentation preview: https://vllm--46564.org.readthedocs.build/en/46564/ |
|
Hi, I’m from the Unlimited-OCR team. Could you clarify whether, in the OmniDocBench v1.5 evaluation, the coordinate information between <|det|> and <|\det|> was kept and the full output was used directly for evaluation? |
Hi, thanks for reaching out! Short answer: No, the coordinates were not kept. We don't feed the raw output into the evaluator. Each prediction first goes through a Example — raw output: After Notes:
If your v1.5 protocol expects coordinates to be retained or a different post-process, please share it and we'll re-run to match. |
Signed-off-by: Tianyu Guo <guoty9@mail2.sysu.edu.cn>
@ivanium Inheriting from |
Signed-off-by: Tianyu Guo <guoty9@mail2.sysu.edu.cn>
Thanks for the detailed reply! I will make a pass now. |
Signed-off-by: Tianyu Guo <guoty9@mail2.sysu.edu.cn>
Head branch was pushed to by a user without write access
|
Hi @gty111, the pre-commit checks have failed. Please run: uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, |
|
Thanks @gty111. Model runner changes look fine to me but could we ensure that it also works with Model Runner V2? We're hoping to deprecate Model Runner V1 soon. |
Signed-off-by: Tianyu Guo <guoty9@mail2.sysu.edu.cn>
Thanks for the review. R-SWA is now wired through Model Runner V2 as well: V2 passes per-request prompt_len as rswa_prefix_lens into the shared FlashAttention metadata builders (same as V1’s num_prompt_tokens path). One caveat: Unlimited-OCR still needs NGramPerReqLogitsProcessor for good long-document OCR, and V2 does not support custom logits processors yet — production is recommended to use V1 until that lands. We’ve smoke-tested V2 on the 14-page PDF merge without the ngram processor; R-SWA itself works on V2. |
ywang96
left a comment
There was a problem hiding this comment.
@gty111 Thanks for the great work and the collaboration with Baidu team @MurphyYin 🤝
|
I think that this PR broke: Will be pushing a fix soon. PS |
Signed-off-by: Tianyu Guo <guoty9@mail2.sysu.edu.cn> Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn> Co-authored-by: Isotr0py <mozf@mail2.sysu.edu.cn> Co-authored-by: Roger Wang <hey@rogerw.io>
…ngle-image batch OCR) (#63) * ocr: add unlimited-ocr-vllm.py recipe (Baidu Unlimited-OCR, 3.3B — single-image batch OCR) Offline-vLLM batch recipe for baidu/Unlimited-OCR (3.3B, MIT, a DeepSeek-OCR descendant; vLLM support landed upstream 2026-06-28), mirroring deepseek-ocr-vllm.py. One image per row -> layout-grounded markdown; --strip-grounding for clean text, --grounding-column to keep both clean text and the raw <|det|> bboxes. Runs on Baidu's dedicated vllm/vllm-openai:unlimited-ocr image (arch not in a stable wheel; vLLM/torch come from the image via PYTHONPATH). Validated on HF Jobs: ufo-ColPali (5/5) and encyclopaedia-britannica-1771 (6/6 content pages ~= ground-truth ocr_text length). Multi-page is single-image-only via vLLM (the integration garbles multi-image, and is unproven upstream — PR vllm-project/vllm#46564 benchmarks single-page only). Multi-page lives in the model's SGLang build: serving-unlimited-ocr.md now carries a validated working SGLang command (pinned lmsysorg/sglang:v0.5.10.post1 + a100-large + --attention-backend flashinfer; HF h200 nodes currently fail GPU init with CUDA error 802) alongside the vLLM single-image serving option. Also updates ocr/README.md (table row, serve line, modes table, dedicated-image note) and ocr/CLAUDE.md (dev notes + full investigation). Additive only; superset gate (tools/verify-superset.sh ocr uv-scripts/ocr) passes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * ocr: correct unlimited-ocr multi-page framing (vLLM works on clean docs) Control test (same clean synthetic 2-page doc, vLLM server) returned both pages <PAGE>-separated with real text — so the earlier "vLLM multi-page garbles/broken" was an input-difficulty artifact (the hard Britannica/ufo scans), not an engine failure. Corrected across the recipe docstring, serving-unlimited-ocr.md, README, and CLAUDE.md: both engines read clean multi-page docs; SGLang is the *more robust* path (held up on hard/degraded scans where vLLM hallucinated). Batch recipe stays single-image; multi-page is a serving concern. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * ocr: address review on unlimited-ocr-vllm.py (column guard, upload retry, --model) - guard add_column against an existing output/grounding column (fixes the in-place multi-model append crash; parity with deepseek-ocr2-vllm.py) - push_to_hub: 3-attempt retry + HF_HUB_DISABLE_XET fallback + max_shard_size="500MB" - add --model flag (default baidu/Unlimited-OCR) - CLAUDE.md: move the (Production Ready) entry to "Other OCR Scripts"; note the deferred SGLang multi-page-batch follow-up Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Tianyu Guo <guoty9@mail2.sysu.edu.cn> Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn> Co-authored-by: Isotr0py <mozf@mail2.sysu.edu.cn> Co-authored-by: Roger Wang <hey@rogerw.io>
Signed-off-by: Tianyu Guo <guoty9@mail2.sysu.edu.cn> Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn> Co-authored-by: Isotr0py <mozf@mail2.sysu.edu.cn> Co-authored-by: Roger Wang <hey@rogerw.io> Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
Signed-off-by: Tianyu Guo <guoty9@mail2.sysu.edu.cn> Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn> Co-authored-by: Isotr0py <mozf@mail2.sysu.edu.cn> Co-authored-by: Roger Wang <hey@rogerw.io>
Signed-off-by: Tianyu Guo <guoty9@mail2.sysu.edu.cn> Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn> Co-authored-by: Isotr0py <mozf@mail2.sysu.edu.cn> Co-authored-by: Roger Wang <hey@rogerw.io>
Signed-off-by: Tianyu Guo <guoty9@mail2.sysu.edu.cn> Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn> Co-authored-by: Isotr0py <mozf@mail2.sysu.edu.cn> Co-authored-by: Roger Wang <hey@rogerw.io>
Purpose
Support https://huggingface.co/baidu/Unlimited-OCR
Test
OmniDocBench
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.