Object Detection
Safetensors
MLX
English
Chinese
mlx-vlm
pp_doclayout_v3
document-layout
reading-order
Instructions to use HashNuke/pp-doclayout-v3-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use HashNuke/pp-doclayout-v3-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download HashNuke/pp-doclayout-v3-mlx --local-dir pp-doclayout-v3-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Upload folder using huggingface_hub
Browse files- README.md +32 -0
- config.json +107 -0
- model.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
- zh
|
| 5 |
+
tags:
|
| 6 |
+
- mlx
|
| 7 |
+
- object-detection
|
| 8 |
+
- document-layout
|
| 9 |
+
library_name: mlx-vlm
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# pp-doclayout-v3-mlx
|
| 13 |
+
|
| 14 |
+
MLX port of [PaddlePaddle/PP-DocLayoutV3_safetensors](https://huggingface.co/PaddlePaddle/PP-DocLayoutV3_safetensors):
|
| 15 |
+
RT-DETR-style document layout detector, 25 classes plus a reading-order
|
| 16 |
+
head (33M params, float32).
|
| 17 |
+
|
| 18 |
+
```python
|
| 19 |
+
from mlx_vlm.utils import load_model
|
| 20 |
+
|
| 21 |
+
model = load_model("HashNuke/pp-doclayout-v3-mlx")
|
| 22 |
+
model.eval()
|
| 23 |
+
print(model.detect("page.png", conf=0.5))
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
Also usable as the layout backend for Falcon-OCR style pipelines, and
|
| 27 |
+
the architecture twin of the 37-class IndicDocLayout fine-tune
|
| 28 |
+
(`HashNuke/indic-ocr-mlx` `weights/layout`).
|
| 29 |
+
|
| 30 |
+
Original weights: Apache-2.0. Port code:
|
| 31 |
+
`mlx_vlm/models/pp_doclayout_v3` in mlx-vlm. Converted with
|
| 32 |
+
`python -m mlx_vlm.models.pp_doclayout_v3.convert --dtype float32`.
|
config.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation_dropout": 0.0,
|
| 3 |
+
"activation_function": "silu",
|
| 4 |
+
"anchor_image_size": null,
|
| 5 |
+
"architectures": [
|
| 6 |
+
"PPDocLayoutV3ForObjectDetection"
|
| 7 |
+
],
|
| 8 |
+
"attention_dropout": 0.0,
|
| 9 |
+
"backbone": null,
|
| 10 |
+
"backbone_config": {
|
| 11 |
+
"model_type": "hgnet_v2",
|
| 12 |
+
"arch": "L",
|
| 13 |
+
"return_idx": [0, 1, 2, 3],
|
| 14 |
+
"freeze_stem_only": true,
|
| 15 |
+
"freeze_at": 0,
|
| 16 |
+
"freeze_norm": true,
|
| 17 |
+
"lr_mult_list": [0, 0.05, 0.05, 0.05, 0.05],
|
| 18 |
+
"out_features": ["stage1", "stage2", "stage3", "stage4"]
|
| 19 |
+
},
|
| 20 |
+
"backbone_kwargs": null,
|
| 21 |
+
"batch_norm_eps": 1e-05,
|
| 22 |
+
"box_noise_scale": 1.0,
|
| 23 |
+
"d_model": 256,
|
| 24 |
+
"decoder_activation_function": "relu",
|
| 25 |
+
"decoder_attention_heads": 8,
|
| 26 |
+
"decoder_ffn_dim": 1024,
|
| 27 |
+
"decoder_in_channels": [
|
| 28 |
+
256,
|
| 29 |
+
256,
|
| 30 |
+
256
|
| 31 |
+
],
|
| 32 |
+
"decoder_layers": 6,
|
| 33 |
+
"decoder_n_points": 4,
|
| 34 |
+
"disable_custom_kernels": true,
|
| 35 |
+
"dropout": 0.0,
|
| 36 |
+
"encode_proj_layers": [
|
| 37 |
+
2
|
| 38 |
+
],
|
| 39 |
+
"encoder_activation_function": "gelu",
|
| 40 |
+
"encoder_attention_heads": 8,
|
| 41 |
+
"encoder_ffn_dim": 1024,
|
| 42 |
+
"encoder_hidden_dim": 256,
|
| 43 |
+
"encoder_in_channels": [
|
| 44 |
+
512,
|
| 45 |
+
1024,
|
| 46 |
+
2048
|
| 47 |
+
],
|
| 48 |
+
"encoder_layers": 1,
|
| 49 |
+
"eos_coefficient": 0.0001,
|
| 50 |
+
"eval_size": null,
|
| 51 |
+
"feature_strides": [
|
| 52 |
+
8,
|
| 53 |
+
16,
|
| 54 |
+
32
|
| 55 |
+
],
|
| 56 |
+
"hidden_expansion": 1.0,
|
| 57 |
+
"id2label": {
|
| 58 |
+
"0": "abstract",
|
| 59 |
+
"1": "algorithm",
|
| 60 |
+
"2": "aside_text",
|
| 61 |
+
"3": "chart",
|
| 62 |
+
"4": "content",
|
| 63 |
+
"5": "formula",
|
| 64 |
+
"6": "doc_title",
|
| 65 |
+
"7": "figure_title",
|
| 66 |
+
"8": "footer",
|
| 67 |
+
"9": "footer",
|
| 68 |
+
"10": "footnote",
|
| 69 |
+
"11": "formula_number",
|
| 70 |
+
"12": "header",
|
| 71 |
+
"13": "header",
|
| 72 |
+
"14": "image",
|
| 73 |
+
"15": "formula",
|
| 74 |
+
"16": "number",
|
| 75 |
+
"17": "paragraph_title",
|
| 76 |
+
"18": "reference",
|
| 77 |
+
"19": "reference_content",
|
| 78 |
+
"20": "seal",
|
| 79 |
+
"21": "table",
|
| 80 |
+
"22": "text",
|
| 81 |
+
"23": "text",
|
| 82 |
+
"24": "vision_footnote"
|
| 83 |
+
},
|
| 84 |
+
"initializer_range": 0.01,
|
| 85 |
+
"is_encoder_decoder": true,
|
| 86 |
+
"label2id": {},
|
| 87 |
+
"label_noise_ratio": 0.5,
|
| 88 |
+
"layer_norm_eps": 1e-05,
|
| 89 |
+
"learn_initial_query": false,
|
| 90 |
+
"matcher_alpha": 0.25,
|
| 91 |
+
"matcher_bbox_cost": 5.0,
|
| 92 |
+
"matcher_class_cost": 2.0,
|
| 93 |
+
"matcher_gamma": 2.0,
|
| 94 |
+
"matcher_giou_cost": 2.0,
|
| 95 |
+
"model_type": "pp_doclayout_v3",
|
| 96 |
+
"normalize_before": false,
|
| 97 |
+
"num_denoising": 100,
|
| 98 |
+
"num_feature_levels": 3,
|
| 99 |
+
"num_queries": 300,
|
| 100 |
+
"positional_encoding_temperature": 10000,
|
| 101 |
+
"torch_dtype": "float32",
|
| 102 |
+
"use_pretrained_backbone": false,
|
| 103 |
+
"use_timm_backbone": false,
|
| 104 |
+
"global_pointer_head_size": 64,
|
| 105 |
+
"mask_feature_channels": [64, 64],
|
| 106 |
+
"x4_feat_dim": 128
|
| 107 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:57d0def397166f9518572b7a01472e2d23c14de0455f1b82fae465a78ca6d9e5
|
| 3 |
+
size 133232741
|