Unlimited-OCR-2 — 4-bit MLX
A 4-bit MLX quantization of baidu/Unlimited-OCR-2, Baidu ERNIE's OCR / document-parsing vision-language model.
- Size: ~1.9 GB (from ~6.4 GB bf16).
- Quantization: affine, 4-bit, group size 64. Experts quantized; the SAM
vision branch kept in bf16 (
quantized_sam=false). Seequantization.jsonfor the exact per-tensor layout. - Runs on: Apple Silicon via MLX.
Architecture note
Unlimited-OCR-2 uses a custom architecture (page2d two-axis RoPE, DASH
block-sparse attention, stacked quantized MoE experts, a SAM+CLIP vision front
end). It is not loadable by generic mlx-vlm / transformers auto classes.
A native MLX-Swift decoder for it ships in
MlxOCRKit and is numerically aligned
with the Python/MLX reference.
Usage — Swift (MlxOCRKit)
minerukit uocr2 --model ./Unlimited-OCR-2-4bit-mlx --image page.png \
--prompt "Multi page parsing." --max-tokens 512
Output follows the model's block protocol
(<PAGE><BLOCK>type[x0, y0, x1, y1]<FORK> ...).
License & attribution
MIT, inherited from the base model. This repo only re-quantizes the weights to 4-bit MLX; all model credit goes to the original authors (Baidu). See the original model card.