Docling Model Management#
Docling's document-conversion pipeline relies on several ML models for PDF processing: layout detection, table structure recognition, OCR, picture classification, code/formula extraction, and optional VLMs. These models come from two sources:
- HuggingFace — layout model, TableFormer, picture classifier, code/formula model, and all VLMs (Granite Vision, GraniteDocling, SmolVLM, SmolDocling, etc.)
- ModelScope — RapidOCR artifacts only (
https://www.modelscope.cn)
By default, models download automatically on first use. For offline or air-gapped environments, use the docling-tools models download CLI to pre-download them, then point the runtime to the local directory via artifacts_path.
The two primary mechanisms are:
docling-tools models download— CLI that pre-fetches a named set of models into a local directoryartifacts_pathonPipelineOptions— tells the runtime where to look for pre-downloaded artifacts instead of fetching from the network
CLI: docling-tools models download#
Defined in docling/cli/models.py, the download subcommand fetches one or more models into a local directory.
Basic usage:
# Download default model set (layout, tableformer, code_formula, picture_classifier, rapidocr)
docling-tools models download -o /path/to/models
# Download all available models
docling-tools models download --all -o /path/to/models
# Download specific models
docling-tools models download granitedocling granite_vision -o /path/to/models
# Force re-download (overwrite existing)
docling-tools models download --force -o /path/to/models
# Quiet mode — prints only the output path (useful for scripting)
docling-tools models download -q -o /path/to/models
Available model names :
| Name | Description |
|---|---|
layout | Layout detection model (default) |
tableformer | TableFormer V1 table structure (default) |
tableformerv2 | TableFormer V2 |
code_formula | Code/formula extraction (default) |
picture_classifier | Picture type classifier (default) |
rapidocr | RapidOCR models for Chinese + English (default) |
granitedocling | IBM Granite-Docling-258M (HuggingFace Transformers) |
granitedocling_mlx | Granite-Docling-258M MLX variant (Apple Silicon) |
smolvlm | SmolVLM picture description |
smoldocling | SmolDocling-256M VLM pipeline |
smoldocling_mlx | SmolDocling MLX variant |
granite_vision | Granite Vision 3.3-2B (picture description) |
granite_chart_extraction | Granite Vision chart extraction V3 |
granite_chart_extraction_v4 | Granite Vision 4.1-4B chart extraction V4 |
easyocr | EasyOCR models |
nemotron_ocr_v2 | NVIDIA NemotronOCR V2 |
Default set (downloaded when no model names are specified) : layout, tableformer, code_formula, picture_classifier, rapidocr.
After download, the CLI prints the path and a reminder of the --artifacts-path flag to use:
Docling can now be configured for running offline using the local artifacts.
Using the CLI: `docling --artifacts-path=/path/to/models FILE`
Secondary subcommand — download-hf-repo: downloads any arbitrary HuggingFace repo by ID, useful for custom or private models :
docling-tools models download-hf-repo my-org/my-custom-model -o /path/to/models
Offline Deployment via artifacts_path#
artifacts_path is a field on the base PipelineOptions class (inherited by PdfPipelineOptions, VlmPipelineOptions, etc.). Setting it tells each model stage to load from that directory instead of downloading from the network.
Python:
from docling.datamodel.pipeline_options import PdfPipelineOptions
from docling.document_converter import DocumentConverter, PdfFormatOption
from docling.datamodel.base_models import InputFormat
pipeline_options = PdfPipelineOptions(artifacts_path="/path/to/models")
converter = DocumentConverter(
format_options={
InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)
}
)
CLI:
docling --artifacts-path=/path/to/models convert document.pdf
docling-serve#
In docling-serve, models are baked into the container image at build time via docling-tools models download , then served via the DOCLING_SERVE_ARTIFACTS_PATH environment variable (default: /opt/app-root/src/.cache/docling/models). For custom deployments, mount a pre-downloaded model directory and set this environment variable to its path.
PipelineOptions hierarchy#
artifacts_path sits at the top-level PipelineOptions and is available across all pipeline types :
PipelineOptions ← artifacts_path lives here
└── ConvertPipelineOptions
└── PaginatedPipelineOptions
├── PdfPipelineOptions
└── VlmPipelineOptions
HuggingFace Models and Environment Variables#
Most Docling models are fetched from HuggingFace Hub using huggingface_hub. The primary HF repository for non-VLM models is ds4sd/docling-models. VLM checkpoints are fetched from their respective ibm-granite/ or docling-project/ org repos.
Relevant environment variables:
| Variable | Effect |
|---|---|
HF_HOME | Override HuggingFace cache root directory |
HF_HUB_DOWNLOAD_TIMEOUT | Timeout for individual file downloads |
HF_HUB_ETAG_TIMEOUT | Timeout for etag/freshness checks |
HF_TOKEN | Auth token for private repos (not yet exposed via Docling CLI — see open feature request) |
DOCLING_CUDA_USE_FLASH_ATTENTION2 | Set to 1 to enable Flash Attention 2 on CUDA |
The internal download utility download_hf_model wraps huggingface_hub.snapshot_download / hf_hub_download and is used for all VLM-family models. Files that already exist on disk are skipped unless --force is passed.
VLM-specific model identifiers#
The key Granite and SmolDocling HuggingFace repo IDs :
| Model | HuggingFace Repo |
|---|---|
| GraniteDocling-258M | ibm-granite/granite-docling-258M |
| GraniteDocling-258M (MLX) | ibm-granite/granite-docling-258M-mlx |
| Granite Vision 3.3-2B | ibm-granite/granite-vision-3.3-2b |
| Granite Vision 4.1-4B | ibm-granite/granite-vision-4.1-4b |
| Granite Vision chart V3 | ibm-granite/granite-vision-3.3-2b-chart2csv-preview |
| SmolVLM | HuggingFaceTB/SmolVLM-256M-Instruct |
| SmolDocling | ds4sd/SmolDocling-256M-Preview |
| CodeFormulaV2 | docling-project/CodeFormulaV2 |
VLM models are not included in the default docling-tools models download set — they must be explicitly named .
SSL and Certificate Issues#
Model downloads can fail with SSL: CERTIFICATE_VERIFY_FAILED when Python's certificate store is outdated. This affects both HuggingFace downloads and RapidOCR downloads from ModelScope.
Solutions in order of preference:
- Upgrade
certifi:pip install --upgrade certifi - Use system certificates:
pip install pip-system-certs - Manually point to the certificate bundle:
CERT_PATH=$(python -m certifi) export SSL_CERT_FILE=${CERT_PATH} export REQUESTS_CA_BUNDLE=${CERT_PATH}
For corporate proxies or custom CA environments (e.g., air-gapped container builds), REQUESTS_CA_BUNDLE must point to the corporate root CA certificate .
Key Files and Entry Points#
| File | Purpose |
|---|---|
docling/cli/models.py | docling-tools models download CLI — model name enum, default set, download and download-hf-repo commands |
docling/utils/model_downloader.py | download_models() — orchestrates downloads for all model types |
docling/models/utils/hf_model_download.py | download_hf_model() — wraps huggingface_hub for VLM checkpoints |
docling/datamodel/pipeline_options.py | PipelineOptions.artifacts_path — the top-level field for offline path override |
docs/faq/index.md | FAQ: offline deployment, required model weights, SSL errors |