AIsaAIsaStudio English 打开 AIsa Studio

Baidu 发布 Unlimited-OCR-2,利用 SR-SWA 技术实现超长文档的无界解析

原标题:baidu/Unlimited-OCR-2 (image-text-to-text)

Baidu 发布 Unlimited-OCR-2 模型,利用稀疏参考滑动窗口注意力 SR-SWA 机制实现了超长文档的无界解析。该机制将文本视觉注意力压缩到固定大小的工作参考集,使得计算复杂度和每步解码延迟随文档长度增加而保持恒定。Unlimited-OCR-2 在 MPDocBench 等超长文档基准测试中表现达到当前最先进水平。

为什么值得看

Baidu 的 Unlimited-OCR-2 引入 SR-SWA 机制,解决了超长文档的二次复杂度问题,实现了无界文档解析的 SOTA 性能。

阅读原文 ↗

本页的摘要、推荐理由与解读出自 AIsa Studio 的 AI 风向智能体,原文版权归原作者所有。

原文

Hugging Face 热门模型第 15 名:baidu/Unlimited-OCR-2,228 赞,近期下载 513 次。 标签:transformers, safetensors, unlimited-ocr, feature-extraction, baidu, vision-language, ocr, custom_code, image-text-to-text, multilingual, arxiv:2606.23050, license:mit

README:

Unlimited OCR Works 2

Pioneering the OCR-3.0 Era: From Long- to Unlimited-Horizon Parsing.

Release

  • [2026/10/27] 📊 We release MarathonDocBench, a new benchmark for ultra-long document parsing
  • [2026/10/27] 🤝 Thanks to the ModelScope community for their support. Our model is now available at ModelScope.
  • [2026/10/27] 🤝 Thanks to the Baidu Cloud team for their support. Our model is now available on Baidu Cloud.
  • [2026/10/27] 🤝 Thanks to AK for creating a new demo for us. Try it at Unlimited-OCR-2.
  • [2026/10/27] 🚀 We release Unlimited OCR 2, achieving unlimited-horizon parsing with SR-SWA.
  • [2026/07/21] 🤝 Thanks to the ms-swift community for their support, our model now supports training with ms-swift.
  • [2026/07/03] 🤝 Thanks to the Baidu Cloud team for their support. Our model is now available on Baidu Cloud.
  • [2026/06/28] 🤝 Thanks to the vLLM community and Tianyu Guo for their support, our model now supports vLLM inference.
  • [2026/06/24] 🤝 Thanks to AK for creating a demo for us. It is now available at Hugging Face Spaces.
  • [2026/06/23] 📄 Our paper is now available on arXiv.
  • [2026/06/23] 🤝 Thanks to the ModelScope community for their support. Our model is now available at ModelScope.
  • [2026/06/22] 🚀 We present Unlimited-OCR, aiming to push Deepseek-OCR one step further.

What's New in 2

  • Sparse Reference Sliding Window Attention (SR-SWA): Compresses text-visual attention interactions from ultra-long sequences down to a fixed-size set of working references (e.g., 512 tokens). This bounds computational complexity, keeping per-step decoding latency and memory footprint nearly constant regardless of document length.
  • From Long- to Unlimited-Horizon Parsing: Powered by SR-SWA, Unlimited-OCR 2 achieves true, unbounded document parsing within a finite context window—effectively eliminating quadratic attention scaling and memory bottlenecks as documents grow.
  • Ultra-Long Document Parsing SOTA: Achieves state-of-the-art performance across both dozens-of-pages benchmarks (e.g., MPDocBench) and extreme hundred-page benchmarks (e.g., MarathonDocBench).

Inference

Unlimited OCR 2 supports Transformers (native, for quick tests) and SGLang (recommended for serving).

Transformers

Tested with Python 3.10, torch==2.13.0, transformers==4.52.1, huggingface-hub==0.36.0, tokenizers==0.21.4, on an NVIDIA A800-80GB:

pip install torch==2.13.0 torchvision pillow transformers==4.52.1 huggingface-hub==0.36.0 \
  tokenizers==0.21.4 addict==2.4.0 einops==0.8.2 easydict==1.13

Load the model once:

import torch
from transformers import AutoModel, AutoTokenizer

model_name = "baidu/Unlimited-OCR-2"
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModel.from_pretrained(model_name, trust_remote_code=True, use_safetensors=True,
                                  torch_dtype=torch.bfloat16).eval().cuda()

Multi-page inference (infer_multi). All pages of a document are parsed in one request, so the model can use cross-page context. Pass the page images in page order:

pages = [f"your_doc/page_{i}.jpg" for i in range(1, 8)]

text, num_tokens = model.infer_multi(tokenizer, image_files=pages,
                                     output_path="output/multi", save_results=True)

The prompt is built automatically as "" * num_pages + "Multi page parsing.", and each page is encoded as one global view (base mode). The output contains one `` per input page, in the same order as image_files.

Single-page inference (infer). A single page is encoded with dynamic tiling (gundam mode) by default:

text = model.infer(tokenizer, image_file="your_doc/page_1.jpg",
                   output_path="output/

原文版权归 Hugging Face 热门模型 及原作者所有,本站转载仅供阅读。如需删除,请联系 support@aisa.one。

事件综述

百度发布 Unlimited-OCR-2:SR-SWA 实现超长文档解析

2026年10月27日,百度团队发布 Unlimited-OCR-2 模型,采用稀疏参考滑动窗口注意力(SR-SWA)机制,将超长序列的文本-视觉注意力压缩到固定数量的工作参考(如 512 token),使解码延迟和显存占用不随文档长度增长,从而在有限上下文窗口内实现对无上限长度文档的解析。据 r/LocalLLaMA 报道,该模型在 MPDocBench 和 MarathonDocBench 等数十页与上百页基准上达到 SOTA;模型卡提供 Transformers 与 SGLang 两种推理方式及显存调优参数,支持 vLLM 推理和 ms-swift 训练,论文见 arXiv 2606.23050。10月28日,Hugging Face 热门模型页面亦报道该模型发布,称 SR-SWA 使计算复杂度和每步解码延迟随文档长度保持恒定,并在 MPDocBench 等超长文档基准上达到当前最先进水平。两篇报道均来自二级信息源,关于基准表现的说法以报道引述为准,目前未见第三方实测或后续跟进报道。