Run this model with HF Jobs

Run strangelab/granite-docling-v2-2b-mlx-q5 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/strangelab/granite-docling-v2-2b-mlx-q5. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/strangelab/granite-docling-v2-2b-mlx-q5 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/strangelab/granite-docling-v2-2b-mlx-q5. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Granite Docling V2 2B MLX, 5-bit language weights

Run Granite Docling V2 2B locally on Apple silicon. This package uses 5-bit language weights and 6-bit tied token embeddings. All 463 BF16 vision tensors match IBM's 8-bit MLX release byte for byte. The main weights file is 2.163 GB, 22.2% smaller than IBM's 2.779 GB file and 7.8% smaller than the tested public 6-bit MLX file.

Run a PDF in Docling

Use Python 3.12, Docling 2.156.0 and mlx-vlm 0.8.1. The example uses Docling's 2B preset with this model and runs without the optional MTP drafter.

pip install "docling==2.156.0" "mlx-vlm==0.8.1"
hf download strangelab/granite-docling-v2-2b-mlx-q5 \
  --local-dir artifacts/strangelab--granite-docling-v2-2b-mlx-q5

Download the schedule PDF and save it as schedule.pdf for this example.

from pathlib import Path

from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import VlmConvertOptions, VlmPipelineOptions
from docling.datamodel.vlm_engine_options import MlxVlmEngineOptions, VlmEngineType
from docling.document_converter import DocumentConverter, PdfFormatOption
from docling.pipeline.vlm_pipeline import VlmPipeline

repo = "strangelab/granite-docling-v2-2b-mlx-q5"
options = VlmConvertOptions.from_preset(
    "granite_docling_v2_2b", engine_options=MlxVlmEngineOptions()
)
spec = options.model_spec
overrides = dict(spec.engine_overrides)
mlx = overrides[VlmEngineType.MLX]
overrides[VlmEngineType.MLX] = mlx.model_copy(update={
    "repo_id": repo,
    "revision": None,
    "extra_config": {**mlx.extra_config, "mlx_mtp_drafter": False},
})
options.model_spec = spec.model_copy(update={
    "default_repo_id": repo,
    "revision": None,
    "engine_overrides": overrides,
})
converter = DocumentConverter(format_options={
    InputFormat.PDF: PdfFormatOption(
        pipeline_cls=VlmPipeline,
        pipeline_options=VlmPipelineOptions(artifacts_path=Path("artifacts"), vlm_options=options),
    ),
})
result = converter.convert("schedule.pdf")
print(result.document.export_to_markdown())
print([(table.data.num_rows, table.data.num_cols) for table in result.document.tables])
del converter

For the attached schedule, both IBM MLX and this package returned two 9脳5 tables. Each source table has 10 rows and four columns. Both packages made the same structural error.

Measured accuracy

We required a unique matching row label and the same cell position for each checked value. All arms used Docling 2.156.0 with MTP disabled.

Input IBM MLX 8-bit This package Public MLX 6-bit
Reported survey 113/114 113/114 113/114
15 fresh article tables 568/605 562/605 561/605
Five earlier article tables 224/333 209/333 207/333

The survey's two body tables kept their 39-column width. The public 6-bit build added seven columns to one table. All 15 additional misses on the earlier panel came from one 37-column table. Check cell placement against the source for dense tables where individual values matter. This package trades some fidelity for a smaller download. Survey report 路 Article-table source 路 Schedule report

Insee consumer-price tables

On four 180 DPI raster crops with five to seven columns, this package and IBM MLX each recovered the same 295 of 305 checked numeric values in the correct cell. All 295 also kept their printed decimal punctuation. Both packages returned the same row and column counts on every crop. The positions were checked against the official PDF grid and publisher HTML. Insee monthly tables 路 Insee annual tables

Converted from IBM's original Apache-2.0 checkpoint using MLX-VLM 0.8.1. See the original model card for the architecture and supported use cases.

Downloads last month
38
Safetensors
Model size
2B params
Tensor type
U32
路
BF16
路
MLX
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 馃檵 Ask for provider support

Model tree for strangelab/granite-docling-v2-2b-mlx-q5