Instructions to use openbmb/MiniCPM-OCR-1.0-DSpark with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openbmb/MiniCPM-OCR-1.0-DSpark with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="openbmb/MiniCPM-OCR-1.0-DSpark")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("openbmb/MiniCPM-OCR-1.0-DSpark") model = AutoModel.from_pretrained("openbmb/MiniCPM-OCR-1.0-DSpark", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use openbmb/MiniCPM-OCR-1.0-DSpark with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "openbmb/MiniCPM-OCR-1.0-DSpark" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openbmb/MiniCPM-OCR-1.0-DSpark", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/openbmb/MiniCPM-OCR-1.0-DSpark
- SGLang
How to use openbmb/MiniCPM-OCR-1.0-DSpark 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 "openbmb/MiniCPM-OCR-1.0-DSpark" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openbmb/MiniCPM-OCR-1.0-DSpark", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "openbmb/MiniCPM-OCR-1.0-DSpark" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openbmb/MiniCPM-OCR-1.0-DSpark", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use openbmb/MiniCPM-OCR-1.0-DSpark with Docker Model Runner:
docker model run hf.co/openbmb/MiniCPM-OCR-1.0-DSpark
MiniCPM-OCR 1.0 DSpark
This repository hosts the DSpark draft (speculative decoding) head for MiniCPM-OCR 1.0. It is a draft model, not a standalone OCR model β it must be paired with the matching main checkpoint.
DSpark speeds up decoding with a small draft model that proposes tokens the main model then verifies in one pass. With this head, MiniCPM-OCR 1.0 improves end-to-end processing efficiency by 55%; throughput reaches about 1.49Γ PaddleOCR-VL-1.6 and 3.62Γ MinerU2.5 Pro.
Specification
| Property | Value |
|---|---|
| Target model | MiniCPM-OCR 1.0 (1.3B) |
| Draft parameters | 296,837,889 |
| Draft layers | 5 |
| Draft tokens per forward pass | 15 |
| Target hidden-state layers | [3, 7, 11, 15, 19] |
| Checkpoint precision | BF16 |
| Input vocabulary | 248,100 |
| Draft output vocabulary | 114,688 |
The output LM head and the Markov output rows are cropped to 114,688 tokens. The checkpoint keeps
its d2t offset mapping and the full input vocabulary; local-to-target.json holds the
corresponding absolute target token IDs.
Note on
d2t: in this checkpoint the tensor is delta-encoded (target_id - draft_id). It must be converted to absolute IDs (d2t[i] + i) before use β the GGUF build already does this, andlocal-to-target.jsonis the ground truth to verify against.
Usage with vLLM
vllm serve openbmb/MiniCPM-OCR-1.0 \
--served-model-name MiniCPM-OCR \
--trust-remote-code \
--max-model-len 40960 \
--max-num-batched-tokens 40960 \
--max-num-seqs 1 \
--trust-request-mm-kwargs \
--mm-processor-kwargs '{"downsample_mode":"4x","max_slice_nums":9}' \
--speculative-config '{"method":"dspark",
"model":"openbmb/MiniCPM-OCR-1.0-DSpark",
"num_speculative_tokens":15,
"enable_adaptive_verification":false}' \
--default-chat-template-kwargs '{"enable_thinking":false}'
Selection and tuning: DSpark acceleration.
Files
| File | Notes |
|---|---|
model.safetensors |
64 tensors β 5 draft layers, fc projector, lm_head, Markov heads, confidence head, d2t |
config.json |
architectures: ["Qwen3DSparkModel"], dflash_config with target layer ids and Markov rank |
local-to-target.json |
114,688 absolute target token IDs, the reference for d2t |
export-audit.json |
export-time audit: weight/mapping hashes and vocabulary coverage |
Related checkpoints
| Format | Hugging Face | ModelScope |
|---|---|---|
| BF16 (original) | π€ | ModelScope |
| GGUF (llama.cpp) | π€ | ModelScope |
| AWQ W4A16 | π€ | ModelScope |
| GPTQ W4A16 | π€ | ModelScope |
| DSpark draft (BF16) (this repo) | π€ | ModelScope |
| DSpark draft (GGUF) | π€ | ModelScope |
DSpark requires a matching main and draft model from the same release; do not pair this draft with a different main checkpoint.
FAQ
Installation, model downloads, GPU memory, input formats, and unexpected outputs: FAQ.
License
Model weights, code, and documentation are released under the Apache License 2.0.
- Downloads last month
- 888
