Run this model with HF Jobs
Run VisualInference/OCRia-1-MLX-4bit on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/VisualInference/OCRia-1-MLX-4bit. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/VisualInference/OCRia-1-MLX-4bit on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/VisualInference/OCRia-1-MLX-4bit. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Instructions to use VisualInference/OCRia-1-MLX-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use VisualInference/OCRia-1-MLX-4bit with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("VisualInference/OCRia-1-MLX-4bit") config = load_config("VisualInference/OCRia-1-MLX-4bit") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use VisualInference/OCRia-1-MLX-4bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "VisualInference/OCRia-1-MLX-4bit"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "VisualInference/OCRia-1-MLX-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use VisualInference/OCRia-1-MLX-4bit with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "VisualInference/OCRia-1-MLX-4bit"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default VisualInference/OCRia-1-MLX-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use VisualInference/OCRia-1-MLX-4bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "VisualInference/OCRia-1-MLX-4bit"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "VisualInference/OCRia-1-MLX-4bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
OCRia-1 for MLX, 4bit
For Macs with 8 GB of memory and up. OCRia-1 is LlamaIndex's 4B vision-language model for document parsing (a fine-tune of Qwen3.5-4B): it reads a page image and writes the page as Markdown, with tables in HTML. This is a 4-bit build in mlx-vlm format with the vision tower kept at bf16: 2.83 GiB of weights, peak memory 4.5 GiB on a full page.
| Build | Weights | Language model | Transcripts vs bf16 (4 pages) |
|---|---|---|---|
| 4bit (this repo) | 2.83 GiB | 4-bit affine, groups of 64 | every table and chart cell identical; LaTeX bracket style and one chart title differ |
| 8bit | 4.78 GiB | 8-bit affine, groups of 64 | identical on 3 pages; on the fourth, one line closes its bold and underline tags earlier |
Licence: read this first
OCRia-1 is not under an open-source licence. The weights are released under the OCRia-1 Model and Code License
(a modified OpenRAIL-M), included here as LICENSE, and this build is a Derivative of the Model under it. Its
use-based restrictions (paragraph 5 and Attachment A) apply to you: in short, free for research and personal use and
for organisations under $2M in annual revenue and $2M in funding; a commercial licence from LlamaIndex is needed above
those thresholds and for any document-parsing, OCR or extraction product that competes with LlamaParse or
LlamaCloud. The licence text is what binds; read it. Licensing: llamaindex.ai/contact.
Model and weights by LlamaIndex, Inc. This build is not made or endorsed by LlamaIndex. Changes made: the language
model's linear layers and embeddings were quantized as stated above, everything else converted from float32 to bf16;
the Transformers/CUDA grounding code (ocria_grounding/) and examples are not included.
Use
pip install -U mlx-vlm
mlx_vlm.generate --model VisualInference/OCRia-1-MLX-4bit \
--system "$(curl -sL https://huggingface.co/VisualInference/OCRia-1-MLX-4bit/resolve/main/prompt.txt)" \
--prompt "" --no-enable-thinking --image page.png --max-tokens 24576 --temperature 0
Settings that matter, as on the original card:
- The system prompt is
prompt.txt(included), with no user text, one page image per request. - Thinking off. The Qwen3.5 template turns thinking on by default; with it on, the model answers in the wrong format.
- Greedy decoding and a large output limit. Dense pages can need more than 20,000 tokens.
- Page images: render PDFs at about 200-300 DPI (the original's benchmarks use about 4.1 megapixels per page).
In Python:
from mlx_vlm import load, generate
from mlx_vlm.prompt_utils import apply_chat_template
model, processor = load("VisualInference/OCRia-1-MLX-4bit")
system = open("prompt.txt").read()
prompt = apply_chat_template(processor, model.config,
[{"role": "system", "content": system}, {"role": "user", "content": ""}],
num_images=1, enable_thinking=False)
print(generate(model, processor, prompt, image=["page.png"], max_tokens=24576, temperature=0.0).text)
Smoke test
The four example pages from the original card, transcribed greedily with the settings above, on this build and on the original bf16 weights in mlx-vlm, on a Mac mini (M4 Pro, 48 GB). Similarity is the character-level ratio between the two transcripts (1.000 = identical).
| Page | Output tokens | Similarity to bf16 | Decode, this build | Decode, bf16 |
|---|---|---|---|---|
| insurance form with a 163-cell table | 1977 | 1.000 | 79.9 tok/s | 27.2 tok/s |
| line chart (data read off the plot) | 467 | 0.922 | 81.7 tok/s | 27.3 tok/s |
| handwritten math (Czech) | 302 | 0.910 | 82.2 tok/s | 26.6 tok/s |
| hearing notice, formatted text | 1060 | 0.995 | 82.2 tok/s | 26.5 tok/s |
Prompt processing runs at about 500 tok/s on this machine; a page image is about 1,300 prompt tokens.
Not measured
ParseBench or olmOCR-bench scores for this build: not run. The layout-box grounding from the original repository needs Transformers attention maps and is not available in MLX. Tested on one machine.
Credits
OCRia-1: LlamaIndex, Inc., see the original card and its technical report. Base model: Qwen3.5-4B, Qwen team, Apache 2.0. MLX runtime: the mlx-vlm authors. Conversion and this card: VisualInference.
- Downloads last month
- 9
4-bit