HashNuke commited on
Commit
cbcbaad
·
verified ·
1 Parent(s): 27b0cf9

Add MLX weights and pipeline config

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ weights/ocr/tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,5 +1,56 @@
1
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: other
3
  license_name: indic-open-model-license-1.0
4
  license_link: LICENSE
 
5
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - en
4
+ - as
5
+ - bn
6
+ - hi
7
+ - mr
8
+ - ta
9
+ - te
10
+ tags:
11
+ - mlx
12
+ - ocr
13
+ - document-parsing
14
+ - indic
15
+ library_name: mlx-vlm
16
+ pipeline_tag: image-text-to-text
17
  license: other
18
  license_name: indic-open-model-license-1.0
19
  license_link: LICENSE
20
+ base_model: bodhan-ai/indic-ocr
21
  ---
22
+
23
+ # indic-ocr-mlx
24
+
25
+ MLX port of [bodhan-ai/indic-ocr](https://huggingface.co/bodhan-ai/indic-ocr)
26
+ (multilingual document parsing for English and 22 Indian languages).
27
+ Same two-stage layout as upstream:
28
+
29
+ | Stage | Dir | Model | Format |
30
+ |-------|-----|-------|--------|
31
+ | IndicDocLayout | `weights/layout` | PP-DocLayoutV3/RT-DETR, 37 classes + reading order | float32 |
32
+ | IndicBlockOCR | `weights/ocr` | Qwen3.5-0.8B | bf16, not quantized |
33
+
34
+ ```python
35
+ from mlx_vlm.models.indic_ocr.pipeline import IndicOCRParser
36
+
37
+ with IndicOCRParser.from_pretrained("HashNuke/indic-ocr-mlx") as parser:
38
+ page = parser.parse("page.png")
39
+
40
+ print(page.markdown)
41
+ page.save("page.json")
42
+ ```
43
+
44
+ Stages also load standalone with standard tooling:
45
+
46
+ ```python
47
+ from pathlib import Path
48
+ from mlx_vlm import load
49
+ from mlx_vlm.utils import load_model
50
+
51
+ layout = load_model(Path("HashNuke/indic-ocr-mlx/weights/layout"))
52
+ ocr, processor = load("HashNuke/indic-ocr-mlx/weights/ocr")
53
+ ```
54
+
55
+ Original weights: `bodhan-ai/indic-ocr` (gated, Indic Open Model License
56
+ v1.0). Port code: `mlx_vlm/models/indic_ocr` in mlx-vlm.
config.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "indic_ocr",
3
+ "pipeline": "two-stage",
4
+ "stages": {
5
+ "layout": {
6
+ "name": "IndicDocLayout",
7
+ "config": "weights/layout/config.json",
8
+ "weights": "weights/layout/model.safetensors"
9
+ },
10
+ "ocr": {
11
+ "name": "IndicBlockOCR",
12
+ "config": "weights/ocr/config.json",
13
+ "weights": "weights/ocr/model.safetensors"
14
+ }
15
+ },
16
+ "entrypoint": "mlx_vlm.models.indic_ocr.pipeline.IndicOCRParser.from_pretrained",
17
+ "note": "MLX port of bodhan-ai/indic-ocr. Load a stage directly (weights/layout, weights/ocr) or use IndicOCRParser.from_pretrained(repo) for both."
18
+ }
weights/layout/config.json ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation_dropout": 0.0,
3
+ "activation_function": "silu",
4
+ "anchor_image_size": null,
5
+ "architectures": [
6
+ "PPDocLayoutV3Trainable"
7
+ ],
8
+ "attention_dropout": 0.0,
9
+ "auxiliary_loss": true,
10
+ "backbone": null,
11
+ "backbone_config": {
12
+ "arch": "L",
13
+ "depths": [
14
+ 3,
15
+ 4,
16
+ 6,
17
+ 3
18
+ ],
19
+ "dtype": "float32",
20
+ "embedding_size": 64,
21
+ "freeze_at": 0,
22
+ "freeze_norm": true,
23
+ "freeze_stem_only": true,
24
+ "hidden_act": "relu",
25
+ "hidden_sizes": [
26
+ 256,
27
+ 512,
28
+ 1024,
29
+ 2048
30
+ ],
31
+ "initializer_range": 0.02,
32
+ "lr_mult_list": [
33
+ 0,
34
+ 0.05,
35
+ 0.05,
36
+ 0.05,
37
+ 0.05
38
+ ],
39
+ "model_type": "hgnet_v2",
40
+ "num_channels": 3,
41
+ "out_features": [
42
+ "stage1",
43
+ "stage2",
44
+ "stage3",
45
+ "stage4"
46
+ ],
47
+ "out_indices": [
48
+ 1,
49
+ 2,
50
+ 3,
51
+ 4
52
+ ],
53
+ "return_idx": [
54
+ 0,
55
+ 1,
56
+ 2,
57
+ 3
58
+ ],
59
+ "stage_downsample": [
60
+ false,
61
+ true,
62
+ true,
63
+ true
64
+ ],
65
+ "stage_downsample_strides": [
66
+ 2,
67
+ 2,
68
+ 2,
69
+ 2
70
+ ],
71
+ "stage_in_channels": [
72
+ 48,
73
+ 128,
74
+ 512,
75
+ 1024
76
+ ],
77
+ "stage_kernel_size": [
78
+ 3,
79
+ 3,
80
+ 5,
81
+ 5
82
+ ],
83
+ "stage_light_block": [
84
+ false,
85
+ false,
86
+ true,
87
+ true
88
+ ],
89
+ "stage_mid_channels": [
90
+ 48,
91
+ 96,
92
+ 192,
93
+ 384
94
+ ],
95
+ "stage_names": [
96
+ "stem",
97
+ "stage1",
98
+ "stage2",
99
+ "stage3",
100
+ "stage4"
101
+ ],
102
+ "stage_num_blocks": [
103
+ 1,
104
+ 1,
105
+ 3,
106
+ 1
107
+ ],
108
+ "stage_numb_of_layers": [
109
+ 6,
110
+ 6,
111
+ 6,
112
+ 6
113
+ ],
114
+ "stage_out_channels": [
115
+ 128,
116
+ 512,
117
+ 1024,
118
+ 2048
119
+ ],
120
+ "stem_channels": [
121
+ 3,
122
+ 32,
123
+ 48
124
+ ],
125
+ "stem_strides": [
126
+ 2,
127
+ 1,
128
+ 1,
129
+ 2,
130
+ 1
131
+ ],
132
+ "use_learnable_affine_block": false
133
+ },
134
+ "batch_norm_eps": 1e-05,
135
+ "box_noise_scale": 1.0,
136
+ "d_model": 256,
137
+ "decoder_activation_function": "relu",
138
+ "decoder_attention_heads": 8,
139
+ "decoder_ffn_dim": 1024,
140
+ "decoder_in_channels": [
141
+ 256,
142
+ 256,
143
+ 256
144
+ ],
145
+ "decoder_layers": 6,
146
+ "decoder_n_points": 4,
147
+ "disable_custom_kernels": true,
148
+ "dropout": 0.0,
149
+ "dtype": "float32",
150
+ "encode_proj_layers": [
151
+ 2
152
+ ],
153
+ "encoder_activation_function": "gelu",
154
+ "encoder_attention_heads": 8,
155
+ "encoder_ffn_dim": 1024,
156
+ "encoder_hidden_dim": 256,
157
+ "encoder_in_channels": [
158
+ 512,
159
+ 1024,
160
+ 2048
161
+ ],
162
+ "encoder_layers": 1,
163
+ "eos_coefficient": 0.0001,
164
+ "eval_size": null,
165
+ "feat_strides": [
166
+ 8,
167
+ 16,
168
+ 32
169
+ ],
170
+ "feature_strides": [
171
+ 8,
172
+ 16,
173
+ 32
174
+ ],
175
+ "focal_loss_alpha": 0.25,
176
+ "focal_loss_gamma": 2.0,
177
+ "freeze_backbone_batch_norms": true,
178
+ "global_pointer_head_size": 64,
179
+ "gp_dropout_value": 0.1,
180
+ "hidden_expansion": 1.0,
181
+ "id2label": {
182
+ "0": "Question",
183
+ "1": "Paragraph",
184
+ "2": "Answer",
185
+ "3": "List",
186
+ "4": "Title",
187
+ "5": "Section-title",
188
+ "6": "Equation",
189
+ "7": "Table",
190
+ "8": "Diagram",
191
+ "9": "Image",
192
+ "10": "MCQ",
193
+ "11": "Infobox",
194
+ "12": "Sub-section-title",
195
+ "13": "Expression",
196
+ "14": "Image-caption",
197
+ "15": "Placeholder-text",
198
+ "16": "Chart",
199
+ "17": "Solved-example",
200
+ "18": "Footnote",
201
+ "19": "Table-caption",
202
+ "20": "Sub-sub-section-title",
203
+ "21": "Footer",
204
+ "22": "Header",
205
+ "23": "Code",
206
+ "24": "Page-number",
207
+ "25": "Chapter-title",
208
+ "26": "Chapter-end-section",
209
+ "27": "Folio",
210
+ "28": "Reference",
211
+ "29": "Table-of-contents",
212
+ "30": "Index",
213
+ "31": "Advertisement",
214
+ "32": "Author",
215
+ "33": "Dateline",
216
+ "34": "Contact-info",
217
+ "35": "Website-link",
218
+ "36": "Flag"
219
+ },
220
+ "initializer_bias_prior_prob": null,
221
+ "initializer_range": 0.01,
222
+ "is_encoder_decoder": true,
223
+ "label2id": {
224
+ "Advertisement": 31,
225
+ "Answer": 2,
226
+ "Author": 32,
227
+ "Chapter-end-section": 26,
228
+ "Chapter-title": 25,
229
+ "Chart": 16,
230
+ "Code": 23,
231
+ "Contact-info": 34,
232
+ "Dateline": 33,
233
+ "Diagram": 8,
234
+ "Equation": 6,
235
+ "Expression": 13,
236
+ "Flag": 36,
237
+ "Folio": 27,
238
+ "Footer": 21,
239
+ "Footnote": 18,
240
+ "Header": 22,
241
+ "Image": 9,
242
+ "Image-caption": 14,
243
+ "Index": 30,
244
+ "Infobox": 11,
245
+ "List": 3,
246
+ "MCQ": 10,
247
+ "Page-number": 24,
248
+ "Paragraph": 1,
249
+ "Placeholder-text": 15,
250
+ "Question": 0,
251
+ "Reference": 28,
252
+ "Section-title": 5,
253
+ "Solved-example": 17,
254
+ "Sub-section-title": 12,
255
+ "Sub-sub-section-title": 20,
256
+ "Table": 7,
257
+ "Table-caption": 19,
258
+ "Table-of-contents": 29,
259
+ "Title": 4,
260
+ "Website-link": 35
261
+ },
262
+ "label_noise_ratio": 0.5,
263
+ "lambda_order": 5.0,
264
+ "layer_norm_eps": 1e-05,
265
+ "learn_initial_query": false,
266
+ "loss_type": "RTDetrForObjectDetection",
267
+ "mask_enhanced": true,
268
+ "mask_feature_channels": [
269
+ 64,
270
+ 64
271
+ ],
272
+ "matcher_alpha": 0.25,
273
+ "matcher_bbox_cost": 5.0,
274
+ "matcher_class_cost": 2.0,
275
+ "matcher_gamma": 2.0,
276
+ "matcher_giou_cost": 2.0,
277
+ "model_type": "pp_doclayout_v3",
278
+ "normalize_before": false,
279
+ "num_denoising": 0,
280
+ "num_feature_levels": 3,
281
+ "num_prototypes": 32,
282
+ "num_queries": 300,
283
+ "positional_encoding_temperature": 10000,
284
+ "tie_word_embeddings": true,
285
+ "transformers_version": "5.8.1",
286
+ "use_cache": false,
287
+ "use_focal_loss": true,
288
+ "weight_loss_bbox": 5.0,
289
+ "weight_loss_giou": 2.0,
290
+ "weight_loss_vfl": 1.0,
291
+ "x4_feat_dim": 128
292
+ }
weights/layout/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f2f455135ae031039bb3d913c225d96aa15b3eab27ba6655ce8c7a4ebe56ea9a
3
+ size 133245077
weights/ocr/chat_template.jinja ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set image_count = namespace(value=0) %}
2
+ {%- set video_count = namespace(value=0) %}
3
+ {%- macro render_content(content, do_vision_count, is_system_content=false) %}
4
+ {%- if content is string %}
5
+ {{- content }}
6
+ {%- elif content is iterable and content is not mapping %}
7
+ {%- for item in content %}
8
+ {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
9
+ {%- if is_system_content %}
10
+ {{- raise_exception('System message cannot contain images.') }}
11
+ {%- endif %}
12
+ {%- if do_vision_count %}
13
+ {%- set image_count.value = image_count.value + 1 %}
14
+ {%- endif %}
15
+ {%- if add_vision_id %}
16
+ {{- 'Picture ' ~ image_count.value ~ ': ' }}
17
+ {%- endif %}
18
+ {{- '<|vision_start|><|image_pad|><|vision_end|>' }}
19
+ {%- elif 'video' in item or item.type == 'video' %}
20
+ {%- if is_system_content %}
21
+ {{- raise_exception('System message cannot contain videos.') }}
22
+ {%- endif %}
23
+ {%- if do_vision_count %}
24
+ {%- set video_count.value = video_count.value + 1 %}
25
+ {%- endif %}
26
+ {%- if add_vision_id %}
27
+ {{- 'Video ' ~ video_count.value ~ ': ' }}
28
+ {%- endif %}
29
+ {{- '<|vision_start|><|video_pad|><|vision_end|>' }}
30
+ {%- elif 'text' in item %}
31
+ {{- item.text }}
32
+ {%- else %}
33
+ {{- raise_exception('Unexpected item type in content.') }}
34
+ {%- endif %}
35
+ {%- endfor %}
36
+ {%- elif content is none or content is undefined %}
37
+ {{- '' }}
38
+ {%- else %}
39
+ {{- raise_exception('Unexpected content type.') }}
40
+ {%- endif %}
41
+ {%- endmacro %}
42
+ {%- if not messages %}
43
+ {{- raise_exception('No messages provided.') }}
44
+ {%- endif %}
45
+ {%- if tools and tools is iterable and tools is not mapping %}
46
+ {{- '<|im_start|>system\n' }}
47
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
48
+ {%- for tool in tools %}
49
+ {{- "\n" }}
50
+ {{- tool | tojson }}
51
+ {%- endfor %}
52
+ {{- "\n</tools>" }}
53
+ {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
54
+ {%- if messages[0].role == 'system' %}
55
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
56
+ {%- if content %}
57
+ {{- '\n\n' + content }}
58
+ {%- endif %}
59
+ {%- endif %}
60
+ {{- '<|im_end|>\n' }}
61
+ {%- else %}
62
+ {%- if messages[0].role == 'system' %}
63
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
64
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
65
+ {%- endif %}
66
+ {%- endif %}
67
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
68
+ {%- for message in messages[::-1] %}
69
+ {%- set index = (messages|length - 1) - loop.index0 %}
70
+ {%- if ns.multi_step_tool and message.role == "user" %}
71
+ {%- set content = render_content(message.content, false)|trim %}
72
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
73
+ {%- set ns.multi_step_tool = false %}
74
+ {%- set ns.last_query_index = index %}
75
+ {%- endif %}
76
+ {%- endif %}
77
+ {%- endfor %}
78
+ {%- if ns.multi_step_tool %}
79
+ {{- raise_exception('No user query found in messages.') }}
80
+ {%- endif %}
81
+ {%- for message in messages %}
82
+ {%- set content = render_content(message.content, true)|trim %}
83
+ {%- if message.role == "system" %}
84
+ {%- if not loop.first %}
85
+ {{- raise_exception('System message must be at the beginning.') }}
86
+ {%- endif %}
87
+ {%- elif message.role == "user" %}
88
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
89
+ {%- elif message.role == "assistant" %}
90
+ {%- set reasoning_content = '' %}
91
+ {%- if message.reasoning_content is string %}
92
+ {%- set reasoning_content = message.reasoning_content %}
93
+ {%- else %}
94
+ {%- if '</think>' in content %}
95
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
96
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
97
+ {%- endif %}
98
+ {%- endif %}
99
+ {%- set reasoning_content = reasoning_content|trim %}
100
+ {%- if loop.index0 > ns.last_query_index %}
101
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
102
+ {%- else %}
103
+ {{- '<|im_start|>' + message.role + '\n' + content }}
104
+ {%- endif %}
105
+ {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
106
+ {%- for tool_call in message.tool_calls %}
107
+ {%- if tool_call.function is defined %}
108
+ {%- set tool_call = tool_call.function %}
109
+ {%- endif %}
110
+ {%- if loop.first %}
111
+ {%- if content|trim %}
112
+ {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
113
+ {%- else %}
114
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
115
+ {%- endif %}
116
+ {%- else %}
117
+ {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
118
+ {%- endif %}
119
+ {%- if tool_call.arguments is defined %}
120
+ {%- for args_name, args_value in tool_call.arguments|items %}
121
+ {{- '<parameter=' + args_name + '>\n' }}
122
+ {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
123
+ {{- args_value }}
124
+ {{- '\n</parameter>\n' }}
125
+ {%- endfor %}
126
+ {%- endif %}
127
+ {{- '</function>\n</tool_call>' }}
128
+ {%- endfor %}
129
+ {%- endif %}
130
+ {{- '<|im_end|>\n' }}
131
+ {%- elif message.role == "tool" %}
132
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
133
+ {{- '<|im_start|>user' }}
134
+ {%- endif %}
135
+ {{- '\n<tool_response>\n' }}
136
+ {{- content }}
137
+ {{- '\n</tool_response>' }}
138
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
139
+ {{- '<|im_end|>\n' }}
140
+ {%- elif loop.last %}
141
+ {{- '<|im_end|>\n' }}
142
+ {%- endif %}
143
+ {%- else %}
144
+ {{- raise_exception('Unexpected message role.') }}
145
+ {%- endif %}
146
+ {%- endfor %}
147
+ {%- if add_generation_prompt %}
148
+ {{- '<|im_start|>assistant\n' }}
149
+ {%- if enable_thinking is defined and enable_thinking is true %}
150
+ {{- '<think>\n' }}
151
+ {%- else %}
152
+ {{- '<think>\n\n</think>\n\n' }}
153
+ {%- endif %}
154
+ {%- endif %}
weights/ocr/config.json ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3_5ForConditionalGeneration"
4
+ ],
5
+ "chunk_size_feed_forward": 0,
6
+ "dtype": "bfloat16",
7
+ "eos_token_id": 262146,
8
+ "generation_config": {
9
+ "_from_model_config": true,
10
+ "eos_token_id": 262146,
11
+ "transformers_version": "5.6.2",
12
+ "use_cache": true
13
+ },
14
+ "id2label": {
15
+ "0": "LABEL_0",
16
+ "1": "LABEL_1"
17
+ },
18
+ "image_token_id": 262155,
19
+ "is_encoder_decoder": false,
20
+ "label2id": {
21
+ "LABEL_0": 0,
22
+ "LABEL_1": 1
23
+ },
24
+ "model_type": "indic_ocr",
25
+ "output_attentions": false,
26
+ "output_hidden_states": false,
27
+ "problem_type": null,
28
+ "return_dict": true,
29
+ "text_config": {
30
+ "_name_or_path": "",
31
+ "architectures": null,
32
+ "attention_bias": false,
33
+ "attention_dropout": 0.0,
34
+ "attn_output_gate": true,
35
+ "bos_token_id": null,
36
+ "chunk_size_feed_forward": 0,
37
+ "dtype": "bfloat16",
38
+ "eos_token_id": 262146,
39
+ "full_attention_interval": 4,
40
+ "head_dim": 256,
41
+ "hidden_act": "silu",
42
+ "hidden_size": 1024,
43
+ "id2label": {
44
+ "0": "LABEL_0",
45
+ "1": "LABEL_1"
46
+ },
47
+ "initializer_range": 0.02,
48
+ "intermediate_size": 3584,
49
+ "is_encoder_decoder": false,
50
+ "label2id": {
51
+ "LABEL_0": 0,
52
+ "LABEL_1": 1
53
+ },
54
+ "layer_types": [
55
+ "linear_attention",
56
+ "linear_attention",
57
+ "linear_attention",
58
+ "full_attention",
59
+ "linear_attention",
60
+ "linear_attention",
61
+ "linear_attention",
62
+ "full_attention",
63
+ "linear_attention",
64
+ "linear_attention",
65
+ "linear_attention",
66
+ "full_attention",
67
+ "linear_attention",
68
+ "linear_attention",
69
+ "linear_attention",
70
+ "full_attention",
71
+ "linear_attention",
72
+ "linear_attention",
73
+ "linear_attention",
74
+ "full_attention",
75
+ "linear_attention",
76
+ "linear_attention",
77
+ "linear_attention",
78
+ "full_attention"
79
+ ],
80
+ "linear_conv_kernel_dim": 4,
81
+ "linear_key_head_dim": 128,
82
+ "linear_num_key_heads": 16,
83
+ "linear_num_value_heads": 16,
84
+ "linear_value_head_dim": 128,
85
+ "mamba_ssm_dtype": "float32",
86
+ "max_position_embeddings": 262144,
87
+ "mlp_only_layers": [],
88
+ "model_type": "qwen3_5_text",
89
+ "mtp_num_hidden_layers": 1,
90
+ "mtp_use_dedicated_embeddings": false,
91
+ "num_attention_heads": 8,
92
+ "num_hidden_layers": 24,
93
+ "num_key_value_heads": 2,
94
+ "output_attentions": false,
95
+ "output_hidden_states": false,
96
+ "pad_token_id": 262144,
97
+ "partial_rotary_factor": 0.25,
98
+ "problem_type": null,
99
+ "return_dict": true,
100
+ "rms_norm_eps": 1e-06,
101
+ "rope_parameters": {
102
+ "mrope_interleaved": true,
103
+ "mrope_section": [
104
+ 11,
105
+ 11,
106
+ 10
107
+ ],
108
+ "partial_rotary_factor": 0.25,
109
+ "rope_theta": 10000000,
110
+ "rope_type": "default"
111
+ },
112
+ "tie_word_embeddings": true,
113
+ "use_cache": false,
114
+ "vocab_size": 262157
115
+ },
116
+ "tie_word_embeddings": true,
117
+ "transformers_version": "5.6.2",
118
+ "use_cache": false,
119
+ "video_token_id": 262156,
120
+ "vision_config": {
121
+ "_name_or_path": "",
122
+ "architectures": null,
123
+ "chunk_size_feed_forward": 0,
124
+ "deepstack_visual_indexes": [],
125
+ "depth": 12,
126
+ "dtype": "bfloat16",
127
+ "hidden_act": "gelu_pytorch_tanh",
128
+ "hidden_size": 768,
129
+ "id2label": {
130
+ "0": "LABEL_0",
131
+ "1": "LABEL_1"
132
+ },
133
+ "in_channels": 3,
134
+ "initializer_range": 0.02,
135
+ "intermediate_size": 3072,
136
+ "is_encoder_decoder": false,
137
+ "label2id": {
138
+ "LABEL_0": 0,
139
+ "LABEL_1": 1
140
+ },
141
+ "model_type": "qwen3_5_vision",
142
+ "num_heads": 12,
143
+ "num_position_embeddings": 2304,
144
+ "out_hidden_size": 1024,
145
+ "output_attentions": false,
146
+ "output_hidden_states": false,
147
+ "patch_size": 16,
148
+ "problem_type": null,
149
+ "return_dict": true,
150
+ "spatial_merge_size": 2,
151
+ "temporal_patch_size": 2
152
+ },
153
+ "vision_end_token_id": 262154,
154
+ "vision_start_token_id": 262153
155
+ }
weights/ocr/generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "eos_token_id": 262146,
4
+ "transformers_version": "5.6.2",
5
+ "use_cache": true
6
+ }
weights/ocr/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d4d386fe0653420cdfc1d4c7fbb2ea0fed7134294856e9e06a8baaf967903766
3
+ size 1734368302
weights/ocr/processor_config.json ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "do_convert_rgb": true,
4
+ "do_normalize": true,
5
+ "do_rescale": true,
6
+ "image_mean": [
7
+ 0.5,
8
+ 0.5,
9
+ 0.5
10
+ ],
11
+ "image_processor_type": "Qwen3VLImageProcessor",
12
+ "image_std": [
13
+ 0.5,
14
+ 0.5,
15
+ 0.5
16
+ ],
17
+ "max_pixels": 16777216,
18
+ "merge_size": 2,
19
+ "min_pixels": 65536,
20
+ "patch_size": 16,
21
+ "rescale_factor": 0.00392156862745098,
22
+ "temporal_patch_size": 2
23
+ },
24
+ "processor_class": "Qwen3VLProcessor",
25
+ "video_processor": {
26
+ "do_convert_rgb": true,
27
+ "do_normalize": true,
28
+ "do_rescale": true,
29
+ "fps": 2.0,
30
+ "image_mean": [
31
+ 0.5,
32
+ 0.5,
33
+ 0.5
34
+ ],
35
+ "image_std": [
36
+ 0.5,
37
+ 0.5,
38
+ 0.5
39
+ ],
40
+ "max_frames": 768,
41
+ "max_pixels": 786432,
42
+ "merge_size": 2,
43
+ "min_frames": 4,
44
+ "min_pixels": 131072,
45
+ "patch_size": 16,
46
+ "rescale_factor": 0.00392156862745098,
47
+ "temporal_patch_size": 2,
48
+ "video_processor_type": "Qwen3VLVideoProcessor"
49
+ }
50
+ }
weights/ocr/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aa502d4d33e68344b0702e5dfd90466bc1e152d36ed906bad34c48dfd3e06d41
3
+ size 33629731
weights/ocr/tokenizer_config.json ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "boi_token": "<|start_of_image|>",
4
+ "bos_token": "[@BOS@]",
5
+ "clean_up_tokenization_spaces": false,
6
+ "eoi_token": "<|end_of_image|>",
7
+ "eos_token": "<|im_end|>",
8
+ "extra_special_tokens": [
9
+ "<|endoftext|>",
10
+ "<|im_start|>",
11
+ "<|im_end|>",
12
+ "<|object_ref_start|>",
13
+ "<|object_ref_end|>",
14
+ "<|box_start|>",
15
+ "<|box_end|>",
16
+ "<|quad_start|>",
17
+ "<|quad_end|>",
18
+ "<|vision_start|>",
19
+ "<|vision_end|>",
20
+ "<|image_pad|>",
21
+ "<|video_pad|>"
22
+ ],
23
+ "image_token": "<|image_pad|>",
24
+ "is_local": true,
25
+ "local_files_only": false,
26
+ "model_max_length": 1000000000000000019884624838656,
27
+ "model_specific_special_tokens": {
28
+ "boi_token": "<|start_of_image|>",
29
+ "eoi_token": "<|end_of_image|>",
30
+ "image_token": "<|image_pad|>"
31
+ },
32
+ "pad_token": "<|endoftext|>",
33
+ "padding_side": "right",
34
+ "processor_class": "Qwen3VLProcessor",
35
+ "sp_model_kwargs": null,
36
+ "spaces_between_special_tokens": false,
37
+ "tokenizer_class": "TokenizersBackend",
38
+ "unk_token": "<unk>",
39
+ "use_default_system_prompt": false
40
+ }