msluszniak commited on
Commit
6ac937a
·
verified ·
1 Parent(s): 7d10dfa

Re-export under the get_model_schema contract; restructure to the MODEL_SPEC layout

Browse files
.gitattributes CHANGED
@@ -36,3 +36,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
36
  PaddleHelpers_coreml.pte filter=lfs diff=lfs merge=lfs -text
37
  PaddleHelpers_vulkan.pte filter=lfs diff=lfs merge=lfs -text
38
  PaddleHelpers_xnnpack.pte filter=lfs diff=lfs merge=lfs -text
 
 
 
 
36
  PaddleHelpers_coreml.pte filter=lfs diff=lfs merge=lfs -text
37
  PaddleHelpers_vulkan.pte filter=lfs diff=lfs merge=lfs -text
38
  PaddleHelpers_xnnpack.pte filter=lfs diff=lfs merge=lfs -text
39
+ coreml/paddle_helpers_coreml_int8.pte filter=lfs diff=lfs merge=lfs -text
40
+ vulkan/paddle_helpers_vulkan_fp16.pte filter=lfs diff=lfs merge=lfs -text
41
+ xnnpack/paddle_helpers_xnnpack_int8.pte filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,6 +1,7 @@
1
  ---
2
  license: apache-2.0
3
  ---
 
4
  # Introduction
5
 
6
  This repository hosts the **PaddleOCR document helper models** — page-orientation
@@ -14,19 +15,32 @@ not an OCR model on their own.
14
  If you'd like to run these models in your own ExecuTorch runtime, refer to the
15
  [official documentation](https://pytorch.org/executorch/stable/index.html) for setup instructions.
16
 
 
 
 
 
 
 
 
17
  ## Methods
18
 
19
  The fused `.pte` exposes **four methods** (the `.pte` is pure tensor→tensor; the client
20
  does normalization, `argmax`/`softmax`, grid-sampling and the decode loop). All methods are
21
- **fixed-shape** — the exact input shapes below are also declared in `config.json`; there are
22
- no shape-discovery companion methods on this model.
 
23
 
24
  | method | source model | input | output | purpose |
25
  |---|---|---|---|---|
26
  | `orientation` | [PP-LCNet doc_ori](https://huggingface.co/PaddlePaddle/PP-LCNet_x1_0_doc_ori_safetensors) | `[1,3,224,224]` | `logits[1,4]` | page rotation **0 / 90 / 180 / 270°** (argmax) |
27
  | `dewarp` | [UVDoc](https://huggingface.co/PaddlePaddle/UVDoc_safetensors) | `[1,3,712,488]` | `grid[1,2,45,31]` | sampling grid → `grid_sample` to unwarp a curved/folded page |
28
- | `table_encode` | [SLANeXt](https://huggingface.co/PaddlePaddle/SLANeXt_wired_safetensors) | `[1,3,488,488]` | `feat[1,256,96]` | encode a cropped table image (run **once**) |
29
- | `table_decode_step` | SLANeXt decoder | `(feat[1,256,96], hidden[1,256], onehot[1,50])` | `(probs[1,50], hidden[1,256])` | one **autoregressive** structure-token step |
 
 
 
 
 
30
 
31
  ## Backends, precision & latency (warm)
32
 
@@ -49,3 +63,6 @@ the compatibility note in the
49
  [ExecuTorch GitHub repository](https://github.com/pytorch/executorch/blob/main/runtime/COMPATIBILITY.md).
50
  If you work with React Native ExecuTorch, the library constants guarantee compatibility with the
51
  runtime used behind the scenes.
 
 
 
 
1
  ---
2
  license: apache-2.0
3
  ---
4
+
5
  # Introduction
6
 
7
  This repository hosts the **PaddleOCR document helper models** — page-orientation
 
15
  If you'd like to run these models in your own ExecuTorch runtime, refer to the
16
  [official documentation](https://pytorch.org/executorch/stable/index.html) for setup instructions.
17
 
18
+ ## Repository layout
19
+
20
+ ```
21
+ <backend>/config.json # per-backend spec
22
+ <backend>/paddle_helpers_<backend>_<precision>.pte
23
+ ```
24
+
25
  ## Methods
26
 
27
  The fused `.pte` exposes **four methods** (the `.pte` is pure tensor→tensor; the client
28
  does normalization, `argmax`/`softmax`, grid-sampling and the decode loop). All methods are
29
+ **fixed-shape** — the exact input shapes below are also declared in `config.json`, and since
30
+ nothing here is dynamic the model carries no `get_model_schema` overrides; a client reads the
31
+ signatures straight from ExecuTorch's `MethodMeta`.
32
 
33
  | method | source model | input | output | purpose |
34
  |---|---|---|---|---|
35
  | `orientation` | [PP-LCNet doc_ori](https://huggingface.co/PaddlePaddle/PP-LCNet_x1_0_doc_ori_safetensors) | `[1,3,224,224]` | `logits[1,4]` | page rotation **0 / 90 / 180 / 270°** (argmax) |
36
  | `dewarp` | [UVDoc](https://huggingface.co/PaddlePaddle/UVDoc_safetensors) | `[1,3,712,488]` | `grid[1,2,45,31]` | sampling grid → `grid_sample` to unwarp a curved/folded page |
37
+ | `table_encode` | [SLANet_plus](https://huggingface.co/PaddlePaddle/SLANet_plus_safetensors) | `[1,3,488,488]` | `feat[1,256,96]` | encode a cropped table image (run **once**) |
38
+ | `table_decode_step` | SLANet_plus decoder | `(feat[1,256,96], hidden[1,256], onehot[1,50])` | `(probs[1,50], hidden[1,256])` | one **autoregressive** structure-token step |
39
+
40
+ The table decode loop is data-dependent, so it stays on the client: run `table_encode` once,
41
+ then call `table_decode_step` per token, feeding the previous step's hidden state back in and
42
+ the chosen token back as a one-hot. The first step takes an **all-zero** one-hot — the exported
43
+ decoder embeds its own start token.
44
 
45
  ## Backends, precision & latency (warm)
46
 
 
63
  [ExecuTorch GitHub repository](https://github.com/pytorch/executorch/blob/main/runtime/COMPATIBILITY.md).
64
  If you work with React Native ExecuTorch, the library constants guarantee compatibility with the
65
  runtime used behind the scenes.
66
+
67
+ These models were exported with ExecuTorch 1.3.1 and **no forward compatibility** is
68
+ guaranteed; older runtimes may not load them.
config.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "modelName": "paddle-helpers"
3
+ }
coreml/config.json ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://huggingface.co/software-mansion/react-native-executorch-spec/resolve/main/config.schema.json",
3
+ "model": "paddle_helpers",
4
+ "family": "paddleocr",
5
+ "capabilities": [
6
+ "classification"
7
+ ],
8
+ "backend": "coreml",
9
+ "license": "apache-2.0",
10
+ "variants": [
11
+ {
12
+ "file": "paddle_helpers_coreml_int8.pte",
13
+ "precision": "int8",
14
+ "quantized": true,
15
+ "default": true,
16
+ "size_bytes": 11939898,
17
+ "methods": {
18
+ "dewarp": {
19
+ "inputs": [
20
+ {
21
+ "shape": [
22
+ 1,
23
+ 3,
24
+ 712,
25
+ 488
26
+ ],
27
+ "dtype": "float32"
28
+ }
29
+ ],
30
+ "outputs": [
31
+ {
32
+ "shape": [
33
+ 1,
34
+ 2,
35
+ 45,
36
+ 31
37
+ ],
38
+ "dtype": "float32"
39
+ }
40
+ ]
41
+ },
42
+ "orientation": {
43
+ "inputs": [
44
+ {
45
+ "shape": [
46
+ 1,
47
+ 3,
48
+ 224,
49
+ 224
50
+ ],
51
+ "dtype": "float32"
52
+ }
53
+ ],
54
+ "outputs": [
55
+ {
56
+ "shape": [
57
+ 1,
58
+ 4
59
+ ],
60
+ "dtype": "float32"
61
+ }
62
+ ]
63
+ },
64
+ "table_decode_step": {
65
+ "inputs": [
66
+ {
67
+ "shape": [
68
+ 1,
69
+ 256,
70
+ 96
71
+ ],
72
+ "dtype": "float32"
73
+ },
74
+ {
75
+ "shape": [
76
+ 1,
77
+ 256
78
+ ],
79
+ "dtype": "float32"
80
+ },
81
+ {
82
+ "shape": [
83
+ 1,
84
+ 50
85
+ ],
86
+ "dtype": "float32"
87
+ }
88
+ ],
89
+ "outputs": [
90
+ {
91
+ "shape": [
92
+ 1,
93
+ 50
94
+ ],
95
+ "dtype": "float32"
96
+ },
97
+ {
98
+ "shape": [
99
+ 1,
100
+ 256
101
+ ],
102
+ "dtype": "float32"
103
+ }
104
+ ]
105
+ },
106
+ "table_encode": {
107
+ "inputs": [
108
+ {
109
+ "shape": [
110
+ 1,
111
+ 3,
112
+ 488,
113
+ 488
114
+ ],
115
+ "dtype": "float32"
116
+ }
117
+ ],
118
+ "outputs": [
119
+ {
120
+ "shape": [
121
+ 1,
122
+ 256,
123
+ 96
124
+ ],
125
+ "dtype": "float32"
126
+ }
127
+ ]
128
+ }
129
+ }
130
+ }
131
+ ]
132
+ }
coreml/paddle_helpers_coreml_int8.pte ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:51148b0b5665d872673ce595fa03f631a508b8012cf341713333dd3682e417eb
3
+ size 11939898
vulkan/config.json ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://huggingface.co/software-mansion/react-native-executorch-spec/resolve/main/config.schema.json",
3
+ "model": "paddle_helpers",
4
+ "family": "paddleocr",
5
+ "capabilities": [
6
+ "classification"
7
+ ],
8
+ "backend": "vulkan",
9
+ "license": "apache-2.0",
10
+ "variants": [
11
+ {
12
+ "file": "paddle_helpers_vulkan_fp16.pte",
13
+ "precision": "fp16",
14
+ "quantized": false,
15
+ "default": true,
16
+ "size_bytes": 23114952,
17
+ "methods": {
18
+ "dewarp": {
19
+ "inputs": [
20
+ {
21
+ "shape": [
22
+ 1,
23
+ 3,
24
+ 712,
25
+ 488
26
+ ],
27
+ "dtype": "float32"
28
+ }
29
+ ],
30
+ "outputs": [
31
+ {
32
+ "shape": [
33
+ 1,
34
+ 2,
35
+ 45,
36
+ 31
37
+ ],
38
+ "dtype": "float32"
39
+ }
40
+ ]
41
+ },
42
+ "orientation": {
43
+ "inputs": [
44
+ {
45
+ "shape": [
46
+ 1,
47
+ 3,
48
+ 224,
49
+ 224
50
+ ],
51
+ "dtype": "float32"
52
+ }
53
+ ],
54
+ "outputs": [
55
+ {
56
+ "shape": [
57
+ 1,
58
+ 4
59
+ ],
60
+ "dtype": "float32"
61
+ }
62
+ ]
63
+ },
64
+ "table_decode_step": {
65
+ "inputs": [
66
+ {
67
+ "shape": [
68
+ 1,
69
+ 256,
70
+ 96
71
+ ],
72
+ "dtype": "float32"
73
+ },
74
+ {
75
+ "shape": [
76
+ 1,
77
+ 256
78
+ ],
79
+ "dtype": "float32"
80
+ },
81
+ {
82
+ "shape": [
83
+ 1,
84
+ 50
85
+ ],
86
+ "dtype": "float32"
87
+ }
88
+ ],
89
+ "outputs": [
90
+ {
91
+ "shape": [
92
+ 1,
93
+ 50
94
+ ],
95
+ "dtype": "float32"
96
+ },
97
+ {
98
+ "shape": [
99
+ 1,
100
+ 256
101
+ ],
102
+ "dtype": "float32"
103
+ }
104
+ ]
105
+ },
106
+ "table_encode": {
107
+ "inputs": [
108
+ {
109
+ "shape": [
110
+ 1,
111
+ 3,
112
+ 488,
113
+ 488
114
+ ],
115
+ "dtype": "float32"
116
+ }
117
+ ],
118
+ "outputs": [
119
+ {
120
+ "shape": [
121
+ 1,
122
+ 256,
123
+ 96
124
+ ],
125
+ "dtype": "float32"
126
+ }
127
+ ]
128
+ }
129
+ }
130
+ }
131
+ ]
132
+ }
vulkan/paddle_helpers_vulkan_fp16.pte ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:47c4d68fa04b34eb39e3be88a3094f402aa81044a6e4e793a7ece9d46f87a911
3
+ size 23114952
xnnpack/config.json ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://huggingface.co/software-mansion/react-native-executorch-spec/resolve/main/config.schema.json",
3
+ "model": "paddle_helpers",
4
+ "family": "paddleocr",
5
+ "capabilities": [
6
+ "classification"
7
+ ],
8
+ "backend": "xnnpack",
9
+ "license": "apache-2.0",
10
+ "variants": [
11
+ {
12
+ "file": "paddle_helpers_xnnpack_int8.pte",
13
+ "precision": "int8",
14
+ "quantized": true,
15
+ "default": true,
16
+ "size_bytes": 27753160,
17
+ "methods": {
18
+ "dewarp": {
19
+ "inputs": [
20
+ {
21
+ "shape": [
22
+ 1,
23
+ 3,
24
+ 712,
25
+ 488
26
+ ],
27
+ "dtype": "float32"
28
+ }
29
+ ],
30
+ "outputs": [
31
+ {
32
+ "shape": [
33
+ 1,
34
+ 2,
35
+ 45,
36
+ 31
37
+ ],
38
+ "dtype": "float32"
39
+ }
40
+ ]
41
+ },
42
+ "orientation": {
43
+ "inputs": [
44
+ {
45
+ "shape": [
46
+ 1,
47
+ 3,
48
+ 224,
49
+ 224
50
+ ],
51
+ "dtype": "float32"
52
+ }
53
+ ],
54
+ "outputs": [
55
+ {
56
+ "shape": [
57
+ 1,
58
+ 4
59
+ ],
60
+ "dtype": "float32"
61
+ }
62
+ ]
63
+ },
64
+ "table_decode_step": {
65
+ "inputs": [
66
+ {
67
+ "shape": [
68
+ 1,
69
+ 256,
70
+ 96
71
+ ],
72
+ "dtype": "float32"
73
+ },
74
+ {
75
+ "shape": [
76
+ 1,
77
+ 256
78
+ ],
79
+ "dtype": "float32"
80
+ },
81
+ {
82
+ "shape": [
83
+ 1,
84
+ 50
85
+ ],
86
+ "dtype": "float32"
87
+ }
88
+ ],
89
+ "outputs": [
90
+ {
91
+ "shape": [
92
+ 1,
93
+ 50
94
+ ],
95
+ "dtype": "float32"
96
+ },
97
+ {
98
+ "shape": [
99
+ 1,
100
+ 256
101
+ ],
102
+ "dtype": "float32"
103
+ }
104
+ ]
105
+ },
106
+ "table_encode": {
107
+ "inputs": [
108
+ {
109
+ "shape": [
110
+ 1,
111
+ 3,
112
+ 488,
113
+ 488
114
+ ],
115
+ "dtype": "float32"
116
+ }
117
+ ],
118
+ "outputs": [
119
+ {
120
+ "shape": [
121
+ 1,
122
+ 256,
123
+ 96
124
+ ],
125
+ "dtype": "float32"
126
+ }
127
+ ]
128
+ }
129
+ }
130
+ }
131
+ ]
132
+ }
xnnpack/paddle_helpers_xnnpack_int8.pte ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6db4ccb6c1fae046309665dbfd323556cf74a960a8baac5ad4bb5538960a0711
3
+ size 27753160