Image-Text-to-Text
Transformers
Safetensors
GGUF
English
qwen3_5
llama-cpp
mtp
ocr
pdf
markdown
layout
text-generation-inference
llama-cli
repack
HTML
JSON
conversational
Instructions to use prithivMLmods/chandra-ocr-2-MTP-Repacked with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/chandra-ocr-2-MTP-Repacked with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="prithivMLmods/chandra-ocr-2-MTP-Repacked") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("prithivMLmods/chandra-ocr-2-MTP-Repacked") model = AutoModelForMultimodalLM.from_pretrained("prithivMLmods/chandra-ocr-2-MTP-Repacked", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use prithivMLmods/chandra-ocr-2-MTP-Repacked with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf prithivMLmods/chandra-ocr-2-MTP-Repacked:Q4_K_M # Run inference directly in the terminal: llama cli -hf prithivMLmods/chandra-ocr-2-MTP-Repacked:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf prithivMLmods/chandra-ocr-2-MTP-Repacked:Q4_K_M # Run inference directly in the terminal: llama cli -hf prithivMLmods/chandra-ocr-2-MTP-Repacked:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf prithivMLmods/chandra-ocr-2-MTP-Repacked:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf prithivMLmods/chandra-ocr-2-MTP-Repacked:Q4_K_M
Use Docker
docker model run hf.co/prithivMLmods/chandra-ocr-2-MTP-Repacked:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use prithivMLmods/chandra-ocr-2-MTP-Repacked with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prithivMLmods/chandra-ocr-2-MTP-Repacked" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/chandra-ocr-2-MTP-Repacked", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/prithivMLmods/chandra-ocr-2-MTP-Repacked:Q4_K_M
- SGLang
How to use prithivMLmods/chandra-ocr-2-MTP-Repacked with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "prithivMLmods/chandra-ocr-2-MTP-Repacked" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/chandra-ocr-2-MTP-Repacked", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "prithivMLmods/chandra-ocr-2-MTP-Repacked" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/chandra-ocr-2-MTP-Repacked", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Ollama
How to use prithivMLmods/chandra-ocr-2-MTP-Repacked with Ollama:
ollama run hf.co/prithivMLmods/chandra-ocr-2-MTP-Repacked:Q4_K_M
- Unsloth Desktop
- Pi
How to use prithivMLmods/chandra-ocr-2-MTP-Repacked with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf prithivMLmods/chandra-ocr-2-MTP-Repacked:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "prithivMLmods/chandra-ocr-2-MTP-Repacked:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use prithivMLmods/chandra-ocr-2-MTP-Repacked with Docker Model Runner:
docker model run hf.co/prithivMLmods/chandra-ocr-2-MTP-Repacked:Q4_K_M
- Lemonade
How to use prithivMLmods/chandra-ocr-2-MTP-Repacked with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull prithivMLmods/chandra-ocr-2-MTP-Repacked:Q4_K_M
Run and chat with the model
lemonade run user.chandra-ocr-2-MTP-Repacked-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use prithivMLmods/chandra-ocr-2-MTP-Repacked with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf prithivMLmods/chandra-ocr-2-MTP-Repacked:Q4_K_M
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 prithivMLmods/chandra-ocr-2-MTP-Repacked:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use prithivMLmods/chandra-ocr-2-MTP-Repacked with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf prithivMLmods/chandra-ocr-2-MTP-Repacked:Q4_K_M
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 "prithivMLmods/chandra-ocr-2-MTP-Repacked:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
File size: 8,264 Bytes
7424599 434cf8e d7a4d01 9d571e5 d7a4d01 3e01291 d7a4d01 9d571e5 d7a4d01 8365185 d7a4d01 7424599 b6cb6f4 77907a8 1f7bb93 7424599 9d571e5 c4f03e5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | ---
library_name: transformers
base_model:
- datalab-to/chandra-ocr-2
license: openrail
license_link: https://huggingface.co/datalab-to/chandra-ocr-2/blob/main/LICENSE
tags:
- llama-cpp
- mtp
- ocr
- pdf
- markdown
- layout
- text-generation-inference
- llama-cli
- repack
- HTML
- JSON
language:
- en
pipeline_tag: image-text-to-text
---
# **chandra-ocr-2-MTP-Repacked**
> Chandra-OCR-2 from Datalab is a state-of-the-art OCR model that outputs structured markdown, HTML, or JSON while preserving precise layout information from images and PDFs across 90+ languages. It achieves SOTA benchmarks with 85.9% on olmocr and 77.8% multilingual score (+12% over Chandra 1), delivering major gains in math equation parsing, complex table reconstruction (including merged cells), handwriting recognition, form elements like checkboxes, and wide-document layouts alongside vastly improved image captioning and diagram extraction. Available via free playground, hosted API for production speed/accuracy, or local deployment through HuggingFace Transformers/vLLM, it excels at transforming challenging real-world documents—financial filings, research papers, historical scans, multilingual forms—into semantically rich structured data for downstream AI pipelines and automation workflows.
> [!NOTE]
> MTP — Speculative Decoding: Yes | GGUF — [chandra-ocr-2-MTP-Repacked(GGUF)](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/tree/main/GGUF)
> [!NOTE]
Multi-Token Prediction (MTP) GGUF is a specialized GGUF model file format extension that integrates speculative decoding directly into the model weights to significantly accelerate local inference. Unlike traditional speculative decoding which requires a separate, smaller "draft" model, MTP GGUF files include additional output heads within the main model architecture that predict multiple future tokens in a single forward pass.
## Model Files
| File Name | Quant Type | File Size | File Link | Description |
|-----------|------------|-----------|-----------|-------------|
| chandra-ocr-2-MTP.BF16.gguf | BF16 | 8.67 GB | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/GGUF/chandra-ocr-2-MTP.BF16.gguf) | Full BF16 weights. Highest quality, largest file size. |
| chandra-ocr-2-MTP.Q3_K_L.gguf | Q3_K_L | 2.48 GB | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/GGUF/chandra-ocr-2-MTP.Q3_K_L.gguf) | Lower quality but usable, good for low RAM availability. |
| chandra-ocr-2-MTP.Q3_K_M.gguf | Q3_K_M | 2.32 GB | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/GGUF/chandra-ocr-2-MTP.Q3_K_M.gguf) | Low quality. |
| chandra-ocr-2-MTP.Q4_K_M.gguf | Q4_K_M | 2.78 GB | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/GGUF/chandra-ocr-2-MTP.Q4_K_M.gguf) | Good quality, default size for most use cases, *recommended*. |
| chandra-ocr-2-MTP.Q4_K_S.gguf | Q4_K_S | 2.63 GB | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/GGUF/chandra-ocr-2-MTP.Q4_K_S.gguf) | Slightly lower quality with more space savings, *recommended*. |
| chandra-ocr-2-MTP.Q5_K_M.gguf | Q5_K_M | 3.16 GB | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/GGUF/chandra-ocr-2-MTP.Q5_K_M.gguf) | High quality, *recommended*. |
| chandra-ocr-2-MTP.Q5_K_S.gguf | Q5_K_S | 3.07 GB | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/GGUF/chandra-ocr-2-MTP.Q5_K_S.gguf) | High quality, *recommended*. |
| chandra-ocr-2-MTP.Q6_K.gguf | Q6_K | 3.56 GB | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/GGUF/chandra-ocr-2-MTP.Q6_K.gguf) | Very high quality, near perfect, *recommended*. |
| chandra-ocr-2-MTP.Q8_0.gguf | Q8_0 | 4.61 GB | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/GGUF/chandra-ocr-2-MTP.Q8_0.gguf) | Extremely high quality, generally unneeded but max available quant. |
| chandra-ocr-2-MTP.mmproj-bf16.gguf | mmproj-bf16 | 676 MB | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/GGUF/chandra-ocr-2-MTP.mmproj-bf16.gguf) | Multimodal projection file in BF16 format. Used for vision/OCR capabilities. |
## MTP-Repacked [Transformers, BF16]
| File Name | File Size | File Link | Description |
|-----------|-----------|-----------|-------------|
| chat_template.jinja | 7.62 kB | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/chat_template.jinja) | Jinja template for chat formatting. |
| config.json | 2.88 kB | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/config.json) | Model configuration file. |
| generation_config.json | 116 Bytes | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/generation_config.json) | Generation configuration parameters. |
| model-00001-of-00002.safetensors | 5.07 GB | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/model-00001-of-00002.safetensors) | Model weights shard 1 of 2 (Safetensors format). |
| model-00002-of-00002.safetensors | 4.25 GB | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/model-00002-of-00002.safetensors) | Model weights shard 2 of 2 (Safetensors format). |
| model.safetensors.index.json | 67.3 kB | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/model.safetensors.index.json) | Index file mapping weights to shards. |
| processor_config.json | 1.33 kB | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/processor_config.json) | Processor configuration for multimodal inputs. |
| tokenizer.json | 20 MB | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/tokenizer.json) | Tokenizer vocabulary and merges. |
| tokenizer_config.json | 1.51 kB | [Link](https://huggingface.co/prithivMLmods/chandra-ocr-2-MTP-Repacked/blob/main/tokenizer_config.json) | Tokenizer configuration file. |
## BF16 Test Run
Tested `chandra-ocr-2-MTP.BF16.gguf` (with `chandra-ocr-2-MTP.mmproj-bf16.gguf`) on an NVIDIA RTX PRO 6000 Blackwell Server Edition GPU with `96 GB` of VRAM, using `llama-cli` with full GPU offloading and MTP speculative decoding.
### Performance Metrics
| Metric | Value |
| --- | --- |
| Average Prompt Processing Speed | 2,383.63 tokens/s |
| Average Generation Speed | 196.98 tokens/s |
| Total Wall Time | 25.4 seconds |
| Context Length | 16,384 tokens |
| KV Cache (K) | `q8_0` |
| GPU | NVIDIA RTX PRO 6000 Blackwell Server Edition |
| GPU VRAM Capacity | 96 GB |
| Peak GPU VRAM Usage | 10.66 GiB |
| Peak GPU Utilization | 87% |
| GPU Layers Offloaded | 99 (`-ngl 99`) |
| Random Seed | 42 |
| Speculative Decoding | MTP (`draft_n_max=2`) |
| Test Runs | 3 |
### Test Shots
| Shot | Test |
| --- | --- |
| Shot 1 | Vision OCR — Image 1 |
| Shot 2 | Vision OCR — Image 2 |
| Shot 3 | Vision OCR — Image 3 |
### Run Inference
```bash
./build/bin/llama-cli \
-m /path/to/models/chandra-ocr-2-MTP.BF16.gguf \
--mmproj /path/to/models/chandra-ocr-2-MTP.mmproj-bf16.gguf \
--image /path/to/image.jpeg \
--spec-type draft-mtp \
--spec-draft-n-max 2 \
-ngl 99 \
-c 16384 \
--cache-type-k q8_0 \
--seed 42 \
-n 8192 \
-st \
-p "OCR the image."
```
*Performance results reflect this specific hardware and inference configuration. Actual throughput may vary depending on the prompt, model, software build, and runtime settings.*
## Snapshot(3)




## llama.cpp
LLM inference in C/C++ — https://github.com/ggml-org/llama.cpp
MTP-repackaged and quantized using llama.cpp by — [prithivMLmods](https://huggingface.co/prithivMLmods). |