Views
No views yet
docling-project/docling-layout-heron-101, the larger (ResNet-101-vd backbone) variant of the Docling layout model. Apache-2.0, same as upstream.depths=[3, 4, 23, 3]), 300 queries, and 17 layout classes. The smaller ResNet-50 sibling is at mlx-community/docling-layout-heron-mlx-bf16.mlx-vlm.1from pathlib import Path
2from PIL import Image
3from huggingface_hub import snapshot_download
4from transformers import AutoProcessor
5from mlx_vlm.utils import load_model
6from mlx_vlm.models.rt_detr_v2.generate import RTDetrV2Predictor
7import mlx_vlm.models.rt_detr_v2 # registers the processor with AutoProcessor
8
9path = Path(snapshot_download("mlx-community/docling-layout-heron-101-mlx-bf16"))
10model = load_model(path)
11processor = AutoProcessor.from_pretrained(path)
12predictor = RTDetrV2Predictor(model, processor, threshold=0.3)
13
14result = predictor.predict(Image.open("page.png"))
15for name, score, box in zip(result.class_names, result.scores, result.boxes):
16 print(f"{name:20s} {score:.3f} {box.tolist()}")result is a DetectionResult with vectorized fields: boxes (N, 4) xyxy in original-image pixels, scores (N,), labels (N,) integer class ids, and class_names.1python -m mlx_vlm.models.rt_detr_v2.convert \
2 --hf-path docling-project/docling-layout-heron-101 \
3 --output ./docling-layout-heron-101-mlx-bf16 \
4 --dtype bfloat16transformers.RTDetrV2ForObjectDetection on real document inputs: max abs error ~2e-5 on logits, sub-pixel on bboxes.