Image-Text-to-Text
MiniCPM-OCR
Safetensors
English
Chinese
minicpm_ocr
ocr
document-parsing
multimodal
vision-language
table-recognition
formula-recognition
conversational
Eval Results
Instructions to use openbmb/MiniCPM-OCR-1.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MiniCPM-OCR
How to use openbmb/MiniCPM-OCR-1.0 with MiniCPM-OCR:
pip install "minicpm-ocr[all]" huggingface_hub # Deploy openbmb/MiniCPM-OCR-1.0 as a recognition service before running the Python example: # https://github.com/OpenBMB/MiniCPM-OCR/blob/main/docs/vllm_deploy_en.md # vLLM: load the model above; use --port 8080, # --served-model-name minicpm-ocr and --max-model-len 40960. # Layout detection uses cuda:0; recognition runs on the deployed service.
from importlib.resources import files from pathlib import Path from minicpmvocr import load_config, pipelined_run from huggingface_hub import snapshot_download layout_model = snapshot_download("PaddlePaddle/PP-DocLayoutV3") cfg = load_config( str(files("minicpmvocr").joinpath("configs/minicpmvocr.yaml")), overrides={ "input": {"file_path": str(Path("demo.png").resolve())}, "engine": { "type": "vllm", "server_url": "http://127.0.0.1:8080", "model_name": "minicpm-ocr", "max_model_len": 40960, }, "layout": {"model_dir": layout_model, "device": "cuda:0"}, # Render PDFs in-process so this example also works without a main guard. "pipeline": {"overlap_layout": True, "render_workers": 1}, }, ) pipelined_run(cfg) - Notebooks
- Google Colab
- Kaggle
Download preprocessor_config.json from openbmb/MiniCPM-OCR-1.0: direct link, hf CLI and curl.
- Browser
- Download file 340 Bytes
-
https://huggingface.co/openbmb/MiniCPM-OCR-1.0/resolve/refs%2Fpr%2F10/preprocessor_config.json
- Command line
-
hf download hf://openbmb/MiniCPM-OCR-1.0@refs/pr/10/preprocessor_config.json
-
curl -L -o preprocessor_config.json https://huggingface.co/openbmb/MiniCPM-OCR-1.0/resolve/refs%2Fpr%2F10/preprocessor_config.json
340 Bytes
| { | |
| "downsample_mode": "4x", | |
| "max_slice_nums": 9, | |
| "patch_size": 14, | |
| "scale_resolution": 448, | |
| "slice_mode": true, | |
| "use_image_id": true, | |
| "image_mean": [ | |
| 0.5, | |
| 0.5, | |
| 0.5 | |
| ], | |
| "image_std": [ | |
| 0.5, | |
| 0.5, | |
| 0.5 | |
| ], | |
| "image_processor_type": "MiniCPMOcrImageProcessor", | |
| "processor_class": "MiniCPMOcrProcessor" | |
| } |