DeepSeek-OCR-2 GGUF

GGUF builds of DeepSeek-OCR-2, made by Moonbox for on-device use with llama.cpp (Metal, CUDA, Vulkan, CPU). Every file is at the root of this repository: one model file per precision, plus the mmproj-*.gguf file that holds the model's encoder (audio, vision or codec) when it has one. That file is shared by every precision. Pick a precision by the memory you have.

Files

The last column is the benchmark: the task score of each file on Moonbox's evaluation set for this kind of model (details under How to run), and how often it gives exactly the same output as the BF16 file. The BF16 file holds the original weights unchanged.

Precision File Size sha256 Benchmark
F16 deepseek-ocr-2-F16.gguf 5.88 GB fe365295f67a CER 0.0 % / 0.0 %; same text as BF16 on 6 + 6 of 12 pages; 6.77 s per page (CUDA)
all mmproj-deepseek-ocr-2-F16.gguf 927.9 MB 9083825ad7ce encoder file, used with every precision
BF16 deepseek-ocr-2-BF16.gguf 5.88 GB 2271633c907b CER 0.0 % / 0.0 % (original 0.0 / 0.0); 6.87 s per page (CUDA)
Q8_0 deepseek-ocr-2-Q8_0.gguf 3.13 GB 034e71d2d785 CER 0.0 % / 0.0 %; same text as BF16 on 6 + 6 of 12 pages; 4.93 s per page (CUDA)
Q6_K deepseek-ocr-2-Q6_K.gguf 2.61 GB 9c36c290317c CER 0.0 % / 0.0 %; same text as BF16 on 6 + 6 of 12 pages; 4.54 s per page (CUDA)
Q5_K_M deepseek-ocr-2-Q5_K_M.gguf 2.22 GB 2d521f03b217 CER 0.0 % / 0.0 %; same text as BF16 on 6 + 6 of 12 pages; 4.35 s per page (CUDA)
Q4_K_M deepseek-ocr-2-Q4_K_M.gguf 1.95 GB f0a772354607 CER 0.0 % / 0.0 %; same text as BF16 on 5 + 6 of 12 pages; 4.13 s per page (CUDA)

How to run

The model file holds the 3B mixture-of-experts decoder. mmproj-deepseek-ocr-2-F16.gguf holds the SAM and Qwen2 "flow" vision encoders and the projector (llama.cpp's DeepSeek-OCR-2 support), kept in F16 for every precision. Both files are needed. With llama.cpp b12621 or newer, as llama.cpp's own DeepSeek-OCR-2 test runs it:

llama-mtmd-cli -m deepseek-ocr-2-Q8_0.gguf --mmproj mmproj-deepseek-ocr-2-F16.gguf -ngl 99 \
    --image page.png -p "Free OCR." --chat-template deepseek-ocr --temp 0 --flash-attn off -n 1024 \
    --dry-multiplier 0.8 --dry-base 1.75 --dry-allowed-length 2 --dry-penalty-last-n 64 --dry-sequence-breaker none

The DRY settings are llama.cpp's stand-in for the original's no_repeat_ngram_size. They stop the long repetition loops this model can fall into. Other prompts of the original work the same way, for example <|grounding|>Convert the document to markdown.

All 2,707 tensors of the original checkpoint are byte-identical in the BF16 model file and the mmproj.

Benchmark.

  • Set: 12 synthetic pages: 6 English and 6 Chinese sentences of our own, rendered with Windows fonts, so the ground truth is exact.
  • Task: the prompt Free OCR., run with the command above.
  • Run: one llama-mtmd-cli run per page on CUDA (RTX 3080 Laptop). The seconds per page include loading the model each time.
  • Score: character error rate per language, whitespace ignored. The original (its own infer in bf16, eval mode) read all 12 pages exactly (CER 0.0 % / 0.0 %).
  • Pass mark: at most the original's CER plus 1 point.
  • Same text as BF16: pages where the output is character-for-character the same as the BF16 file's.

How these were made

From DeepSeek-OCR-2 at revision aaa02f3811, with llama.cpp b12621:

  • convert_hf_to_gguf.py wrote the BF16 model file and the mmproj file.
  • llama-quantize made the other precisions from the BF16 file, with its standard mixes.
  • No importance matrix was used.

Before upload, every tensor of the original checkpoint was found with the same values in the BF16 model file and the mmproj file. The sha256 column above is what the files must hash to.

License

apache-2.0. These files are a derivative of the original model and carry its license. The license is copied in this repository, and it governs your use of these files. The original model card follows unchanged.


DeepSeek AI

🌟 Github | 📥 Model Download | 📄 Paper Link | 📄 Arxiv Paper Link |

DeepSeek-OCR 2: Visual Causal Flow

Explore more human-like visual encoding.

Usage

Inference using Huggingface transformers on NVIDIA GPUs. Requirements tested on python 3.12.9 + CUDA11.8:

torch==2.6.0
transformers==4.46.3
tokenizers==0.20.3
einops
addict 
easydict
pip install flash-attn==2.7.3 --no-build-isolation
from transformers import AutoModel, AutoTokenizer
import torch
import os
os.environ["CUDA_VISIBLE_DEVICES"] = '0'
model_name = 'deepseek-ai/DeepSeek-OCR-2'

tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModel.from_pretrained(model_name, _attn_implementation='flash_attention_2', trust_remote_code=True, use_safetensors=True)
model = model.eval().cuda().to(torch.bfloat16)

# prompt = "<image>\nFree OCR. "
prompt = "<image>\n<|grounding|>Convert the document to markdown. "
image_file = 'your_image.jpg'
output_path = 'your/output/dir'


res = model.infer(tokenizer, prompt=prompt, image_file=image_file, output_path = output_path, base_size = 1024, image_size = 768, crop_mode=True, save_results = True)

vLLM

Refer to 🌟GitHub for guidance on model inference acceleration and PDF processing, etc.

Support-Modes

  • Dynamic resolution
    • Default: (0-6)×768×768 + 1×1024×1024 — (0-6)×144 + 256 visual tokens ✅

Main Prompts

# document: <image>\n<|grounding|>Convert the document to markdown.
# without layouts: <image>\nFree OCR.

Acknowledgement

We would like to thank DeepSeek-OCR, Vary, GOT-OCR2.0, MinerU, PaddleOCR for their valuable models and ideas.

We also appreciate the benchmark OmniDocBench.

Citation

@article{wei2025deepseek,
  title={DeepSeek-OCR: Contexts Optical Compression},
  author={Wei, Haoran and Sun, Yaofeng and Li, Yukun},
  journal={arXiv preprint arXiv:2510.18234},
  year={2025}
}
@article{wei2026deepseek,
  title={DeepSeek-OCR 2: Visual Causal Flow},
  author={Wei, Haoran and Sun, Yaofeng and Li, Yukun},
  journal={arXiv preprint arXiv:2601.20552},
  year={2026}
}
Downloads last month
-
GGUF
Model size
3B params
Architecture
deepseek2-ocr
Hardware compatibility
Log In to add your hardware

4-bit

5-bit

6-bit

8-bit

16-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for moonbox-dev/DeepSeek-OCR-2-GGUF

Quantized
(14)
this model

Papers for moonbox-dev/DeepSeek-OCR-2-GGUF