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.
--revisiondefaults tov0.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 unquantisedmodel.safetensorsand passes it asmax serve --weight-path; future quantised variants aremodel-<variant>.safetensors. The unquantised file has no encoding token in its name because MAX reads hints such asbf16out of weight filenames and would refuse the CPU path.--ngram-sizesets the no-repeat-n-gram guard, default 35;0switches 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5f9d7f0d74191bdf3ca5f399bf2e2653da9c7b3f15a237093ea32a701ba4aef
|
|
| MD5 |
bdb6fc080afdd3aa21e19e08177d3628
|
|
| BLAKE2b-256 |
ad000e5a973c974f13910ff3dd70daea7fe813a5c2c36fc46627c5b79e4393ec
|
Provenance
The following attestation bundles were made for unlimited_ocr_max-0.1.0.tar.gz:
Publisher:
publish.yml on kthr/unlimited-ocr-max
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unlimited_ocr_max-0.1.0.tar.gz -
Subject digest:
d5f9d7f0d74191bdf3ca5f399bf2e2653da9c7b3f15a237093ea32a701ba4aef - Sigstore transparency entry: 2737427259
- Sigstore integration time:
-
Permalink:
kthr/unlimited-ocr-max@2c9b310a3df3c56e31ecc31a587129ae9e2e450d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/kthr
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2c9b310a3df3c56e31ecc31a587129ae9e2e450d -
Trigger Event:
push
-
Statement type:
File details
Details for the file unlimited_ocr_max-0.1.0-py3-none-any.whl.
File metadata
- Download URL: unlimited_ocr_max-0.1.0-py3-none-any.whl
- Upload date:
- Size: 58.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1b8b85c976993fc4fe6a8cd699fc56d449c41dd325327294afed4725b249517
|
|
| MD5 |
34ecaac82ec1cfdd77d02b8fa0f445ac
|
|
| BLAKE2b-256 |
da9ecd156ad77819517722535fa822f61db2481ee8ca9936090b586aa3650347
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unlimited_ocr_max-0.1.0-py3-none-any.whl -
Subject digest:
f1b8b85c976993fc4fe6a8cd699fc56d449c41dd325327294afed4725b249517 - Sigstore transparency entry: 2737427388
- Sigstore integration time:
-
Permalink:
kthr/unlimited-ocr-max@2c9b310a3df3c56e31ecc31a587129ae9e2e450d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/kthr
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2c9b310a3df3c56e31ecc31a587129ae9e2e450d -
Trigger Event:
push
-
Statement type: