zenosai commited on
Commit
0af694f
·
verified ·
1 Parent(s): 9a047b8

Upload folder using huggingface_hub

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
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
added_tokens.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</think>": 151668,
3
+ "</tool_call>": 151658,
4
+ "</tool_response>": 151666,
5
+ "<think>": 151667,
6
+ "<tool_call>": 151657,
7
+ "<tool_response>": 151665,
8
+ "<|box_end|>": 151649,
9
+ "<|box_start|>": 151648,
10
+ "<|endoftext|>": 151643,
11
+ "<|file_sep|>": 151664,
12
+ "<|fim_middle|>": 151660,
13
+ "<|fim_pad|>": 151662,
14
+ "<|fim_prefix|>": 151659,
15
+ "<|fim_suffix|>": 151661,
16
+ "<|im_end|>": 151645,
17
+ "<|im_start|>": 151644,
18
+ "<|image_pad|>": 151655,
19
+ "<|object_ref_end|>": 151647,
20
+ "<|object_ref_start|>": 151646,
21
+ "<|quad_end|>": 151651,
22
+ "<|quad_start|>": 151650,
23
+ "<|repo_name|>": 151663,
24
+ "<|video_pad|>": 151656,
25
+ "<|vision_end|>": 151653,
26
+ "<|vision_pad|>": 151654,
27
+ "<|vision_start|>": 151652
28
+ }
args.json ADDED
@@ -0,0 +1,688 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "output_dir": "/home/kas/kas_checkpoint/zhangziyang/monkeyocrv2/sft_s1_base_v2",
3
+ "overwrite_output_dir": false,
4
+ "do_train": false,
5
+ "do_eval": false,
6
+ "do_predict": false,
7
+ "eval_strategy": "no",
8
+ "prediction_loss_only": false,
9
+ "per_device_train_batch_size": 4,
10
+ "per_device_eval_batch_size": 2,
11
+ "per_gpu_train_batch_size": null,
12
+ "per_gpu_eval_batch_size": null,
13
+ "gradient_accumulation_steps": 1,
14
+ "eval_accumulation_steps": null,
15
+ "eval_delay": 0,
16
+ "torch_empty_cache_steps": null,
17
+ "learning_rate": 2e-05,
18
+ "weight_decay": 0.1,
19
+ "adam_beta1": 0.9,
20
+ "adam_beta2": 0.95,
21
+ "adam_epsilon": 1e-08,
22
+ "max_grad_norm": 1.0,
23
+ "num_train_epochs": 1.0,
24
+ "max_steps": -1,
25
+ "lr_scheduler_type": "cosine",
26
+ "lr_scheduler_kwargs": null,
27
+ "warmup_ratio": 0.05,
28
+ "warmup_steps": 0,
29
+ "log_level": "passive",
30
+ "log_level_replica": "warning",
31
+ "log_on_each_node": true,
32
+ "logging_dir": "/home/kas/kas_checkpoint/zhangziyang/monkeyocrv2/sft_s1_base_v2/runs",
33
+ "logging_strategy": "steps",
34
+ "logging_first_step": true,
35
+ "logging_steps": 5,
36
+ "logging_nan_inf_filter": true,
37
+ "save_strategy": "steps",
38
+ "save_steps": 5000.0,
39
+ "save_total_limit": 20,
40
+ "save_safetensors": true,
41
+ "save_on_each_node": false,
42
+ "save_only_model": false,
43
+ "restore_callback_states_from_checkpoint": false,
44
+ "no_cuda": false,
45
+ "use_cpu": false,
46
+ "use_mps_device": false,
47
+ "seed": 42,
48
+ "data_seed": 42,
49
+ "jit_mode_eval": false,
50
+ "bf16": true,
51
+ "fp16": false,
52
+ "fp16_opt_level": "O1",
53
+ "half_precision_backend": "auto",
54
+ "bf16_full_eval": false,
55
+ "fp16_full_eval": false,
56
+ "tf32": null,
57
+ "local_rank": 0,
58
+ "ddp_backend": null,
59
+ "tpu_num_cores": null,
60
+ "tpu_metrics_debug": false,
61
+ "debug": null,
62
+ "dataloader_drop_last": false,
63
+ "eval_steps": 400000.0,
64
+ "dataloader_num_workers": 16,
65
+ "dataloader_prefetch_factor": null,
66
+ "past_index": -1,
67
+ "run_name": "/home/kas/kas_checkpoint/zhangziyang/monkeyocrv2/sft_s1_base_v2",
68
+ "disable_tqdm": null,
69
+ "remove_unused_columns": true,
70
+ "label_names": null,
71
+ "load_best_model_at_end": false,
72
+ "metric_for_best_model": "loss",
73
+ "greater_is_better": false,
74
+ "ignore_data_skip": false,
75
+ "fsdp": null,
76
+ "fsdp_min_num_params": 0,
77
+ "fsdp_config": null,
78
+ "fsdp_transformer_layer_cls_to_wrap": null,
79
+ "accelerator_config": {
80
+ "dispatch_batches": false
81
+ },
82
+ "parallelism_config": null,
83
+ "deepspeed": {
84
+ "fp16": {
85
+ "enabled": "auto",
86
+ "loss_scale": 0,
87
+ "loss_scale_window": 1000,
88
+ "initial_scale_power": 16,
89
+ "hysteresis": 2,
90
+ "min_loss_scale": 1
91
+ },
92
+ "bf16": {
93
+ "enabled": "auto"
94
+ },
95
+ "zero_optimization": {
96
+ "stage": 1,
97
+ "offload_optimizer": {
98
+ "device": "none",
99
+ "pin_memory": true
100
+ },
101
+ "allgather_partitions": true,
102
+ "allgather_bucket_size": 200000000.0,
103
+ "overlap_comm": false,
104
+ "reduce_scatter": true,
105
+ "reduce_bucket_size": 200000000.0,
106
+ "contiguous_gradients": true
107
+ },
108
+ "gradient_accumulation_steps": "auto",
109
+ "gradient_clipping": "auto",
110
+ "steps_per_print": 2000,
111
+ "train_batch_size": "auto",
112
+ "train_micro_batch_size_per_gpu": "auto",
113
+ "wall_clock_breakdown": false
114
+ },
115
+ "label_smoothing_factor": 0.0,
116
+ "optim": "adamw_torch_fused",
117
+ "optim_args": null,
118
+ "adafactor": false,
119
+ "group_by_length": false,
120
+ "length_column_name": "length",
121
+ "report_to": [
122
+ "tensorboard",
123
+ "swanlab"
124
+ ],
125
+ "project": "huggingface",
126
+ "trackio_space_id": "trackio",
127
+ "ddp_find_unused_parameters": null,
128
+ "ddp_bucket_cap_mb": null,
129
+ "ddp_broadcast_buffers": null,
130
+ "dataloader_pin_memory": true,
131
+ "dataloader_persistent_workers": false,
132
+ "skip_memory_metrics": true,
133
+ "use_legacy_prediction_loop": false,
134
+ "push_to_hub": false,
135
+ "resume_from_checkpoint": "/home/kas/kas_checkpoint/zhangziyang/monkeyocrv2/sft_s1_base_v2/checkpoint-355000",
136
+ "hub_model_id": null,
137
+ "hub_strategy": "every_save",
138
+ "hub_token": null,
139
+ "hub_private_repo": null,
140
+ "hub_always_push": false,
141
+ "hub_revision": null,
142
+ "gradient_checkpointing": true,
143
+ "gradient_checkpointing_kwargs": null,
144
+ "include_inputs_for_metrics": false,
145
+ "include_for_metrics": [],
146
+ "eval_do_concat_batches": true,
147
+ "fp16_backend": "auto",
148
+ "push_to_hub_model_id": null,
149
+ "push_to_hub_organization": null,
150
+ "push_to_hub_token": null,
151
+ "mp_parameters": "",
152
+ "auto_find_batch_size": false,
153
+ "full_determinism": false,
154
+ "torchdynamo": null,
155
+ "ray_scope": "last",
156
+ "ddp_timeout": 18000000,
157
+ "torch_compile": false,
158
+ "torch_compile_backend": null,
159
+ "torch_compile_mode": null,
160
+ "include_tokens_per_second": false,
161
+ "include_num_input_tokens_seen": false,
162
+ "neftune_noise_alpha": null,
163
+ "optim_target_modules": null,
164
+ "batch_eval_metrics": false,
165
+ "eval_on_start": false,
166
+ "use_liger_kernel": false,
167
+ "liger_kernel_config": null,
168
+ "eval_use_gather_object": false,
169
+ "average_tokens_across_devices": true,
170
+ "sortish_sampler": false,
171
+ "predict_with_generate": false,
172
+ "generation_max_length": null,
173
+ "generation_num_beams": null,
174
+ "generation_config": null,
175
+ "tuner_backend": "peft",
176
+ "vit_gradient_checkpointing": null,
177
+ "router_aux_loss_coef": 0.0,
178
+ "enable_dft_loss": false,
179
+ "enable_channel_loss": false,
180
+ "check_model": true,
181
+ "acc_strategy": "token",
182
+ "train_dataloader_shuffle": true,
183
+ "max_epochs": null,
184
+ "aligner_lr": null,
185
+ "vit_lr": null,
186
+ "use_logits_to_keep": null,
187
+ "ds3_gather_for_generation": true,
188
+ "resume_only_model": false,
189
+ "optimizer": null,
190
+ "loss_type": null,
191
+ "metric": null,
192
+ "eval_use_evalscope": false,
193
+ "eval_dataset": [],
194
+ "eval_dataset_args": null,
195
+ "eval_limit": null,
196
+ "eval_generation_config": null,
197
+ "extra_eval_args": null,
198
+ "use_flash_ckpt": false,
199
+ "use_ray": false,
200
+ "ray_exp_name": null,
201
+ "device_groups": null,
202
+ "model": "/home/kas/kas_checkpoint/zhangziyang/monkeyocrv2/sft_s0_base_v2_12m/checkpoint-46641",
203
+ "model_type": "monkeyocrv2",
204
+ "model_revision": null,
205
+ "task_type": "causal_lm",
206
+ "torch_dtype": "bfloat16",
207
+ "attn_impl": "flash_attention_2",
208
+ "new_special_tokens": [],
209
+ "num_labels": null,
210
+ "problem_type": null,
211
+ "rope_scaling": null,
212
+ "device_map": null,
213
+ "max_memory": {},
214
+ "max_model_len": null,
215
+ "local_repo_path": null,
216
+ "init_strategy": null,
217
+ "template": "monkeyocrv2",
218
+ "system": null,
219
+ "max_length": 16384,
220
+ "truncation_strategy": "right",
221
+ "max_pixels": 1003520,
222
+ "agent_template": null,
223
+ "norm_bbox": null,
224
+ "use_chat_template": true,
225
+ "padding_free": true,
226
+ "padding_side": "right",
227
+ "loss_scale": "default",
228
+ "sequence_parallel_size": 1,
229
+ "response_prefix": null,
230
+ "template_backend": "swift",
231
+ "dataset": [
232
+ "/home/kas/kas_outside/zhangziyang/swift/data/cont_1771k_0701.json",
233
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/text/master_labels_s10m_splits/1.json",
234
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/text/master_labels_s10m_splits/10.json",
235
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/text/master_labels_s10m_splits/2.json",
236
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/text/master_labels_s10m_splits/3.json",
237
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/text/master_labels_s10m_splits/4.json",
238
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/text/master_labels_s10m_splits/5.json",
239
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/text/master_labels_s10m_splits/6.json",
240
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/text/master_labels_s10m_splits/7.json",
241
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/text/master_labels_s10m_splits/8.json",
242
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/text/master_labels_s10m_splits/9.json",
243
+ "/home/kas/kas_outside/songjiajun/tool/get_final_json_rec/final_json/merged_rec_use_2_s1m.json",
244
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/aug_s6m_splits/1.json",
245
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/aug_s6m_splits/2.json",
246
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/aug_s6m_splits/3.json",
247
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/aug_s6m_splits/4.json",
248
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/aug_s6m_splits/5.json",
249
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/aug_s6m_splits/6.json",
250
+ "/home/kas/kas_outside/zhangziyang/swift/data/for_311k_0701.json",
251
+ "/home/kas/kas_outside/zhangziyang/swift/data/unimer_0616.json",
252
+ "/home/kas/kas_outside/zhangziyang/latextract/images/latextract.json",
253
+ "/home/kas/kas_outside/zhangziyang/latextract/images/latextract_aug.json",
254
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/table/master_html_labels_s7m_splits/1.json",
255
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/table/master_html_labels_s7m_splits/2.json",
256
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/table/master_html_labels_s7m_splits/3.json",
257
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/table/master_html_labels_s7m_splits/4.json",
258
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/table/master_html_labels_s7m_splits/5.json",
259
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/table/master_html_labels_s7m_splits/6.json",
260
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/table/master_html_labels_s7m_splits/7.json",
261
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/20260111_1203/pubtabnet_train_filter.json",
262
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/20260111_1203/html_tab_621k_0701.json",
263
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/html/aug.json",
264
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/html/ordinary.json",
265
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/table/master_otsl_labels_cleaned_s7m_splits/1.json",
266
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/table/master_otsl_labels_cleaned_s7m_splits/2.json",
267
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/table/master_otsl_labels_cleaned_s7m_splits/3.json",
268
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/table/master_otsl_labels_cleaned_s7m_splits/4.json",
269
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/table/master_otsl_labels_cleaned_s7m_splits/5.json",
270
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/table/master_otsl_labels_cleaned_s7m_splits/6.json",
271
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/table/master_otsl_labels_cleaned_s7m_splits/7.json",
272
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/20260111_1203/pubtabnet_train_filter_otsl.json",
273
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/20260111_1203/html_tab_621k_0701_otsl.json",
274
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/formula/aug.json",
275
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/formula/ordinary.json",
276
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/20260111_1203/aug_otsl.json",
277
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/20260111_1203/ordinary_otsl.json",
278
+ "/home/kas/kas_outside/zhiyinma/html_render/output/inner_table_all_s0d5.json",
279
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/inner_img_table/master_html_inner_img_labels_cleaned_s0d5.json",
280
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/liushui_table/master_html_labels.json",
281
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/liushui_table/master_otsl_labels.json",
282
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/liushui_table/master_html_labels_original.json",
283
+ "/home/kas/kas_outside/zdguo/text_table_data_v2.1/liushui_table/master_otsl_labels_original.json",
284
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout/aug__splits/1.json",
285
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout/aug__splits/2.json",
286
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout/aug__splits/3.json",
287
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout/aug__splits/4.json",
288
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout/ordinary__splits/1.json",
289
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout/ordinary__splits/2.json",
290
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout/ordinary__splits/3.json",
291
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout/ordinary__splits/4.json",
292
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout_rec/aug__s0d5_splits/1.json",
293
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout_rec/aug__s0d5_splits/2.json",
294
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout_rec/aug__s0d5_splits/3.json",
295
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout_rec/aug__s0d5_splits/4.json",
296
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout_rec/ordinary__s0d5_splits/1.json",
297
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout_rec/ordinary__s0d5_splits/2.json",
298
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout_rec/ordinary__s0d5_splits/3.json",
299
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout_rec/ordinary__s0d5_splits/4.json",
300
+ "/home/kas/kas_outside/zdguo/20260211_rotate_data_fast/table/master_html_labels_splits/1.json",
301
+ "/home/kas/kas_outside/zdguo/20260211_rotate_data_fast/table/master_html_labels_splits/2.json",
302
+ "/home/kas/kas_outside/zdguo/20260211_rotate_data_fast/table/master_otsl_labels_splits/1.json",
303
+ "/home/kas/kas_outside/zdguo/20260211_rotate_data_fast/table/master_otsl_labels_splits/2.json",
304
+ "/home/kas/kas_outside/zdguo/20260211_rotate_data_fast/text/text_rotated_labels_splits/1.json",
305
+ "/home/kas/kas_outside/zdguo/20260211_rotate_data_fast/text/text_rotated_labels_splits/2.json",
306
+ "/home/kas/kas_outside/zdguo/20260211_rotate_data_fast/liushui_table/master_html_labels.json",
307
+ "/home/kas/kas_outside/zdguo/20260211_rotate_data_fast/liushui_table/master_otsl_labels.json",
308
+ "/home/kas/mzy/xhs/dots.ocr-master/data/vertical/layout_0212.json",
309
+ "/home/kas/mzy/xhs/dots.ocr-master/data/M5HisDoc/layout_0212.json",
310
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout/rot_ori.json",
311
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout_rec/rot_ori.json",
312
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/CDLA/format_0305/block/html_rot_filter_reward_ori.json",
313
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/CDLA/format_0305/block/html_filter_reward_ori.json",
314
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/CDLA/format_0305/block/otsl_rot_filter_reward_ori.json",
315
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/CDLA/format_0305/block/otsl_filter_reward_ori.json",
316
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/CDLA/format_0305/block/text_rot_ori.json",
317
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/CDLA/format_0305/block/text_ori.json",
318
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/CDLA/format_0305/page/layout_rot_ori.json",
319
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/CDLA/format_0305/page/layout_ori.json",
320
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/D4LA/format_0305/block/html_rot_filter_reward_ori.json",
321
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/D4LA/format_0305/block/html_filter_reward_ori.json",
322
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/D4LA/format_0305/block/otsl_rot_filter_reward_ori.json",
323
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/D4LA/format_0305/block/otsl_filter_reward_ori.json",
324
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/D4LA/format_0305/block/text_rot_ori.json",
325
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/D4LA/format_0305/block/text_ori.json",
326
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/D4LA/format_0305/page/layout_rot_ori.json",
327
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/D4LA/format_0305/page/layout_ori.json",
328
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocGenome/format_0305/block/html_rot_filter_reward_ori.json",
329
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocGenome/format_0305/block/html_filter_reward_ori.json",
330
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocGenome/format_0305/block/otsl_rot_filter_reward_ori.json",
331
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocGenome/format_0305/block/otsl_filter_reward_ori.json",
332
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocGenome/format_0305/block/text_rot_ori.json",
333
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocGenome/format_0305/block/text_ori.json",
334
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocGenome/format_0305/page/layout_rot_ori.json",
335
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocGenome/format_0305/page/layout_ori.json",
336
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocLayNet/format_0305/block/html_rot_filter_reward_ori.json",
337
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocLayNet/format_0305/block/html_filter_reward_ori.json",
338
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocLayNet/format_0305/block/otsl_rot_filter_reward_ori.json",
339
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocLayNet/format_0305/block/otsl_filter_reward_ori.json",
340
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocLayNet/format_0305/block/text_rot_ori.json",
341
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocLayNet/format_0305/block/text_ori.json",
342
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocLayNet/format_0305/page/layout_rot_ori.json",
343
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocLayNet/format_0305/page/layout_ori.json",
344
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/k2k3k4/format_0305/block/html_rot_filter_reward_ori.json",
345
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/k2k3k4/format_0305/block/html_filter_reward_ori.json",
346
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/k2k3k4/format_0305/block/otsl_rot_filter_reward_ori.json",
347
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/k2k3k4/format_0305/block/otsl_filter_reward_ori.json",
348
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/k2k3k4/format_0305/block/text_rot_ori.json",
349
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/k2k3k4/format_0305/block/text_ori.json",
350
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/k2k3k4/format_0305/page/layout_rot_ori.json",
351
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/k2k3k4/format_0305/page/layout_ori.json",
352
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/LangSample/format_0305/page/layout_rot_ori.json",
353
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/LangSample/format_0305/page/layout_ori.json",
354
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/M6Doc/format_0305/block/html_rot_filter_reward_ori.json",
355
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/M6Doc/format_0305/block/html_filter_reward_ori.json",
356
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/M6Doc/format_0305/block/otsl_rot_filter_reward_ori.json",
357
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/M6Doc/format_0305/block/otsl_filter_reward_ori.json",
358
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/M6Doc/format_0305/block/text_rot_ori.json",
359
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/M6Doc/format_0305/block/text_ori.json",
360
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/M6Doc/format_0305/page/layout_rot_ori.json",
361
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/M6Doc/format_0305/page/layout_ori.json",
362
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/SVRD/format_0305/block/html_rot_filter_reward_ori.json",
363
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/SVRD/format_0305/block/html_filter_reward_ori.json",
364
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/SVRD/format_0305/block/otsl_rot_filter_reward_ori.json",
365
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/SVRD/format_0305/block/otsl_filter_reward_ori.json",
366
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/SVRD/format_0305/block/text_rot_ori.json",
367
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/SVRD/format_0305/block/text_ori.json",
368
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/SVRD/format_0305/page/layout_rot_ori.json",
369
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/SVRD/format_0305/page/layout_ori.json",
370
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/TabRecSet/format_0305/block/html_rot_filter_reward_ori.json",
371
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/TabRecSet/format_0305/block/html_filter_reward_ori.json",
372
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/TabRecSet/format_0305/block/otsl_rot_filter_reward_ori.json",
373
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/TabRecSet/format_0305/block/otsl_filter_reward_ori.json",
374
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/TabRecSet/format_0305/block/text_rot_ori.json",
375
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/TabRecSet/format_0305/block/text_ori.json",
376
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/TabRecSet/format_0305/page/layout_rot_ori.json",
377
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/TabRecSet/format_0305/page/layout_ori.json",
378
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/kingsoft/layout_0303_ori.json",
379
+ "/home/kas/mzy/layout/ominidoc_order/datas_infer_table_html-0309_filter_reward.json",
380
+ "/home/kas/mzy/layout/ominidoc_order/datas_infer_table_otsl_filter_reward.json",
381
+ "/home/kas/mzy/layout/ominidoc_order/datas_infer_text.json",
382
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout/ordinary__resize.json",
383
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout/rot_ori_resize.json",
384
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/page/layout_rec/rot_ori_resize.json",
385
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/CDLA/format_0305/block/html_rot_filter_reward_ori_resize.json",
386
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/CDLA/format_0305/block/html_filter_reward_ori_resize.json",
387
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/CDLA/format_0305/block/otsl_rot_filter_reward_ori_resize.json",
388
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/CDLA/format_0305/block/otsl_filter_reward_ori_resize.json",
389
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/CDLA/format_0305/block/text_rot_ori_resize.json",
390
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/CDLA/format_0305/block/text_ori_resize.json",
391
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/CDLA/format_0305/page/layout_rot_ori_resize.json",
392
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/CDLA/format_0305/page/layout_ori_resize.json",
393
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/D4LA/format_0305/block/html_rot_filter_reward_ori_resize.json",
394
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/D4LA/format_0305/block/html_filter_reward_ori_resize.json",
395
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/D4LA/format_0305/block/otsl_rot_filter_reward_ori_resize.json",
396
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/D4LA/format_0305/block/otsl_filter_reward_ori_resize.json",
397
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/D4LA/format_0305/block/text_rot_ori_resize.json",
398
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/D4LA/format_0305/block/text_ori_resize.json",
399
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/D4LA/format_0305/page/layout_rot_ori_resize.json",
400
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/D4LA/format_0305/page/layout_ori_resize.json",
401
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocGenome/format_0305/block/html_rot_filter_reward_ori_resize.json",
402
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocGenome/format_0305/block/html_filter_reward_ori_resize.json",
403
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocGenome/format_0305/block/otsl_rot_filter_reward_ori_resize.json",
404
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocGenome/format_0305/block/otsl_filter_reward_ori_resize.json",
405
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocGenome/format_0305/block/text_rot_ori_resize.json",
406
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocGenome/format_0305/block/text_ori_resize.json",
407
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocGenome/format_0305/page/layout_rot_ori_resize.json",
408
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocGenome/format_0305/page/layout_ori_resize.json",
409
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocLayNet/format_0305/block/html_rot_filter_reward_ori_resize.json",
410
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocLayNet/format_0305/block/html_filter_reward_ori_resize.json",
411
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocLayNet/format_0305/block/otsl_rot_filter_reward_ori_resize.json",
412
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocLayNet/format_0305/block/otsl_filter_reward_ori_resize.json",
413
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocLayNet/format_0305/block/text_rot_ori_resize.json",
414
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocLayNet/format_0305/block/text_ori_resize.json",
415
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocLayNet/format_0305/page/layout_rot_ori_resize.json",
416
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/DocLayNet/format_0305/page/layout_ori_resize.json",
417
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/k2k3k4/format_0305/block/html_rot_filter_reward_ori_resize.json",
418
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/k2k3k4/format_0305/block/html_filter_reward_ori_resize.json",
419
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/k2k3k4/format_0305/block/otsl_rot_filter_reward_ori_resize.json",
420
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/k2k3k4/format_0305/block/otsl_filter_reward_ori_resize.json",
421
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/k2k3k4/format_0305/block/text_rot_ori_resize.json",
422
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/k2k3k4/format_0305/block/text_ori_resize.json",
423
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/k2k3k4/format_0305/page/layout_rot_ori_resize.json",
424
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/k2k3k4/format_0305/page/layout_ori_resize.json",
425
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/LangSample/format_0305/page/layout_rot_ori_resize.json",
426
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/LangSample/format_0305/page/layout_ori_resize.json",
427
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/M6Doc/format_0305/block/html_rot_filter_reward_ori_resize.json",
428
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/M6Doc/format_0305/block/html_filter_reward_ori_resize.json",
429
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/M6Doc/format_0305/block/otsl_rot_filter_reward_ori_resize.json",
430
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/M6Doc/format_0305/block/otsl_filter_reward_ori_resize.json",
431
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/M6Doc/format_0305/block/text_rot_ori_resize.json",
432
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/M6Doc/format_0305/block/text_ori_resize.json",
433
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/M6Doc/format_0305/page/layout_rot_ori_resize.json",
434
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/M6Doc/format_0305/page/layout_ori_resize.json",
435
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/SVRD/format_0305/block/html_rot_filter_reward_ori_resize.json",
436
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/SVRD/format_0305/block/html_filter_reward_ori_resize.json",
437
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/SVRD/format_0305/block/otsl_rot_filter_reward_ori_resize.json",
438
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/SVRD/format_0305/block/otsl_filter_reward_ori_resize.json",
439
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/SVRD/format_0305/block/text_rot_ori_resize.json",
440
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/SVRD/format_0305/block/text_ori_resize.json",
441
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/SVRD/format_0305/page/layout_rot_ori_resize.json",
442
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/SVRD/format_0305/page/layout_ori_resize.json",
443
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/TabRecSet/format_0305/block/html_rot_filter_reward_ori_resize.json",
444
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/TabRecSet/format_0305/block/html_filter_reward_ori_resize.json",
445
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/TabRecSet/format_0305/block/otsl_rot_filter_reward_ori_resize.json",
446
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/TabRecSet/format_0305/block/otsl_filter_reward_ori_resize.json",
447
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/TabRecSet/format_0305/block/text_rot_ori_resize.json",
448
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/TabRecSet/format_0305/block/text_ori_resize.json",
449
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/TabRecSet/format_0305/page/layout_rot_ori_resize.json",
450
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/TabRecSet/format_0305/page/layout_ori_resize.json",
451
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/kingsoft/layout_0303_ori_resize.json",
452
+ "/home/kas/mzy/layout/ominidoc_order/datas_infer_table_html-0309_filter_reward_resize.json",
453
+ "/home/kas/mzy/layout/ominidoc_order/datas_infer_table_otsl_filter_reward_resize.json",
454
+ "/home/kas/mzy/layout/ominidoc_order/datas_infer_text_resize.json",
455
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/complex_table/format/block/html_filter_reward.json",
456
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/complex_table/format/block/otsl_filter_reward.json",
457
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/complex_table/format/block/text.json",
458
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/complex_table/format/page/layout.json",
459
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/handwritten/format/block/html_filter_reward.json",
460
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/handwritten/format/block/otsl_filter_reward.json",
461
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/handwritten/format/block/text.json",
462
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/handwritten/format/page/layout.json",
463
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/photo_table/format/block/html_filter_reward.json",
464
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/photo_table/format/block/otsl_filter_reward.json",
465
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/photo_table/format/block/text.json",
466
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/photo_table/format/page/layout.json",
467
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/ppt/format/block/html_filter_reward.json",
468
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/ppt/format/block/otsl_filter_reward.json",
469
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/ppt/format/block/text.json",
470
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/ppt/format/page/layout.json",
471
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/youdao/format/block/html_filter_reward.json",
472
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/youdao/format/block/otsl_filter_reward.json",
473
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/youdao/format/block/text.json",
474
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/youdao/format/page/layout.json",
475
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/c2/format/block/html_filter_reward.json",
476
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/c2/format/block/otsl_filter_reward.json",
477
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/c2/format/block/text_500k.json",
478
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/c2/format/page/layout.json",
479
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/jiaocai/format/block/html_filter_reward.json",
480
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/jiaocai/format/block/otsl_filter_reward.json",
481
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/jiaocai/format/block/text_500k.json",
482
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/jiaocai/format/page/layout.json",
483
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/note/format/block/html_filter_reward.json",
484
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/note/format/block/otsl_filter_reward.json",
485
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/note/format/block/text.json",
486
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/note/format/page/layout.json",
487
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/newspaper/english/all_format/block/html_filter_reward.json",
488
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/newspaper/english/all_format/block/otsl_filter_reward.json",
489
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/newspaper/english/all_format/block/text_500k.json",
490
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/newspaper/english/all_format/page/layout.json",
491
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/newspaper/chinese/all_format/block/html_filter_reward.json",
492
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/newspaper/chinese/all_format/block/otsl_filter_reward.json",
493
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/newspaper/chinese/all_format/block/text_500k.json",
494
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/newspaper/chinese/all_format/page/layout.json",
495
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/all_format/page/layout_rot.json",
496
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/all_format/block/html_rot_filter_reward.json",
497
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/all_format/block/otsl_rot_filter_reward.json",
498
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/all_format/block/text_rot.json",
499
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_rot/10_rot.json",
500
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_rot/13_rot.json",
501
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_rot/16_rot.json",
502
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_rot/19_rot.json",
503
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_rot/1_rot.json",
504
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_rot/22_rot.json",
505
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_rot/25_rot.json",
506
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_rot/28_rot.json",
507
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_rot/31_rot.json",
508
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_rot/34_rot.json",
509
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_rot/4_rot.json",
510
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_rot/7_rot.json",
511
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/all_format/block/html_resize_filter_reward.json",
512
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/all_format/block/otsl_resize_filter_reward.json",
513
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/all_format/block/html_rot_resize_filter_reward.json",
514
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/all_format/block/otsl_rot_resize_filter_reward.json",
515
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/all_format/block/text_resize.json",
516
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/all_format/block/text_rot_resize.json",
517
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/all_format/page/layout_resize.json",
518
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/all_format/page/layout_rot_resize.json",
519
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_resize/12_resize.json",
520
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_resize/15_resize.json",
521
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_resize/18_resize.json",
522
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_resize/21_resize.json",
523
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_resize/24_resize.json",
524
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_resize/27_resize.json",
525
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_resize/30_resize.json",
526
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_resize/33_resize.json",
527
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_resize/36_resize.json",
528
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_resize/3_resize.json",
529
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_resize/6_resize.json",
530
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_resize/9_resize.json",
531
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_rot_resize/10_rot_resize.json",
532
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_rot_resize/1_rot_resize.json",
533
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_rot_resize/4_rot_resize.json",
534
+ "/home/kas/kas_outside/zhangshuo/data/FinePDF/filter/0111/block/text/ordinary_splits_rot_resize/7_rot_resize.json",
535
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/ppt/format/page/layout1.json",
536
+ "/home/kas/kas_outside/zhangshuo/PaddleOCR-VL-1.5/data/0304/ppt/format/block/text1.json"
537
+ ],
538
+ "val_dataset": [],
539
+ "cached_dataset": [],
540
+ "split_dataset_ratio": 0.0,
541
+ "dataset_num_proc": 32,
542
+ "load_from_cache_file": true,
543
+ "dataset_shuffle": true,
544
+ "val_dataset_shuffle": false,
545
+ "streaming": false,
546
+ "interleave_prob": null,
547
+ "stopping_strategy": "first_exhausted",
548
+ "shuffle_buffer_size": 1000,
549
+ "download_mode": "reuse_dataset_if_exists",
550
+ "columns": {},
551
+ "strict": false,
552
+ "model_name": null,
553
+ "model_author": null,
554
+ "custom_dataset_info": [],
555
+ "quant_method": null,
556
+ "quant_bits": null,
557
+ "hqq_axis": null,
558
+ "bnb_4bit_compute_dtype": "bfloat16",
559
+ "bnb_4bit_quant_type": "nf4",
560
+ "bnb_4bit_use_double_quant": true,
561
+ "bnb_4bit_quant_storage": null,
562
+ "max_new_tokens": 64,
563
+ "temperature": 0.0,
564
+ "top_k": null,
565
+ "top_p": null,
566
+ "repetition_penalty": null,
567
+ "num_beams": 1,
568
+ "stream": false,
569
+ "stop_words": [],
570
+ "logprobs": false,
571
+ "top_logprobs": null,
572
+ "ckpt_dir": "/home/kas/kas_checkpoint/zhangziyang/monkeyocrv2/sft_s0_base_v2_12m/checkpoint-46641",
573
+ "lora_modules": [],
574
+ "train_type": "full",
575
+ "adapters": [],
576
+ "external_plugins": [],
577
+ "model_kwargs": {},
578
+ "load_args": false,
579
+ "load_data_args": false,
580
+ "packing": false,
581
+ "packing_length": null,
582
+ "packing_num_proc": 1,
583
+ "lazy_tokenize": true,
584
+ "custom_register_path": [],
585
+ "use_hf": false,
586
+ "ignore_args_error": false,
587
+ "use_swift_lora": false,
588
+ "freeze_parameters": [
589
+ "vision_tower"
590
+ ],
591
+ "freeze_parameters_regex": null,
592
+ "freeze_parameters_ratio": 0.0,
593
+ "trainable_parameters": [
594
+ "vision_tower.merger"
595
+ ],
596
+ "trainable_parameters_regex": null,
597
+ "freeze_llm": false,
598
+ "freeze_vit": true,
599
+ "freeze_aligner": false,
600
+ "target_modules": [
601
+ "all-linear"
602
+ ],
603
+ "target_regex": null,
604
+ "target_parameters": null,
605
+ "modules_to_save": [],
606
+ "lora_rank": 8,
607
+ "lora_alpha": 32,
608
+ "lora_dropout": 0.05,
609
+ "lora_bias": "none",
610
+ "lora_dtype": null,
611
+ "lorap_lr_ratio": null,
612
+ "use_rslora": false,
613
+ "use_dora": false,
614
+ "lora_ga_batch_size": 2,
615
+ "lora_ga_iters": 2,
616
+ "lora_ga_max_length": 1024,
617
+ "lora_ga_direction": "ArB2r",
618
+ "lora_ga_scale": "stable",
619
+ "lora_ga_stable_gamma": 16,
620
+ "init_weights": true,
621
+ "fourier_n_frequency": 2000,
622
+ "fourier_scaling": 300.0,
623
+ "boft_block_size": 4,
624
+ "boft_block_num": 0,
625
+ "boft_n_butterfly_factor": 1,
626
+ "boft_dropout": 0.0,
627
+ "vera_rank": 256,
628
+ "vera_projection_prng_key": 0,
629
+ "vera_dropout": 0.0,
630
+ "vera_d_initial": 0.1,
631
+ "adapter_act": "gelu",
632
+ "adapter_length": 128,
633
+ "use_galore": false,
634
+ "galore_target_modules": null,
635
+ "galore_rank": 128,
636
+ "galore_update_proj_gap": 50,
637
+ "galore_scale": 1.0,
638
+ "galore_proj_type": "std",
639
+ "galore_optim_per_parameter": false,
640
+ "galore_with_embedding": false,
641
+ "galore_quantization": false,
642
+ "galore_proj_quant": false,
643
+ "galore_proj_bits": 4,
644
+ "galore_proj_group_size": 256,
645
+ "galore_cos_threshold": 0.4,
646
+ "galore_gamma_proj": 2,
647
+ "galore_queue_size": 5,
648
+ "adalora_target_r": 8,
649
+ "adalora_init_r": 12,
650
+ "adalora_tinit": 0,
651
+ "adalora_tfinal": 0,
652
+ "adalora_deltaT": 1,
653
+ "adalora_beta1": 0.85,
654
+ "adalora_beta2": 0.85,
655
+ "adalora_orth_reg_weight": 0.5,
656
+ "llamapro_num_new_blocks": 4,
657
+ "llamapro_num_groups": null,
658
+ "lisa_activated_layers": 0,
659
+ "lisa_step_interval": 20,
660
+ "reft_layer_key": null,
661
+ "reft_layers": null,
662
+ "reft_rank": 4,
663
+ "reft_intervention_type": "LoreftIntervention",
664
+ "reft_args": null,
665
+ "swanlab_token": null,
666
+ "swanlab_project": "MonkeyOCR2sft",
667
+ "swanlab_workspace": null,
668
+ "swanlab_exp_name": "sft_s1_base_v2",
669
+ "swanlab_lark_webhook_url": null,
670
+ "swanlab_lark_secret": null,
671
+ "swanlab_mode": "cloud",
672
+ "add_version": false,
673
+ "create_checkpoint_symlink": false,
674
+ "zero_hpz_partition_size": null,
675
+ "deepspeed_autotp_size": null,
676
+ "early_stop_interval": null,
677
+ "rank": 0,
678
+ "global_world_size": 64,
679
+ "local_world_size": 8,
680
+ "model_suffix": "checkpoint-46641",
681
+ "model_info": "ModelInfo(model_type='monkeyocrv2', model_dir='/home/kas/kas_checkpoint/zhangziyang/monkeyocrv2/sft_s0_base_v2_12m/checkpoint-46641', torch_dtype=torch.bfloat16, max_model_len=40960, quant_method=None, quant_bits=None, rope_scaling=None, is_moe_model=False, config=None, task_type='causal_lm', num_labels=None)",
682
+ "model_meta": "ModelMeta(model_type='monkeyocrv2', model_groups=[ModelGroup(models=[Model(ms_model_id='/home/kas/kas_outside/models/monkeyocrv2_pretrain', hf_model_id='/home/kas/kas_outside/models/monkeyocrv2_pretrain', model_path=None, ms_revision=None, hf_revision=None)], ignore_patterns=None, requires=None, tags=[])], template='monkeyocrv2', get_function=<function get_model_tokenizer_monkeyocrv2 at 0x7f24869feef0>, model_arch=MultiModelKeys(arch_name='monkeyocrv2', embedding=None, module_list=None, lm_head=None, q_proj=None, k_proj=None, v_proj=None, o_proj=None, attention=None, mlp=None, down_proj=None, qkv_proj=None, qk_proj=None, qa_proj=None, qb_proj=None, kv_proj=None, kva_proj=None, kvb_proj=None, language_model=['model', 'lm_head'], aligner=['vision_tower.merger'], vision_tower=['vision_tower'], generator=[]), architectures=['MonkeyOCRv2ForCausalLM'], additional_saved_files=[], torch_dtype=None, is_multimodal=True, is_reward=False, is_reranker=False, task_type=None, ignore_patterns=None, requires=['transformers>=4.57.1'], tags=[])",
683
+ "model_dir": "/home/kas/kas_checkpoint/zhangziyang/monkeyocrv2/sft_s0_base_v2_12m/checkpoint-46641",
684
+ "_val_dataset_exists": [],
685
+ "hub": "<class 'swift.hub.hub.MSHub'>",
686
+ "evaluation_strategy": "steps",
687
+ "training_args": "Seq2SeqTrainingArguments(output_dir='/home/kas/kas_checkpoint/zhangziyang/monkeyocrv2/sft_s1_base_v2', overwrite_output_dir=False, do_train=False, do_eval=False, do_predict=False, eval_strategy=<IntervalStrategy.NO: 'no'>, prediction_loss_only=False, per_device_train_batch_size=4, per_device_eval_batch_size=2, per_gpu_train_batch_size=None, per_gpu_eval_batch_size=None, gradient_accumulation_steps=1, eval_accumulation_steps=None, eval_delay=0, torch_empty_cache_steps=None, learning_rate=2e-05, weight_decay=0.1, adam_beta1=0.9, adam_beta2=0.95, adam_epsilon=1e-08, max_grad_norm=1.0, num_train_epochs=1.0, max_steps=-1, lr_scheduler_type=<SchedulerType.COSINE: 'cosine'>, lr_scheduler_kwargs=None, warmup_ratio=0.05, warmup_steps=0, log_level='passive', log_level_replica='warning', log_on_each_node=True, logging_dir='/home/kas/kas_checkpoint/zhangziyang/monkeyocrv2/sft_s1_base_v2/runs', logging_strategy=<IntervalStrategy.STEPS: 'steps'>, logging_first_step=True, logging_steps=5, logging_nan_inf_filter=True, save_strategy=<SaveStrategy.STEPS: 'steps'>, save_steps=5000, save_total_limit=20, save_safetensors=True, save_on_each_node=False, save_only_model=False, restore_callback_states_from_checkpoint=False, no_cuda=False, use_cpu=False, use_mps_device=False, seed=42, data_seed=42, jit_mode_eval=False, bf16=True, fp16=False, fp16_opt_level='O1', half_precision_backend='auto', bf16_full_eval=False, fp16_full_eval=False, tf32=None, local_rank=0, ddp_backend=None, tpu_num_cores=None, tpu_metrics_debug=False, debug=[], dataloader_drop_last=False, eval_steps=400000.0, dataloader_num_workers=16, dataloader_prefetch_factor=10, past_index=-1, run_name='/home/kas/kas_checkpoint/zhangziyang/monkeyocrv2/sft_s1_base_v2', disable_tqdm=False, remove_unused_columns=False, label_names=None, load_best_model_at_end=False, metric_for_best_model='loss', greater_is_better=False, ignore_data_skip=False, fsdp=[], fsdp_min_num_params=0, fsdp_config={'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}, fsdp_transformer_layer_cls_to_wrap=None, accelerator_config=AcceleratorConfig(split_batches=False, dispatch_batches=False, even_batches=True, use_seedable_sampler=True, non_blocking=False, gradient_accumulation_kwargs=None, use_configured_state=False), parallelism_config=None, deepspeed={'fp16': {'enabled': 'auto', 'loss_scale': 0, 'loss_scale_window': 1000, 'initial_scale_power': 16, 'hysteresis': 2, 'min_loss_scale': 1}, 'bf16': {'enabled': 'auto'}, 'zero_optimization': {'stage': 1, 'offload_optimizer': {'device': 'none', 'pin_memory': True}, 'allgather_partitions': True, 'allgather_bucket_size': 200000000.0, 'overlap_comm': False, 'reduce_scatter': True, 'reduce_bucket_size': 200000000.0, 'contiguous_gradients': True}, 'gradient_accumulation_steps': 'auto', 'gradient_clipping': 'auto', 'steps_per_print': 2000, 'train_batch_size': 'auto', 'train_micro_batch_size_per_gpu': 'auto', 'wall_clock_breakdown': False}, label_smoothing_factor=0.0, optim=<OptimizerNames.ADAMW_TORCH_FUSED: 'adamw_torch_fused'>, optim_args=None, adafactor=False, group_by_length=False, length_column_name='length', report_to=['tensorboard', 'swanlab'], project='huggingface', trackio_space_id='trackio', ddp_find_unused_parameters=None, ddp_bucket_cap_mb=None, ddp_broadcast_buffers=None, dataloader_pin_memory=True, dataloader_persistent_workers=False, skip_memory_metrics=True, use_legacy_prediction_loop=False, push_to_hub=False, resume_from_checkpoint='/home/kas/kas_checkpoint/zhangziyang/monkeyocrv2/sft_s1_base_v2/checkpoint-355000', hub_model_id=None, hub_strategy=<HubStrategy.EVERY_SAVE: 'every_save'>, hub_token=None, hub_private_repo=None, hub_always_push=False, hub_revision=None, gradient_checkpointing=True, gradient_checkpointing_kwargs=None, include_inputs_for_metrics=False, include_for_metrics=[], eval_do_concat_batches=True, fp16_backend='auto', push_to_hub_model_id=None, push_to_hub_organization=None, push_to_hub_token=None, mp_parameters='', auto_find_batch_size=False, full_determinism=False, torchdynamo=None, ray_scope='last', ddp_timeout=18000000, torch_compile=False, torch_compile_backend=None, torch_compile_mode=None, include_tokens_per_second=None, include_num_input_tokens_seen=None, neftune_noise_alpha=None, optim_target_modules=None, batch_eval_metrics=False, eval_on_start=False, use_liger_kernel=False, liger_kernel_config=None, eval_use_gather_object=False, average_tokens_across_devices=None, sortish_sampler=False, predict_with_generate=False, generation_max_length=None, generation_num_beams=None, generation_config=None, tuner_backend='peft', vit_gradient_checkpointing=True, router_aux_loss_coef=0.0, enable_dft_loss=False, enable_channel_loss=False, check_model=True, acc_strategy='token', train_dataloader_shuffle=True, max_epochs=None, aligner_lr=None, vit_lr=None, use_logits_to_keep=None, ds3_gather_for_generation=True, resume_only_model=False, optimizer=None, loss_type=None, metric=None, eval_use_evalscope=False, eval_dataset=[], eval_dataset_args=None, eval_limit=None, eval_generation_config=None, extra_eval_args=None, use_flash_ckpt=False, sft_alpha=0, chord_sft_dataset=[], chord_sft_per_device_train_batch_size=None, chord_enable_phi_function=False, chord_mu_warmup_steps=None, chord_mu_decay_steps=None, chord_mu_peak=None, chord_mu_valley=None, train_type='full', local_repo_path=None, galore_config=None, padding_side='right', padding_free=True, task_type='causal_lm', problem_type=None)"
688
+ }
chat_template.jinja ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {%- if messages[0].content is string %}
5
+ {{- messages[0].content }}
6
+ {%- else %}
7
+ {%- for content in messages[0].content %}
8
+ {%- if 'text' in content %}
9
+ {{- content.text }}
10
+ {%- endif %}
11
+ {%- endfor %}
12
+ {%- endif %}
13
+ {{- '\n\n' }}
14
+ {%- endif %}
15
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
16
+ {%- for tool in tools %}
17
+ {{- "\n" }}
18
+ {{- tool | tojson }}
19
+ {%- endfor %}
20
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
21
+ {%- else %}
22
+ {%- if messages[0].role == 'system' %}
23
+ {{- '<|im_start|>system\n' }}
24
+ {%- if messages[0].content is string %}
25
+ {{- messages[0].content }}
26
+ {%- else %}
27
+ {%- for content in messages[0].content %}
28
+ {%- if 'text' in content %}
29
+ {{- content.text }}
30
+ {%- endif %}
31
+ {%- endfor %}
32
+ {%- endif %}
33
+ {{- '<|im_end|>\n' }}
34
+ {%- endif %}
35
+ {%- endif %}
36
+ {%- set image_count = namespace(value=0) %}
37
+ {%- set video_count = namespace(value=0) %}
38
+ {%- for message in messages %}
39
+ {%- if message.role == "user" %}
40
+ {{- '<|im_start|>' + message.role + '\n' }}
41
+ {%- if message.content is string %}
42
+ {{- message.content }}
43
+ {%- else %}
44
+ {%- for content in message.content %}
45
+ {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}
46
+ {%- set image_count.value = image_count.value + 1 %}
47
+ {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}
48
+ <|vision_start|><|image_pad|><|vision_end|>
49
+ {%- elif content.type == 'video' or 'video' in content %}
50
+ {%- set video_count.value = video_count.value + 1 %}
51
+ {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}
52
+ <|vision_start|><|video_pad|><|vision_end|>
53
+ {%- elif 'text' in content %}
54
+ {{- content.text }}
55
+ {%- endif %}
56
+ {%- endfor %}
57
+ {%- endif %}
58
+ {{- '<|im_end|>\n' }}
59
+ {%- elif message.role == "assistant" %}
60
+ {{- '<|im_start|>' + message.role + '\n' }}
61
+ {%- if message.content is string %}
62
+ {{- message.content }}
63
+ {%- else %}
64
+ {%- for content_item in message.content %}
65
+ {%- if 'text' in content_item %}
66
+ {{- content_item.text }}
67
+ {%- endif %}
68
+ {%- endfor %}
69
+ {%- endif %}
70
+ {%- if message.tool_calls %}
71
+ {%- for tool_call in message.tool_calls %}
72
+ {%- if (loop.first and message.content) or (not loop.first) %}
73
+ {{- '\n' }}
74
+ {%- endif %}
75
+ {%- if tool_call.function %}
76
+ {%- set tool_call = tool_call.function %}
77
+ {%- endif %}
78
+ {{- '<tool_call>\n{"name": "' }}
79
+ {{- tool_call.name }}
80
+ {{- '", "arguments": ' }}
81
+ {%- if tool_call.arguments is string %}
82
+ {{- tool_call.arguments }}
83
+ {%- else %}
84
+ {{- tool_call.arguments | tojson }}
85
+ {%- endif %}
86
+ {{- '}\n</tool_call>' }}
87
+ {%- endfor %}
88
+ {%- endif %}
89
+ {{- '<|im_end|>\n' }}
90
+ {%- elif message.role == "tool" %}
91
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
92
+ {{- '<|im_start|>user' }}
93
+ {%- endif %}
94
+ {{- '\n<tool_response>\n' }}
95
+ {%- if message.content is string %}
96
+ {{- message.content }}
97
+ {%- else %}
98
+ {%- for content in message.content %}
99
+ {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}
100
+ {%- set image_count.value = image_count.value + 1 %}
101
+ {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}
102
+ <|vision_start|><|image_pad|><|vision_end|>
103
+ {%- elif content.type == 'video' or 'video' in content %}
104
+ {%- set video_count.value = video_count.value + 1 %}
105
+ {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}
106
+ <|vision_start|><|video_pad|><|vision_end|>
107
+ {%- elif 'text' in content %}
108
+ {{- content.text }}
109
+ {%- endif %}
110
+ {%- endfor %}
111
+ {%- endif %}
112
+ {{- '\n</tool_response>' }}
113
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
114
+ {{- '<|im_end|>\n' }}
115
+ {%- endif %}
116
+ {%- endif %}
117
+ {%- endfor %}
118
+ {%- if add_generation_prompt %}
119
+ {{- '<|im_start|>assistant\n' }}
120
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MonkeyOCRv2ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "auto_map": {
8
+ "AutoConfig": "configuration_monkeyocrv2.MonkeyOCRv2Config",
9
+ "AutoModelForCausalLM": "modeling_monkeyocrv2.MonkeyOCRv2ForCausalLM"
10
+ },
11
+ "dtype": "bfloat16",
12
+ "eos_token_id": 151645,
13
+ "head_dim": 128,
14
+ "hidden_act": "silu",
15
+ "hidden_size": 1024,
16
+ "image_token_id": 151655,
17
+ "initializer_range": 0.02,
18
+ "intermediate_size": 3072,
19
+ "layer_types": [
20
+ "full_attention",
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention",
44
+ "full_attention",
45
+ "full_attention",
46
+ "full_attention",
47
+ "full_attention"
48
+ ],
49
+ "max_position_embeddings": 40960,
50
+ "max_window_layers": 28,
51
+ "model_type": "monkeyocrv2",
52
+ "num_attention_heads": 16,
53
+ "num_hidden_layers": 28,
54
+ "num_key_value_heads": 8,
55
+ "pad_token_id": 151643,
56
+ "rms_norm_eps": 1e-06,
57
+ "rope_scaling": null,
58
+ "rope_theta": 1000000,
59
+ "sliding_window": null,
60
+ "tie_word_embeddings": true,
61
+ "transformers_version": "4.57.1",
62
+ "use_cache": false,
63
+ "use_sliding_window": false,
64
+ "video_token_id": 151656,
65
+ "vision_config": {
66
+ "attn_implementation": "flash_attention_2",
67
+ "dtype": "bfloat16",
68
+ "embed_dim": 768,
69
+ "gradient_checkpointing": false,
70
+ "hidden_size": 1024,
71
+ "init_merger_std": 0.02,
72
+ "initializer_range": 0.02,
73
+ "intermediate_size": 3072,
74
+ "is_causal": false,
75
+ "model_type": "monkeyocr_vit",
76
+ "num_attention_heads": 12,
77
+ "num_channels": 3,
78
+ "num_hidden_layers": 12,
79
+ "pad_token_id": 151643,
80
+ "patch_size": 14,
81
+ "post_norm": true,
82
+ "rms_norm_eps": 1e-05,
83
+ "spatial_merge_size": 2,
84
+ "temporal_patch_size": 1,
85
+ "use_bias": false
86
+ },
87
+ "vocab_size": 151936
88
+ }
configuration_monkeyocrv2.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, Optional
2
+ from transformers.configuration_utils import PretrainedConfig
3
+ from transformers.models.qwen3 import Qwen3Config
4
+ from transformers import Qwen2_5_VLProcessor, AutoProcessor, AutoConfig
5
+
6
+
7
+ class MonkeyOCRv2VisionConfig(PretrainedConfig):
8
+ model_type: str = "monkeyocr_vit"
9
+
10
+ def __init__(
11
+ self,
12
+ embed_dim: int = 1536, # vision encoder embed size
13
+ hidden_size: int = 1536, # after merger hidden size
14
+ intermediate_size: int = 4224,
15
+ num_hidden_layers: int = 42,
16
+ num_attention_heads: int = 12,
17
+ num_channels: int = 3,
18
+ patch_size: int = 14,
19
+ spatial_merge_size: int = 2,
20
+ temporal_patch_size: int = 1,
21
+ rms_norm_eps: float = 1e-5,
22
+ use_bias: bool = False,
23
+ attn_implementation="flash_attention_2", # "eager","sdpa","flash_attention_2"
24
+ initializer_range=0.02,
25
+ init_merger_std=0.02,
26
+ is_causal=False, # ve causal forward
27
+ post_norm=True,
28
+ gradient_checkpointing=False,
29
+ **kwargs: Any,
30
+ ):
31
+ super().__init__(**kwargs)
32
+ self.embed_dim = embed_dim
33
+ self.hidden_size = hidden_size
34
+ self.intermediate_size = intermediate_size
35
+ self.num_hidden_layers = num_hidden_layers
36
+ self.num_attention_heads = num_attention_heads
37
+ self.num_channels = num_channels
38
+ self.patch_size = patch_size
39
+ self.spatial_merge_size = spatial_merge_size
40
+ self.temporal_patch_size = temporal_patch_size
41
+ self.rms_norm_eps = rms_norm_eps
42
+ self.use_bias = use_bias
43
+ self.attn_implementation = attn_implementation
44
+ self.initializer_range = initializer_range
45
+ self.init_merger_std = init_merger_std
46
+ self.is_causal = is_causal
47
+ self.post_norm = post_norm
48
+ self.gradient_checkpointing = gradient_checkpointing
49
+
50
+
51
+ class MonkeyOCRv2Config(Qwen3Config):
52
+ model_type = "monkeyocrv2"
53
+ def __init__(self,
54
+ image_token_id = 151655,
55
+ video_token_id = 151656,
56
+ vision_config: Optional[dict] = None, *args, **kwargs):
57
+ super().__init__(*args, **kwargs)
58
+ self.image_token_id = image_token_id
59
+ self.video_token_id = video_token_id
60
+ self.vision_config = MonkeyOCRv2VisionConfig(**(vision_config or {}))
61
+
62
+ def save_pretrained(self, save_directory, **kwargs):
63
+ self._auto_class = None
64
+ super().save_pretrained(save_directory, **kwargs)
65
+
66
+
67
+ class MonkeyOCRv2Processor(Qwen2_5_VLProcessor):
68
+ attributes = ["image_processor", "tokenizer"]
69
+ def __init__(self, image_processor=None, tokenizer=None, chat_template=None, **kwargs):
70
+ super().__init__(image_processor, tokenizer, chat_template=chat_template)
71
+ self.image_token = "<|image_pad|>" if not hasattr(tokenizer, "image_token") else tokenizer.image_token
72
+ self.image_token_id = 151655 if not hasattr(tokenizer, "image_token_id") else tokenizer.image_token_id
73
+
74
+
75
+ AutoProcessor.register("monkeyocrv2", MonkeyOCRv2Processor)
76
+ AutoConfig.register("monkeyocrv2", MonkeyOCRv2Config)
77
+
78
+ __all__ = ["MonkeyOCRv2Config", "MonkeyOCRv2VisionConfig", "MonkeyOCRv2Processor"]
generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "temperature": 0.6,
10
+ "top_k": 20,
11
+ "top_p": 0.95,
12
+ "transformers_version": "4.57.1"
13
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0267fdc991c9be02cf1b60405f77fe0629d084970ad9d6d08163feda3d470284
3
+ size 1755925032
modeling_monkeyocrv2.py ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List, Optional, Tuple, Union
2
+
3
+ import torch
4
+ from transformers.modeling_outputs import CausalLMOutputWithPast
5
+ from transformers.models.qwen3 import Qwen3ForCausalLM
6
+
7
+ from .configuration_monkeyocrv2 import MonkeyOCRv2VisionConfig, MonkeyOCRv2Config
8
+ from .modeling_monkeyocrv2_vision import MonkeyOCRv2VisionTransformer, VisionTransformerDecoder
9
+ import torch.nn as nn
10
+ from einops import rearrange
11
+
12
+ IMAGENET_DEFAULT_MEAN = [ 0.48145466, 0.4578275, 0.40821073 ]
13
+ IMAGENET_DEFAULT_STD = [ 0.26862954, 0.26130258, 0.27577711 ]
14
+
15
+
16
+ VLM_MAX_IMAGES = 200
17
+
18
+
19
+ class MonkeyOCRv2ForCausalLM(Qwen3ForCausalLM):
20
+ config_class = MonkeyOCRv2Config
21
+
22
+ def __init__(self, config: MonkeyOCRv2Config):
23
+ super().__init__(config)
24
+
25
+ if isinstance(self.config.vision_config, dict):
26
+ vision_config = MonkeyOCRv2VisionConfig(**self.config.vision_config)
27
+ self.config.vision_config = vision_config
28
+ else:
29
+ vision_config = self.config.vision_config
30
+
31
+ self.vision_tower = MonkeyOCRv2VisionTransformer(vision_config)
32
+
33
+
34
+ def prepare_inputs_embeds(
35
+ self,
36
+ input_ids: torch.LongTensor,
37
+ pixel_values: Optional[torch.FloatTensor] = None,
38
+ grid_thw: Optional[torch.FloatTensor] = None,
39
+ img_mask: Optional[torch.BoolTensor] = None,
40
+ ) -> torch.Tensor:
41
+ inputs_embeds = self.get_input_embeddings()(input_ids)
42
+ if pixel_values is not None:
43
+ assert img_mask is not None
44
+ if grid_thw.shape[0] > VLM_MAX_IMAGES:
45
+ print(
46
+ f"Num image exceeded: {grid_thw.shape[0]} > {VLM_MAX_IMAGES}, which may cause FSDP hang"
47
+ )
48
+
49
+ vision_embeddings, vision_embeddings_nomerge = self.vision_tower(pixel_values, grid_thw)
50
+
51
+ true_indices = torch.nonzero(img_mask).squeeze()
52
+ if len(true_indices) > vision_embeddings.size(0):
53
+ print(
54
+ f"img_mask sum > VE and will be truncated, mask.sum()={len(true_indices)} {vision_embeddings.size(0)=}"
55
+ )
56
+ true_indices = true_indices[: vision_embeddings.size(0)]
57
+ new_img_mask = torch.zeros_like(img_mask, device=img_mask.device)
58
+ new_img_mask[true_indices[:, 0], true_indices[:, 1]] = True
59
+ else:
60
+ new_img_mask = img_mask
61
+
62
+ assert (
63
+ vision_embeddings.size(0) == new_img_mask.sum()
64
+ ), f"{vision_embeddings.size(0)=}, {new_img_mask.sum()=}"
65
+
66
+ inputs_embeds = inputs_embeds.masked_scatter(
67
+ new_img_mask.to(inputs_embeds.device).unsqueeze(-1).expand_as(inputs_embeds),
68
+ vision_embeddings.to(inputs_embeds.device).type(inputs_embeds.dtype),
69
+ )
70
+
71
+ return inputs_embeds, vision_embeddings_nomerge
72
+ return inputs_embeds
73
+
74
+ def forward(
75
+ self,
76
+ input_ids: torch.LongTensor,
77
+ pixel_values: Optional[torch.FloatTensor] = None,
78
+ pixel_values_ori: Optional[torch.FloatTensor] = None,
79
+ image_grid_thw: Optional[torch.FloatTensor] = None,
80
+ inputs_embeds: Optional[torch.Tensor] = None,
81
+ attention_mask: Optional[torch.Tensor] = None,
82
+ position_ids: Optional[torch.LongTensor] = None,
83
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
84
+ labels: Optional[torch.LongTensor] = None,
85
+ output_attentions: Optional[bool] = None,
86
+ output_hidden_states: Optional[bool] = None,
87
+ return_dict: Optional[bool] = None,
88
+ use_cache: Optional[bool] = None,
89
+ logits_to_keep: int = 0,
90
+ **loss_kwargs,
91
+ ) -> Union[Tuple, CausalLMOutputWithPast]:
92
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
93
+ assert len(input_ids) >= 1, f"empty input_ids {input_ids.shape=} will cause gradnorm nan"
94
+
95
+ if inputs_embeds is None:
96
+ img_mask = input_ids == self.config.image_token_id
97
+ if pixel_values is not None:
98
+ inputs_embeds, vision_embeddings_nomerge = self.prepare_inputs_embeds(input_ids, pixel_values, image_grid_thw, img_mask)
99
+ else:
100
+ inputs_embeds = self.prepare_inputs_embeds(input_ids, pixel_values, image_grid_thw, img_mask)
101
+
102
+ outputs = super().forward(
103
+ inputs_embeds=inputs_embeds,
104
+ attention_mask=attention_mask,
105
+ position_ids=position_ids,
106
+ past_key_values=past_key_values,
107
+ labels=labels,
108
+ use_cache=use_cache if use_cache is not None else self.config.use_cache,
109
+ output_attentions=output_attentions,
110
+ output_hidden_states=output_hidden_states,
111
+ # return_dict=return_dict,
112
+ logits_to_keep=logits_to_keep,
113
+ **loss_kwargs,
114
+ )
115
+
116
+ return outputs
117
+
118
+ def prepare_inputs_for_generation(
119
+ self,
120
+ input_ids,
121
+ past_key_values=None,
122
+ inputs_embeds=None,
123
+ pixel_values=None,
124
+ attention_mask=None,
125
+ cache_position=None,
126
+ num_logits_to_keep=None,
127
+ **kwargs,
128
+ ):
129
+ model_inputs = super().prepare_inputs_for_generation(
130
+ input_ids,
131
+ past_key_values=past_key_values,
132
+ inputs_embeds=inputs_embeds,
133
+ attention_mask=attention_mask,
134
+ cache_position=cache_position,
135
+ num_logits_to_keep=num_logits_to_keep,
136
+ **kwargs,
137
+ )
138
+
139
+ if cache_position[0] == 0:
140
+ model_inputs["pixel_values"] = pixel_values
141
+
142
+ return model_inputs
modeling_monkeyocrv2_vision.py ADDED
@@ -0,0 +1,531 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+
3
+ import torch
4
+ import torch.nn as nn
5
+ import torch.nn.functional as F
6
+ import torch.utils.checkpoint
7
+
8
+ flash_attn_available = True
9
+ npu_available = True
10
+
11
+ try:
12
+ from flash_attn import flash_attn_varlen_func
13
+ except ImportError:
14
+ flash_attn_available = False
15
+
16
+ from torch.nn import LayerNorm
17
+ from transformers.modeling_utils import PreTrainedModel
18
+ from .configuration_monkeyocrv2 import MonkeyOCRv2VisionConfig
19
+
20
+
21
+ try:
22
+ import torch_npu
23
+ except ImportError:
24
+ npu_available = False
25
+
26
+
27
+
28
+ def rotate_half(x):
29
+ """Rotates half the hidden dims of the input."""
30
+ x1 = x[..., : x.shape[-1] // 2]
31
+ x2 = x[..., x.shape[-1] // 2:]
32
+ return torch.cat((-x2, x1), dim=-1)
33
+
34
+
35
+ def apply_rotary_pos_emb_vision(tensor: torch.Tensor, freqs: torch.Tensor) -> torch.Tensor:
36
+ orig_dtype = tensor.dtype
37
+ tensor = tensor.float()
38
+
39
+ cos = freqs.cos()
40
+ sin = freqs.sin()
41
+
42
+ cos = cos.unsqueeze(1).repeat(1, 1, 2).unsqueeze(0).float()
43
+ sin = sin.unsqueeze(1).repeat(1, 1, 2).unsqueeze(0).float()
44
+
45
+ output = (tensor * cos) + (rotate_half(tensor) * sin)
46
+
47
+ output = output.to(orig_dtype)
48
+
49
+ return output
50
+
51
+
52
+ class VisionRotaryEmbedding(nn.Module):
53
+ def __init__(self, dim: int, theta: float = 10000.0) -> None:
54
+ super().__init__()
55
+ inv_freq = 1.0 / (theta ** (torch.arange(0, dim, 2, dtype=torch.float) / dim))
56
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
57
+
58
+ def forward(self, seqlen: int) -> torch.Tensor:
59
+ seq = torch.arange(seqlen, device=self.inv_freq.device, dtype=self.inv_freq.dtype)
60
+ freqs = torch.outer(seq, self.inv_freq)
61
+ return freqs
62
+
63
+
64
+ class PatchMerger(nn.Module):
65
+ def __init__(
66
+ self,
67
+ dim: int,
68
+ context_dim: int,
69
+ spatial_merge_size: int = 2,
70
+ pre_norm="layernorm",
71
+ init_merger_std=None,
72
+ ) -> None:
73
+ super().__init__()
74
+ self.hidden_size = context_dim * (spatial_merge_size ** 2)
75
+ self.pre_norm = pre_norm
76
+ if self.pre_norm == "layernorm":
77
+ self.ln_q = LayerNorm(context_dim, eps=1e-6)
78
+ elif self.pre_norm == "rmsnorm":
79
+ self.ln_q = RMSNorm(context_dim, eps=1e-6)
80
+ else:
81
+ print("no norm in patch merger")
82
+
83
+ self.mlp = nn.Sequential(
84
+ nn.Linear(self.hidden_size, self.hidden_size),
85
+ nn.GELU(),
86
+ nn.Linear(self.hidden_size, dim),
87
+ )
88
+
89
+ if init_merger_std is not None:
90
+ nn.init.normal_(self.mlp[0].weight, mean=0.0, std=init_merger_std)
91
+ nn.init.zeros_(self.mlp[0].bias)
92
+ nn.init.normal_(self.mlp[2].weight, mean=0.0, std=init_merger_std)
93
+ nn.init.zeros_(self.mlp[2].bias)
94
+
95
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
96
+ if self.pre_norm:
97
+ x = self.mlp(self.ln_q(x).view(-1, self.hidden_size))
98
+ else:
99
+ x = self.mlp(x.view(-1, self.hidden_size))
100
+ return x
101
+
102
+
103
+ class VisionAttention(nn.Module):
104
+ def __init__(self, config, dim: int, num_heads: int = 16, bias=True) -> None:
105
+ super().__init__()
106
+ self.num_heads = num_heads
107
+ self.head_dim = dim // num_heads
108
+ self.qkv = nn.Linear(dim, dim * 3, bias=bias)
109
+ self.proj = nn.Linear(dim, dim, bias=bias)
110
+
111
+ def forward(
112
+ self,
113
+ hidden_states: torch.Tensor,
114
+ cu_seqlens: torch.Tensor,
115
+ rotary_pos_emb: torch.Tensor = None,
116
+ ) -> torch.Tensor:
117
+ seq_length = hidden_states.shape[0]
118
+
119
+ q, k, v = self.qkv(hidden_states).reshape(seq_length, 3, self.num_heads, -1).permute(1, 0, 2, 3).unbind(0)
120
+ q = apply_rotary_pos_emb_vision(q.unsqueeze(0), rotary_pos_emb).squeeze(0)
121
+ k = apply_rotary_pos_emb_vision(k.unsqueeze(0), rotary_pos_emb).squeeze(0)
122
+
123
+ attention_mask = torch.full(
124
+ [1, seq_length, seq_length], torch.finfo(q.dtype).min, device=q.device, dtype=q.dtype
125
+ )
126
+ for i in range(1, len(cu_seqlens)):
127
+ attention_mask[..., cu_seqlens[i - 1]: cu_seqlens[i], cu_seqlens[i - 1]: cu_seqlens[i]] = 0
128
+
129
+ q = q.transpose(0, 1)
130
+ k = k.transpose(0, 1)
131
+ v = v.transpose(0, 1)
132
+ attn_weights = torch.matmul(q, k.transpose(1, 2)) / math.sqrt(self.head_dim)
133
+ attn_weights = attn_weights + attention_mask
134
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(q.dtype)
135
+ attn_output = torch.matmul(attn_weights, v)
136
+ attn_output = attn_output.transpose(0, 1)
137
+ attn_output = attn_output.reshape(seq_length, -1)
138
+ attn_output = self.proj(attn_output)
139
+ return attn_output
140
+
141
+
142
+ class VisionFlashAttention2(nn.Module):
143
+ def __init__(self, config, dim: int, num_heads: int = 16, bias=True) -> None:
144
+ super().__init__()
145
+ self.num_heads = num_heads
146
+ self.qkv = nn.Linear(dim, dim * 3, bias=bias)
147
+ self.proj = nn.Linear(dim, dim, bias=bias)
148
+ self.config = config
149
+ self.is_causal = config.is_causal
150
+
151
+ def forward(
152
+ self,
153
+ hidden_states: torch.Tensor,
154
+ cu_seqlens: torch.Tensor,
155
+ rotary_pos_emb: torch.Tensor = None,
156
+ ) -> torch.Tensor:
157
+ seq_length = hidden_states.shape[0]
158
+ q, k, v = (
159
+ self.qkv(hidden_states).reshape(seq_length, 3, self.num_heads, -1).permute(1, 0, 2, 3).unbind(0)
160
+ ) # 'shd'
161
+ q = apply_rotary_pos_emb_vision(q.unsqueeze(0), rotary_pos_emb).squeeze(0)
162
+ k = apply_rotary_pos_emb_vision(k.unsqueeze(0), rotary_pos_emb).squeeze(0)
163
+ max_seqlen = (cu_seqlens[1:] - cu_seqlens[:-1]).max().item()
164
+ attn_output = flash_attn_varlen_func(
165
+ q, k, v, cu_seqlens, cu_seqlens, max_seqlen, max_seqlen, causal=self.is_causal
166
+ ).reshape(seq_length, -1)
167
+ attn_output = self.proj(attn_output)
168
+
169
+ return attn_output
170
+
171
+
172
+ class VisionAttentionV2(nn.Module):
173
+ def __init__(self, config, dim: int, num_heads: int = 16, bias=True) -> None:
174
+ super().__init__()
175
+ self.num_heads = num_heads
176
+ self.head_dim = dim // num_heads
177
+ self.qkv = nn.Linear(dim, dim * 3, bias=bias)
178
+ self.proj = nn.Linear(dim, dim, bias=bias)
179
+
180
+ def forward(
181
+ self,
182
+ hidden_states: torch.Tensor,
183
+ cu_seqlens: torch.Tensor,
184
+ rotary_pos_emb: torch.Tensor = None,
185
+ ) -> torch.Tensor:
186
+ seq_length = hidden_states.shape[0]
187
+
188
+ q, k, v = self.qkv(hidden_states).reshape(seq_length, 3, self.num_heads, -1).permute(1, 0, 2, 3).unbind(0)
189
+ q = apply_rotary_pos_emb_vision(q.unsqueeze(0), rotary_pos_emb).squeeze(0)
190
+ k = apply_rotary_pos_emb_vision(k.unsqueeze(0), rotary_pos_emb).squeeze(0)
191
+
192
+ seqlens = torch.diff(cu_seqlens).tolist()
193
+
194
+ q_list = torch.split(q, seqlens, 0)
195
+ k_list = torch.split(k, seqlens, 0)
196
+ v_list = torch.split(v, seqlens, 0)
197
+ outputs = []
198
+ for q_i, k_i, v_i in zip(q_list, k_list, v_list):
199
+ q_i = q_i.transpose(0, 1)
200
+ k_i = k_i.transpose(0, 1)
201
+ v_i = v_i.transpose(0, 1)
202
+ out = torch.matmul(q_i, k_i.transpose(1, 2)) / math.sqrt(self.head_dim)
203
+ out = nn.functional.softmax(out, dim=-1, dtype=torch.float32).to(q.dtype)
204
+ out = torch.matmul(out, v_i)
205
+ out = out.transpose(0, 1)
206
+ outputs.append(out)
207
+
208
+ attn_output = torch.concat(outputs, dim=0)
209
+ attn_output = attn_output.reshape(seq_length, -1)
210
+ attn_output = self.proj(attn_output)
211
+ return attn_output
212
+
213
+
214
+ class VisionAscendAttention(nn.Module):
215
+ def __init__(self, config, dim: int, num_heads: int = 16, bias=True) -> None:
216
+ super().__init__()
217
+ self.num_heads = num_heads
218
+ self.head_dim = dim // num_heads
219
+ self.qkv = nn.Linear(dim, dim * 3, bias=bias)
220
+ self.proj = nn.Linear(dim, dim, bias=bias)
221
+ self.config = config
222
+
223
+ def forward(
224
+ self,
225
+ hidden_states: torch.Tensor,
226
+ cu_seqlens: torch.Tensor,
227
+ rotary_pos_emb: torch.Tensor = None,
228
+ ) -> torch.Tensor:
229
+ seq_length = hidden_states.shape[0]
230
+ q, k, v = self.qkv(hidden_states).reshape(seq_length, 3, self.num_heads, -1).permute(1, 0, 2, 3).unbind(0)
231
+
232
+ q = apply_rotary_pos_emb_vision(q.unsqueeze(0), rotary_pos_emb).squeeze(0)
233
+ k = apply_rotary_pos_emb_vision(k.unsqueeze(0), rotary_pos_emb).squeeze(0)
234
+
235
+ attention_mask = torch.ones([1, seq_length, seq_length], device=q.device, dtype=torch.bool)
236
+ for i in range(1, len(cu_seqlens)):
237
+ attention_mask[..., cu_seqlens[i - 1]: cu_seqlens[i], cu_seqlens[i - 1]: cu_seqlens[i]] = False
238
+
239
+ q = q.transpose(0, 1).unsqueeze(0)
240
+ k = k.transpose(0, 1).unsqueeze(0)
241
+ v = v.transpose(0, 1).unsqueeze(0)
242
+
243
+ attn_output = torch_npu.npu_prompt_flash_attention(q, k, v,
244
+ atten_mask=attention_mask,
245
+ num_heads=self.num_heads, input_layout="BNSD",
246
+ scale_value=self.head_dim ** -0.5)
247
+ attn_output = attn_output.squeeze(0).transpose(0, 1)
248
+ attn_output = attn_output.reshape(seq_length, -1)
249
+ attn_output = self.proj(attn_output)
250
+ return attn_output
251
+
252
+
253
+ class VisionSdpaAttention(nn.Module):
254
+ def __init__(self, config, dim: int, num_heads: int = 16, bias=True) -> None:
255
+ super().__init__()
256
+ self.num_heads = num_heads
257
+ self.qkv = nn.Linear(dim, dim * 3, bias=bias)
258
+ self.proj = nn.Linear(dim, dim, bias=bias)
259
+ self.config = config
260
+
261
+ def forward(
262
+ self,
263
+ hidden_states: torch.Tensor,
264
+ cu_seqlens: torch.Tensor,
265
+ rotary_pos_emb: torch.Tensor = None,
266
+ ) -> torch.Tensor:
267
+ seq_length = hidden_states.shape[0]
268
+ q, k, v = self.qkv(hidden_states).reshape(seq_length, 3, self.num_heads, -1).permute(1, 0, 2, 3).unbind(0)
269
+
270
+ q = apply_rotary_pos_emb_vision(q.unsqueeze(0), rotary_pos_emb).squeeze(0)
271
+ k = apply_rotary_pos_emb_vision(k.unsqueeze(0), rotary_pos_emb).squeeze(0)
272
+
273
+ attention_mask = torch.zeros([1, seq_length, seq_length], device=q.device, dtype=torch.bool)
274
+ for i in range(1, len(cu_seqlens)):
275
+ attention_mask[..., cu_seqlens[i - 1]: cu_seqlens[i], cu_seqlens[i - 1]: cu_seqlens[i]] = True
276
+
277
+ q = q.transpose(0, 1).unsqueeze(0)
278
+ k = k.transpose(0, 1).unsqueeze(0)
279
+ v = v.transpose(0, 1).unsqueeze(0)
280
+
281
+ if attention_mask.stride(-1) != 1:
282
+ attention_mask = torch.empty_like(attention_mask, memory_format=torch.contiguous_format).copy_(attention_mask)
283
+
284
+ from torch.nn.attention import SDPBackend, sdpa_kernel
285
+ with sdpa_kernel(SDPBackend.EFFICIENT_ATTENTION):
286
+ attn_output = F.scaled_dot_product_attention(q, k, v, attention_mask, dropout_p=0.0)
287
+
288
+ attn_output = attn_output.squeeze(0).transpose(0, 1)
289
+ attn_output = attn_output.reshape(seq_length, -1)
290
+
291
+ attn_output = self.proj(attn_output)
292
+ return attn_output
293
+
294
+
295
+ VISION_ATTENTION_CLASSES = {
296
+ "eager": VisionAttention,
297
+ "eager_v2": VisionAttentionV2,
298
+ "flash_attention_2": VisionFlashAttention2,
299
+ "sdpa": VisionSdpaAttention,
300
+ "ascend_fa": VisionAscendAttention,
301
+ }
302
+
303
+
304
+ class RMSNorm(nn.Module):
305
+ def __init__(self, dim: int, eps: float = 1e-6):
306
+ super().__init__()
307
+ self.weight = nn.Parameter(torch.ones(dim))
308
+ self.eps = eps
309
+
310
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
311
+ output = self._norm(x.float()).type_as(x)
312
+ return output * self.weight
313
+
314
+ def extra_repr(self) -> str:
315
+ return f"{tuple(self.weight.shape)}, eps={self.eps}"
316
+
317
+ def _norm(self, x: torch.Tensor) -> torch.Tensor:
318
+ return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)
319
+
320
+
321
+ class SwiGLUFFN(nn.Module):
322
+ def __init__(self, config):
323
+ super().__init__()
324
+ hidden_features = config.intermediate_size
325
+ in_features = config.embed_dim
326
+ bias = config.use_bias
327
+
328
+ self.fc1 = nn.Linear(in_features, hidden_features, bias=bias)
329
+ self.fc2 = nn.Linear(hidden_features, in_features, bias=bias)
330
+ self.fc3 = nn.Linear(in_features, hidden_features, bias=bias)
331
+
332
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
333
+ x = F.silu(self.fc1(x)) * self.fc3(x)
334
+ x = self.fc2(x)
335
+ return x
336
+
337
+
338
+ class PatchEmbed(nn.Module):
339
+ def __init__(self, config):
340
+ super().__init__()
341
+ self.num_channels = config.num_channels
342
+ self.patch_size = config.patch_size
343
+ self.temporal_patch_size = config.temporal_patch_size
344
+ self.embed_dim = config.embed_dim
345
+ self.config = config
346
+ self.proj = nn.Conv2d(
347
+ config.num_channels,
348
+ config.embed_dim,
349
+ kernel_size=(config.patch_size, config.patch_size),
350
+ stride=(config.patch_size, config.patch_size),
351
+ )
352
+ self.norm = RMSNorm(config.embed_dim, eps=config.rms_norm_eps)
353
+
354
+ def forward(self, x: torch.Tensor, grid_thw=None) -> torch.Tensor:
355
+ x = x.view(-1, self.num_channels, self.temporal_patch_size, self.patch_size, self.patch_size)[:, :, 0]
356
+ x = self.proj(x).view(-1, self.embed_dim)
357
+ x = self.norm(x)
358
+ return x
359
+
360
+
361
+ class ViTPreprocessor(nn.Module):
362
+ def __init__(self, config):
363
+ super().__init__()
364
+ self.patch_h = config.patch_size
365
+ self.patch_w = config.patch_size
366
+ self.embed_dim = config.embed_dim
367
+ self.config = config
368
+ self.patchifier = PatchEmbed(config)
369
+
370
+ def forward(self, x: torch.Tensor, grid_thw=None) -> torch.Tensor:
371
+ tokens = self.patchifier(x, grid_thw)
372
+ return tokens
373
+
374
+
375
+ class VisionBlock(nn.Module):
376
+ def __init__(self, config, attn_implementation: str = "flash_attention_2"):
377
+ super().__init__()
378
+
379
+ if attn_implementation == "flash_attention_2" and not flash_attn_available:
380
+ if npu_available:
381
+ attn_implementation = "ascend_fa"
382
+ print("flash attention not available! fallback to ascend flash attention implementation ")
383
+ else:
384
+ # fallback to eager
385
+ attn_implementation = "sdpa"
386
+ print("flash attention not available! fallback to sdpa implementation ")
387
+
388
+ if attn_implementation == "ascend_fa" and not npu_available:
389
+ attn_implementation = "sdpa"
390
+ print("flash attention not available! fallback to sdpa implementation ")
391
+
392
+ self.attn = VISION_ATTENTION_CLASSES[attn_implementation](
393
+ config, config.embed_dim, num_heads=config.num_attention_heads, bias=config.use_bias
394
+ )
395
+ self.norm1 = RMSNorm(config.embed_dim, eps=config.rms_norm_eps)
396
+ self.mlp = SwiGLUFFN(config)
397
+ self.norm2 = RMSNorm(config.embed_dim, eps=config.rms_norm_eps)
398
+
399
+ def forward(self, hidden_states, cu_seqlens, rotary_pos_emb) -> torch.Tensor:
400
+ hidden_states = hidden_states + self.attn(
401
+ self.norm1(hidden_states), cu_seqlens=cu_seqlens, rotary_pos_emb=rotary_pos_emb
402
+ )
403
+ hidden_states = hidden_states + self.mlp(self.norm2(hidden_states))
404
+ return hidden_states
405
+
406
+
407
+ class MonkeyOCRv2VisionTransformer(PreTrainedModel):
408
+ _supports_flash_attn = True
409
+ _supports_sdpa = True
410
+ _no_split_modules = ["VisionBlock","PatchMerger"]
411
+ def __init__(self, config: MonkeyOCRv2VisionConfig) -> None:
412
+ super().__init__(config)
413
+
414
+ self.config = config
415
+ self.spatial_merge_size = config.spatial_merge_size
416
+
417
+ self.patch_embed = ViTPreprocessor(config)
418
+ self._init_weights(self.patch_embed.patchifier.proj)
419
+
420
+ head_dim = config.embed_dim // config.num_attention_heads
421
+
422
+ self.rotary_pos_emb = VisionRotaryEmbedding(head_dim // 2)
423
+
424
+ _num_hidden_layers = config.num_hidden_layers
425
+ self.blocks = nn.ModuleList(
426
+ [VisionBlock(config, config.attn_implementation) for _ in range(_num_hidden_layers)]
427
+ )
428
+
429
+ if self.config.post_norm:
430
+ self.post_trunk_norm = RMSNorm(config.embed_dim, eps=config.rms_norm_eps)
431
+
432
+ self.merger = PatchMerger(
433
+ dim=config.hidden_size,
434
+ context_dim=config.embed_dim,
435
+ spatial_merge_size=config.spatial_merge_size,
436
+ init_merger_std=self.config.init_merger_std,
437
+ )
438
+
439
+ self.gradient_checkpointing = False
440
+ self._gradient_checkpointing_func = torch.utils.checkpoint.checkpoint
441
+
442
+ def _init_weights(self, module):
443
+ std = self.config.initializer_range
444
+ if isinstance(module, (nn.Linear, nn.Conv3d)):
445
+ module.weight.data.normal_(mean=0.0, std=std)
446
+ if module.bias is not None:
447
+ module.bias.data.zero_()
448
+ elif isinstance(module, nn.Embedding):
449
+ module.weight.data.normal_(mean=0.0, std=std)
450
+ if module.padding_idx is not None:
451
+ module.weight.data[module.padding_idx].zero_()
452
+
453
+ @property
454
+ def dtype(self) -> torch.dtype:
455
+ return self.blocks[0].mlp.fc2.weight.dtype
456
+
457
+ @property
458
+ def device(self) -> torch.device:
459
+ return self.blocks[0].mlp.fc2.weight.device
460
+
461
+ def get_pos_ids_by_grid(self, grid_thw):
462
+ pos_ids = []
463
+ for t, h, w in grid_thw:
464
+ hpos_ids = torch.arange(h).unsqueeze(1).expand(-1, w)
465
+ hpos_ids = hpos_ids.reshape(
466
+ h // self.spatial_merge_size,
467
+ self.spatial_merge_size,
468
+ w // self.spatial_merge_size,
469
+ self.spatial_merge_size,
470
+ )
471
+ hpos_ids = hpos_ids.permute(0, 2, 1, 3)
472
+ hpos_ids = hpos_ids.flatten()
473
+
474
+ wpos_ids = torch.arange(w).unsqueeze(0).expand(h, -1)
475
+ wpos_ids = wpos_ids.reshape(
476
+ h // self.spatial_merge_size,
477
+ self.spatial_merge_size,
478
+ w // self.spatial_merge_size,
479
+ self.spatial_merge_size,
480
+ )
481
+ wpos_ids = wpos_ids.permute(0, 2, 1, 3)
482
+ wpos_ids = wpos_ids.flatten()
483
+
484
+ pos_ids.append(
485
+ torch.stack([hpos_ids, wpos_ids], dim=-1).repeat(t, 1)
486
+ )
487
+
488
+
489
+ return pos_ids
490
+
491
+ def rot_pos_emb(self, grid_thw):
492
+ pos_ids = self.get_pos_ids_by_grid(grid_thw)
493
+ pos_ids = torch.cat(pos_ids, dim=0)
494
+ max_grid_size = grid_thw[:, 1:].max()
495
+ rotary_pos_emb_full = self.rotary_pos_emb(max_grid_size)
496
+
497
+ emb = rotary_pos_emb_full[pos_ids]
498
+ rotary_pos_emb = torch.stack([emb[:,0], emb[:,1]], dim=2).reshape(emb.shape[0], -1)
499
+ return rotary_pos_emb
500
+
501
+ def forward(self, hidden_states: torch.Tensor, grid_thw: torch.Tensor, bf16=True) -> torch.Tensor:
502
+
503
+ if bf16:
504
+ hidden_states = hidden_states.bfloat16()
505
+ hidden_states = self.patch_embed(hidden_states, grid_thw)
506
+
507
+ rotary_pos_emb = self.rot_pos_emb(grid_thw)
508
+
509
+ cu_seqlens = torch.repeat_interleave(grid_thw[:, 1] * grid_thw[:, 2], grid_thw[:, 0]).cumsum(
510
+ dim=0,
511
+ dtype=grid_thw.dtype if torch.jit.is_tracing() else torch.int32,
512
+ )
513
+ cu_seqlens = F.pad(cu_seqlens, (1, 0), value=0)
514
+
515
+ for blk in self.blocks:
516
+ if self.gradient_checkpointing and self.training:
517
+ hidden_states = self._gradient_checkpointing_func(
518
+ blk.__call__,
519
+ hidden_states,
520
+ cu_seqlens,
521
+ rotary_pos_emb,
522
+ )
523
+ else:
524
+ hidden_states = blk(hidden_states, cu_seqlens=cu_seqlens, rotary_pos_emb=rotary_pos_emb)
525
+
526
+ if self.config.post_norm:
527
+ hidden_states = self.post_trunk_norm(hidden_states)
528
+
529
+ final_hidden_states = self.merger(hidden_states)
530
+ return final_hidden_states, hidden_states
531
+
preprocessor1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d243b62c3a14bd854539a3b6eebbf69b7716f38f9c7bfe0270d74b2b3e702b55
3
+ size 4823415
preprocessor2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:27712ba877dfdf325d22ddb9f79467c7998da7e57b9d6fcc4b96b7722ac6b505
3
+ size 288533650
preprocessor_config.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "auto_map": {
3
+ "AutoProcessor": "configuration_monkeyocrv2.MonkeyOCRv2Processor"
4
+ },
5
+ "min_pixels": 3136,
6
+ "max_pixels": 11289600,
7
+ "patch_size": 14,
8
+ "temporal_patch_size": 1,
9
+ "merge_size": 2,
10
+ "image_mean": [
11
+ 0.48145466,
12
+ 0.4578275,
13
+ 0.40821073
14
+ ],
15
+ "image_std": [
16
+ 0.26862954,
17
+ 0.26130258,
18
+ 0.27577711
19
+ ],
20
+ "image_processor_type": "Qwen2VLImageProcessor",
21
+ "processor_class": "MonkeyOCRv2Processor"
22
+ }
processor_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "auto_map": {
3
+ "AutoProcessor": "configuration_monkeyocrv2.MonkeyOCRv2Processor"
4
+ },
5
+ "processor_class": "MonkeyOCRv2Processor"
6
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>"
16
+ ],
17
+ "eos_token": {
18
+ "content": "<|im_end|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "pad_token": {
25
+ "content": "<|endoftext|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ }
31
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4
3
+ size 11422654
tokenizer_config.json ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ },
181
+ "151665": {
182
+ "content": "<tool_response>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": false
188
+ },
189
+ "151666": {
190
+ "content": "</tool_response>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": false
196
+ },
197
+ "151667": {
198
+ "content": "<think>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": false
204
+ },
205
+ "151668": {
206
+ "content": "</think>",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": false,
210
+ "single_word": false,
211
+ "special": false
212
+ }
213
+ },
214
+ "additional_special_tokens": [
215
+ "<|im_start|>",
216
+ "<|im_end|>",
217
+ "<|object_ref_start|>",
218
+ "<|object_ref_end|>",
219
+ "<|box_start|>",
220
+ "<|box_end|>",
221
+ "<|quad_start|>",
222
+ "<|quad_end|>",
223
+ "<|vision_start|>",
224
+ "<|vision_end|>",
225
+ "<|vision_pad|>",
226
+ "<|image_pad|>",
227
+ "<|video_pad|>"
228
+ ],
229
+ "auto_map": {
230
+ "AutoProcessor": "configuration_monkeyocrv2.MonkeyOCRv2Processor"
231
+ },
232
+ "bos_token": null,
233
+ "clean_up_tokenization_spaces": false,
234
+ "eos_token": "<|im_end|>",
235
+ "errors": "replace",
236
+ "extra_special_tokens": {},
237
+ "model_max_length": 131072,
238
+ "pad_token": "<|endoftext|>",
239
+ "processor_class": "MonkeyOCRv2Processor",
240
+ "split_special_tokens": false,
241
+ "tokenizer_class": "Qwen2Tokenizer",
242
+ "unk_token": null
243
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff