This repository hosts the GGUF build of MiniCPM-OCR 1.0 for llama.cpp. For the original weights, the full model card, and benchmarks, see the base repository.
MiniCPM-OCR 1.0 (1.3B) parses documents into text, tables, formulas, charts, and seals, and supports key information extraction, for Chinese and English documents and PDFs.
MiniCPM-OCR 1.0 parses full documents as a two-stage pipeline orchestrated by the minicpm-ocr SDK. The two stages use separate models, run in separate environments, and may run on different machines:
Stage 1 β Layout detection (SDK environment). The PP-DocLayoutV3 layout model detects document regions β text, tables, formulas, charts, seals β and determines reading order; the SDK crops each region. It runs locally inside the SDK environment and requires PaddlePaddle / PaddleX.
Stage 2 β Region recognition (inference service). The SDK sends each cropped region over HTTP to a MiniCPM-OCR 1.0 inference service β served by vLLM, SGLang, llama.cpp, or Ollama β with a prompt matching the region type, then assembles the recognized content into the final Markdown / JSON in reading order.
Required before using either the CLI or Python API: deploy and start the OCR model service first, and wait until it is ready to accept requests. The SDK examples below are clients of that running service; they do not deploy or start the OCR model service automatically.
Use the official minicpm-ocr SDK to parse local images or PDFs with this GGUF checkpoint. The SDK detects layout with PP-DocLayoutV3, recognises each region, and saves structured JSON and Markdown in reading order.
Before running the SDK, start a llama.cpp recognition service using this repository's MiniCPM-OCR-1_0-Q8_0.gguf and the required mmproj-model-f16-4x.gguf vision projector. Follow the llama.cpp deployment guide. For the SDK examples below, configure the service with --port 8080, --alias minicpm-ocr, --ctx-size 8192, --parallel 1, and --jinja --reasoning off. If you keep the guide's port 18499, change the SDK URL to match. DSpark setup, when used, is covered by the same guide.
The SDK uses the llamacpp backend, an 8192-token context, and one recognition request at a time. Layout detection runs on CPU in these examples; the recognition service can independently use Metal, CUDA, or CPU. If you increase the service context per request slot, update engine.max_model_len accordingly.
The CLI automatically downloads PP-DocLayoutV3 to models/PP-DocLayoutV3_infer/ when needed. The final Markdown is saved to output/demo.md; structured JSON and per-page Markdown are kept in output/<run_tag>/results_json/ and output/<run_tag>/output/.
The model service described above must already be running before you execute this Python example. Set engine.server_url and engine.model_name to match that service.
ensure_layout_model() reuses or downloads the official layout model. Results are written to output/<run_tag>/results_json/ and output/<run_tag>/output/. To parse a PDF, replace demo.png with its local path.
For CUDA layout detection, change --device cpu to --device cuda:0 in the CLI, or set layout.device to cuda:0 in Python, after installing the matching PaddlePaddle runtime. Keep SDK recognition concurrency aligned with the llama.cpp service's request slots.
Run minicpmvocr parse --help for CLI options, or see the SDK API reference for configuration and document-level Markdown export.