Instructions to use jefflaporte/chandra-ocr-2-MLX-4bit-mixed_4_8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use jefflaporte/chandra-ocr-2-MLX-4bit-mixed_4_8 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("jefflaporte/chandra-ocr-2-MLX-4bit-mixed_4_8") config = load_config("jefflaporte/chandra-ocr-2-MLX-4bit-mixed_4_8") # 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 jefflaporte/chandra-ocr-2-MLX-4bit-mixed_4_8 with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "jefflaporte/chandra-ocr-2-MLX-4bit-mixed_4_8"
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": "jefflaporte/chandra-ocr-2-MLX-4bit-mixed_4_8" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use jefflaporte/chandra-ocr-2-MLX-4bit-mixed_4_8 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 "jefflaporte/chandra-ocr-2-MLX-4bit-mixed_4_8"
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 jefflaporte/chandra-ocr-2-MLX-4bit-mixed_4_8
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use jefflaporte/chandra-ocr-2-MLX-4bit-mixed_4_8 with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "jefflaporte/chandra-ocr-2-MLX-4bit-mixed_4_8"
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 "jefflaporte/chandra-ocr-2-MLX-4bit-mixed_4_8" \ --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"
Chandra OCR 2 — MLX 4-bit (mixed_4_8)
An MLX mixed 4/8-bit quantization of Chandra OCR 2 by Datalab, for Apple Silicon.
These files are modified: the language model's weights are quantized from the original BF16 checkpoint. The vision tower is unchanged (BF16), and so are the tokenizer, chat template and processor configuration. All credit for the model belongs to Datalab; see the original model card for what Chandra does and how it was evaluated.
Chandra OCR 2 is built on Qwen3.5-4B by the Qwen team,
Alibaba Cloud, licensed under the Apache License 2.0, a copy of which is included as
LICENSE-Qwen.
License and use restrictions
This derivative is distributed under the same license as the original, included as
LICENSE (a modified OpenRAIL-M). Its use restrictions apply to these files too,
including the commercial restrictions in Attachment A: no use by an organization with more than
$2M in annual revenue or in total funding, except personal or research use, and no use by a
competitor of Datalab. Commercial licenses are available from Datalab at https://www.datalab.to/.
Quantization
mlx-vlm's mixed_4_8 recipe, which follows llama.cpp's Q4_K_M: projections are affine 4-bit in
groups of 64, except these, which are 8-bit:
- the token table, which is also the output head (the model ties them);
v_projandmlp.down_projin the first and last eighth of the layers and in every third layer between them.
Rounded to nearest, with no calibration. The vision tower stays BF16. 3.3 GB.
A plain 4-bit quantization (the token table and head at 4-bit too) misread a date on one of the test pages ("3 September" as "5 September"); this recipe read it correctly.
Made with mlx-vlm 0.7.6 (see quantization.json for the exact source revision and tools):
mlx_vlm convert --hf-path datalab-to/chandra-ocr-2 --mlx-path chandra-ocr-2-MLX-4bit-mixed_4_8 \
-q --quant-predicate mixed_4_8
mlx-vlm rewrites the processor configuration on conversion; the original
preprocessor_config.json, processor_config.json and video_preprocessor_config.json were
restored, since vLLM rejects the rewritten ones and the preprocessing is the original model's.
Quality
On nine scanned 1940s typewritten documents (memos, letters, an expense ledger), its text matched the original BF16 model's on six pages. On the other three it differed in layout, not content: line breaks dropped inside table cells, a separator labeled as text rather than a page footer, and a different (and correct) row alignment of a ledger's amounts.
This is a spot check, not a benchmark: run your own evaluation (for example olmOCR-bench) before relying on it.
Usage
With vllm-metal and Chandra's own client
(pip install chandra-ocr):
vllm serve jefflaporte/chandra-ocr-2-MLX-4bit-mixed_4_8 --served-model-name chandra \
--mm-processor-kwargs '{"min_pixels": 3136, "max_pixels": 6291456}'
chandra input.pdf ./output --method vllm
With mlx-vlm:
python -m mlx_vlm.server --model jefflaporte/chandra-ocr-2-MLX-4bit-mixed_4_8
Chandra reads a page at up to 6,291,456 pixels; a server that caps images lower can lose the layout of dense pages.
- Downloads last month
- 21
4-bit
Model tree for jefflaporte/chandra-ocr-2-MLX-4bit-mixed_4_8
Base model
datalab-to/chandra-ocr-2