Instructions to use netprojects/Granite-Docling-v2-2B-MLX-6bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use netprojects/Granite-Docling-v2-2B-MLX-6bit with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("netprojects/Granite-Docling-v2-2B-MLX-6bit") config = load_config("netprojects/Granite-Docling-v2-2B-MLX-6bit") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Granite Docling v2 2B โ MLX 6-bit
NetProjects conversion of IBM Granite Docling v2 2B for Apple Silicon. The model converts page images to DocLang, with text, layout, tables, and formulas. Language weights use uniform 6-bit affine quantization with group size 64 where eligible; the vision path is not quantized. The main safetensors file is 2.35 GB. This package does not include an MTP drafter or custom executable model code.
Run with MLX-VLM
Tested with mlx-vlm==0.8.2, mlx==0.32.5, and docling-core==2.109.0. Set page.png to a local document image. The example uses plain greedy decoding.
from pathlib import Path
from mlx_vlm import generate, load
from mlx_vlm.prompt_utils import apply_chat_template
from docling_core.transforms.deserializer.doclang import DocLangDocDeserializer
model, processor = load("netprojects/Granite-Docling-v2-2B-MLX-6bit", trust_remote_code=False)
prompt = apply_chat_template(processor, model.config, "<doclang>", num_images=1)
result = generate(model, processor, prompt, image=["page.png"],
temperature=0, max_tokens=8192, verbose=False)
Path("page.doclang").write_text(result.text, encoding="utf-8")
if result.generation_tokens >= 8192:
raise RuntimeError("Output reached the token limit; check for truncation.")
print(DocLangDocDeserializer().deserialize_str(result.text).export_to_markdown())
Local validation and limitations
- On 12 financial-table crops, 11 had numeric reference cells. Plain 6-bit recovered 237/240 expected numeric cell values, with exact numeric multiset matches on 9/11 tables, tied with local BF16 and IBM's official 8-bit. The metric counts repeated values but does not check row or column placement. Plain 6-bit emitted 249 numeric values versus 243 for each baseline.
- On separate synthetic fixtures, 6-bit retained both detected table spans, read
112correctly where the tested 4- and 5-bit builds read12, and extracted both formulas. It still interleaved two text columns, as both comparison baselines did. The merged-table output also repeated values under an extraMarketrow. - A separate 6-bit run with the upstream MTP head matched plain greedy output on 13/16 cases. Use plain decoding when reproducibility matters. Check important numbers, reading order, and table structure against the source image.
- For a higher-precision option, see IBM's 8-bit MLX release.
Apache-2.0. Original checkpoint, tokenizer, processor, and template by IBM Granite; MLX conversion and quantization by NetProjects. Source revision: 1a542535d21bf6cc423f9b0fa96e94641b65217a. See LICENSE, NOTICE, and the upstream model card for attribution.
- Downloads last month
- -
6-bit
Model tree for netprojects/Granite-Docling-v2-2B-MLX-6bit
Base model
ibm-granite/granite-4.0-1b-base