Skip to content

Commit c1dcb05

Browse files
adding granite-docling preview
Signed-off-by: Peter Staar <[email protected]>
1 parent b49d1ad commit c1dcb05

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

docling/cli/main.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
GOT2_TRANSFORMERS,
6464
GRANITE_VISION_OLLAMA,
6565
GRANITE_VISION_TRANSFORMERS,
66+
GRANITEDOCLING_MLX,
67+
GRANITEDOCLING_TRANSFORMERS,
6668
SMOLDOCLING_MLX,
6769
SMOLDOCLING_TRANSFORMERS,
6870
SMOLDOCLING_VLLM,
@@ -655,6 +657,18 @@ def convert( # noqa: C901
655657
"To run SmolDocling faster, please install mlx-vlm:\n"
656658
"pip install mlx-vlm"
657659
)
660+
elif vlm_model == VlmModelType.GRANITEDOCLING:
661+
pipeline_options.vlm_options = GRANITEDOCLING_TRANSFORMERS
662+
if sys.platform == "darwin":
663+
try:
664+
import mlx_vlm
665+
666+
pipeline_options.vlm_options = GRANITEDOCLING_MLX
667+
except ImportError:
668+
_log.warning(
669+
"To run SmolDocling faster, please install mlx-vlm:\n"
670+
"pip install mlx-vlm"
671+
)
658672
elif vlm_model == VlmModelType.SMOLDOCLING_VLLM:
659673
pipeline_options.vlm_options = SMOLDOCLING_VLLM
660674

docling/datamodel/vlm_model_specs.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,29 @@
1818
_log = logging.getLogger(__name__)
1919

2020

21+
# Granite-Docling
22+
GRANITEDOCLING_TRANSFORMERS = InlineVlmOptions(
23+
repo_id="ds4sd/granite-docling-258m-2-9-2025-v2",
24+
prompt="Convert this page to docling.",
25+
response_format=ResponseFormat.DOCTAGS,
26+
inference_framework=InferenceFramework.MLX,
27+
supported_devices=[AcceleratorDevice.MPS],
28+
scale=2.0,
29+
temperature=0.0,
30+
stop_strings=["</doctag>", "<end_of_utterance>"],
31+
)
32+
33+
GRANITEDOCLING_MLX = InlineVlmOptions(
34+
repo_id="ds4sd/granite-docling-258m-2-9-2025-v2-mlx-bf16",
35+
prompt="Convert this page to docling.",
36+
response_format=ResponseFormat.DOCTAGS,
37+
inference_framework=InferenceFramework.MLX,
38+
supported_devices=[AcceleratorDevice.MPS],
39+
scale=2.0,
40+
temperature=0.0,
41+
stop_strings=["</doctag>", "<end_of_utterance>"],
42+
)
43+
2144
# SmolDocling
2245
SMOLDOCLING_MLX = InlineVlmOptions(
2346
repo_id="ds4sd/SmolDocling-256M-preview-mlx-bf16",
@@ -272,3 +295,4 @@ class VlmModelType(str, Enum):
272295
GRANITE_VISION_VLLM = "granite_vision_vllm"
273296
GRANITE_VISION_OLLAMA = "granite_vision_ollama"
274297
GOT_OCR_2 = "got_ocr_2"
298+
GRANITEDOCLING = "granite_docling"

0 commit comments

Comments
 (0)