Skip to main content

unlimited-ocr-max

baidu/Unlimited-OCR served through MAX on Apple Silicon. The vision tower, the MoE decoder and its sliding-window attention are rebuilt as a MAX custom architecture with a Mojo custom op (ngram_block, the no-repeat-n-gram guard), and exposed as an OpenAI-compatible endpoint on the Metal GPU or the CPU. The weights are baidu's, unchanged, served from kthierbach/unlimited-ocr-max.

Install

uv tool install --extra-index-url https://whl.modular.com/nightly/simple/ unlimited-ocr-max
# or, into a venv
pip install --extra-index-url https://whl.modular.com/nightly/simple/ unlimited-ocr-max

The extra index is required: the package pins one exact MAX nightly build (max[all]==26.6.0.dev2026082707) because the port depends on fixes no stable MAX release carries yet, and that build is published only on Modular's nightly index. The pin and the flag go away with the next stable Modular release.

Serve

unlimited-ocr-max serve --devices gpu   # Metal
unlimited-ocr-max serve --devices cpu   # supported, slow

This downloads the model repository once (6.2 GiB) and runs max serve with this port's flags, on http://127.0.0.1:8010 under the model id unlimited-ocr-max.

  • --revision defaults to v0.1.0, the model-repo tag this package version was validated against, so a fixed package version serves fixed weights; the tag must exist or the download fails before MAX starts. Ignored for a local directory.
  • --model <dir> serves a local copy with the repository's layout (config.json, the tokenizer files, model.safetensors).
  • --weights bf16 (the only variant today) selects the unquantised model.safetensors and passes it as max serve --weight-path; future quantised variants are model-<variant>.safetensors. The unquantised file has no encoding token in its name because MAX reads hints such as bf16 out of weight filenames and would refuse the CPU path.
  • --ngram-size sets the no-repeat-n-gram guard, default 35; 0 switches it off, which reproduces the PyTorch reference byte for byte.

One page per request, base mode, image first:

curl -s http://127.0.0.1:8010/v1/chat/completions -H 'Content-Type: application/json' -d @- <<EOF
{"model": "unlimited-ocr-max", "temperature": 0, "max_tokens": 1766,
 "messages": [{"role": "user", "content": [
   {"type": "text", "text": "<|grounding|>Convert the document to markdown."},
   {"type": "image_url", "image_url": {"url": "data:image/png;base64,$(base64 < page.png)"}}]}]}
EOF

Tested on

Apple M4, 24 GB unified memory, macOS 26.5.2, Python 3.12, max==26.6.0.dev2026082707. The GPU path needs full Xcode plus the Metal Toolchain (xcodebuild -downloadComponent MetalToolchain); the Command Line Tools do not ship the Metal compiler MAX shells out to. Greedy output with the guard off is byte-identical to the fp32 PyTorch reference on both devices. The server is large for a 24 GB machine; run one at a time and leave it the memory.

Not supported

gundam (tiled) mode — the tiling code is in the package and usable in-process, but the served batch holds one resolution; batch sizes above 1 (the prefill graph's sequence length is static); multi-GPU.

References

The model is described in Unlimited OCR Works (Yin et al., 2026), arXiv:2606.23050; this package changes the serving runtime only.

License and authorship

MIT for this code; the weights, tokenizer and config.json are baidu's, redistributed unchanged under baidu's MIT (both notices in LICENSE).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unlimited_ocr_max-0.1.0.tar.gz (49.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unlimited_ocr_max-0.1.0-py3-none-any.whl (58.6 kB view details)

Uploaded Python 3

File details

Details for the file unlimited_ocr_max-0.1.0.tar.gz.

File metadata

  • Download URL: unlimited_ocr_max-0.1.0.tar.gz
  • Upload date:
  • Size: 49.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for unlimited_ocr_max-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d5f9d7f0d74191bdf3ca5f399bf2e2653da9c7b3f15a237093ea32a701ba4aef
MD5 bdb6fc080afdd3aa21e19e08177d3628
BLAKE2b-256 ad000e5a973c974f13910ff3dd70daea7fe813a5c2c36fc46627c5b79e4393ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for unlimited_ocr_max-0.1.0.tar.gz:

Publisher: publish.yml on kthr/unlimited-ocr-max

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file unlimited_ocr_max-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for unlimited_ocr_max-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f1b8b85c976993fc4fe6a8cd699fc56d449c41dd325327294afed4725b249517
MD5 34ecaac82ec1cfdd77d02b8fa0f445ac
BLAKE2b-256 da9ecd156ad77819517722535fa822f61db2481ee8ca9936090b586aa3650347

See more details on using hashes here.

Provenance

The following attestation bundles were made for unlimited_ocr_max-0.1.0-py3-none-any.whl:

Publisher: publish.yml on kthr/unlimited-ocr-max

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page