A docling OCR plugin for PaddlePaddle PP-OCRv6 (ONNX via RapidOCR)
Project description
docling-pp-ocrv6
A Docling OCR plugin for PaddlePaddle's PP-OCRv6 models. It runs the PP-OCRv6 detection and recognition ONNX checkpoints locally through RapidOCR (onnxruntime), so OCR happens inside the docling worker — no external service required.
GPU acceleration is automatic when the docling accelerator device resolves to
CUDA and onnxruntime-gpu is installed.
Installation
Pick exactly one onnxruntime extra — installing both the CPU and GPU wheels at once is unsupported and prevents the CUDA provider from registering:
pip install "docling-pp-ocrv6[cpu]" # CPU (onnxruntime)
pip install "docling-pp-ocrv6[gpu]" # CUDA (onnxruntime-gpu)
The detection and recognition ONNX models are downloaded from HuggingFace on first use and cached under docling's model cache. To pre-fetch them (e.g. at container build time):
from docling_pp_ocrv6 import PPOCRv6Model
PPOCRv6Model.download_models()
Usage
from docling.document_converter import DocumentConverter, PdfFormatOption
from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import PdfPipelineOptions
from docling_pp_ocrv6 import PPOCRv6Options
pipeline_options = PdfPipelineOptions(do_ocr=True)
pipeline_options.ocr_options = PPOCRv6Options()
converter = DocumentConverter(
format_options={InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)}
)
result = converter.convert("scanned.pdf")
print(result.document.export_to_markdown())
With docling-serve, request the engine by its kind:
{ "options": { "ocr": true, "ocr_engine": "pp-ocrv6" } }
(DOCLING_SERVE_ALLOW_EXTERNAL_PLUGINS=true must be set for the plugin to load.)
Configuration
All options are settable via PPOCRv6Options(...) or environment variables:
| Option | Env var | Default |
|---|---|---|
lang |
PPOCRV6_LANG |
de,en,fr,it,es,nl,pt,... (German-led European set) |
text_score |
PPOCRV6_TEXT_SCORE |
0.5 |
use_det / use_cls / use_rec |
PPOCRV6_USE_DET / _CLS / _REC |
true |
det_repo |
PPOCRV6_DET_REPO |
PaddlePaddle/PP-OCRv6_medium_det_onnx |
rec_repo |
PPOCRV6_REC_REPO |
PaddlePaddle/PP-OCRv6_medium_rec_onnx |
det_model_path / rec_model_path / rec_keys_path / cls_model_path |
PPOCRV6_*_MODEL_PATH / _KEYS_PATH |
auto |
The recognition character dictionary is extracted automatically from the
recognition model's inference.yml. Angle classification uses RapidOCR's
bundled cls model unless cls_model_path is set.
Development
make install # uv sync + pre-commit
make check # ruff lint + format check + ty type check
make test # pytest with coverage
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file docling_pp_ocrv6-0.1.0.tar.gz.
File metadata
- Download URL: docling_pp_ocrv6-0.1.0.tar.gz
- Upload date:
- Size: 158.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08db89bf7376b1c35d4236543f7351700c950e443be4105fea23fc6d8dec6072
|
|
| MD5 |
093d7d4227f21d54597a6549c287206a
|
|
| BLAKE2b-256 |
45c8b79d2ed1d808a8e1ad277787a0360e0d5734a75f5c90f38476c975f9f5b7
|
File details
Details for the file docling_pp_ocrv6-0.1.0-py3-none-any.whl.
File metadata
- Download URL: docling_pp_ocrv6-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d1144642d298f85fcae670167cb943bfe948232b4742f411419ffd7fed9e7db
|
|
| MD5 |
a00b9bbd4f2834a5247cf9487770be06
|
|
| BLAKE2b-256 |
a5c22073c15495ca55c191968a71978da95d69d5574ee09f69e343382e53f303
|