ASHu2 commited on
Commit
c38cc01
·
verified ·
1 Parent(s): 0154d68

merged MiniCPM-V 4.6 + RuneLang LoRA

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
args.json ADDED
@@ -0,0 +1,348 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "output_dir": "/root/outputs/rune-goblin-vision-lora/v2-20260607-171815",
3
+ "per_device_train_batch_size": 16,
4
+ "num_train_epochs": 3.0,
5
+ "max_steps": -1,
6
+ "learning_rate": 0.0001,
7
+ "lr_scheduler_type": "cosine",
8
+ "lr_scheduler_kwargs": null,
9
+ "warmup_steps": 0,
10
+ "optim": "adamw_torch_fused",
11
+ "optim_args": null,
12
+ "weight_decay": 0.1,
13
+ "adam_beta1": 0.9,
14
+ "adam_beta2": 0.95,
15
+ "adam_epsilon": 1e-08,
16
+ "optim_target_modules": null,
17
+ "gradient_accumulation_steps": 1,
18
+ "average_tokens_across_devices": true,
19
+ "max_grad_norm": 1.0,
20
+ "label_smoothing_factor": 0.0,
21
+ "bf16": true,
22
+ "fp16": false,
23
+ "bf16_full_eval": false,
24
+ "fp16_full_eval": false,
25
+ "tf32": null,
26
+ "gradient_checkpointing": true,
27
+ "gradient_checkpointing_kwargs": null,
28
+ "torch_compile": false,
29
+ "torch_compile_backend": null,
30
+ "torch_compile_mode": null,
31
+ "use_liger_kernel": false,
32
+ "liger_kernel_config": null,
33
+ "use_cache": false,
34
+ "neftune_noise_alpha": null,
35
+ "torch_empty_cache_steps": null,
36
+ "auto_find_batch_size": false,
37
+ "logging_strategy": "steps",
38
+ "logging_steps": 10,
39
+ "logging_first_step": true,
40
+ "log_on_each_node": true,
41
+ "logging_nan_inf_filter": true,
42
+ "include_num_input_tokens_seen": false,
43
+ "log_level": "passive",
44
+ "log_level_replica": "warning",
45
+ "disable_tqdm": null,
46
+ "report_to": [
47
+ "wandb"
48
+ ],
49
+ "run_name": "/root/outputs/rune-goblin-vision-lora/v2-20260607-171815",
50
+ "project": "huggingface",
51
+ "trackio_space_id": null,
52
+ "trackio_bucket_id": null,
53
+ "trackio_static_space_id": null,
54
+ "eval_strategy": "steps",
55
+ "eval_steps": 200.0,
56
+ "eval_delay": 0,
57
+ "per_device_eval_batch_size": 1,
58
+ "prediction_loss_only": false,
59
+ "eval_on_start": false,
60
+ "eval_do_concat_batches": true,
61
+ "eval_use_gather_object": false,
62
+ "eval_accumulation_steps": null,
63
+ "include_for_metrics": [],
64
+ "batch_eval_metrics": false,
65
+ "save_only_model": false,
66
+ "save_strategy": "steps",
67
+ "save_steps": 200.0,
68
+ "save_on_each_node": false,
69
+ "save_total_limit": 2,
70
+ "enable_jit_checkpoint": false,
71
+ "push_to_hub": false,
72
+ "hub_token": null,
73
+ "hub_private_repo": null,
74
+ "hub_model_id": null,
75
+ "hub_strategy": "every_save",
76
+ "hub_always_push": false,
77
+ "hub_revision": null,
78
+ "load_best_model_at_end": false,
79
+ "metric_for_best_model": "loss",
80
+ "greater_is_better": false,
81
+ "ignore_data_skip": false,
82
+ "restore_callback_states_from_checkpoint": false,
83
+ "full_determinism": false,
84
+ "seed": 42,
85
+ "data_seed": 42,
86
+ "use_cpu": false,
87
+ "accelerator_config": {
88
+ "dispatch_batches": false
89
+ },
90
+ "parallelism_config": null,
91
+ "dataloader_drop_last": false,
92
+ "dataloader_num_workers": 8,
93
+ "dataloader_pin_memory": true,
94
+ "dataloader_persistent_workers": false,
95
+ "dataloader_prefetch_factor": null,
96
+ "remove_unused_columns": true,
97
+ "label_names": null,
98
+ "train_sampling_strategy": "random",
99
+ "length_column_name": "length",
100
+ "ddp_find_unused_parameters": null,
101
+ "ddp_bucket_cap_mb": null,
102
+ "ddp_broadcast_buffers": null,
103
+ "ddp_static_graph": null,
104
+ "ddp_backend": null,
105
+ "ddp_timeout": 18000000,
106
+ "fsdp": [],
107
+ "fsdp_config": null,
108
+ "deepspeed": null,
109
+ "debug": null,
110
+ "skip_memory_metrics": true,
111
+ "do_train": false,
112
+ "do_eval": false,
113
+ "do_predict": false,
114
+ "resume_from_checkpoint": null,
115
+ "warmup_ratio": 0.03,
116
+ "logging_dir": "/root/outputs/rune-goblin-vision-lora/v2-20260607-171815/runs",
117
+ "local_rank": -1,
118
+ "sortish_sampler": false,
119
+ "predict_with_generate": false,
120
+ "generation_max_length": null,
121
+ "generation_num_beams": null,
122
+ "generation_config": null,
123
+ "tuner_backend": "peft",
124
+ "vit_gradient_checkpointing": false,
125
+ "router_aux_loss_coef": 0.0,
126
+ "enable_dft_loss": false,
127
+ "enable_channel_loss": false,
128
+ "safe_serialization": true,
129
+ "max_shard_size": "5GB",
130
+ "check_model": true,
131
+ "acc_strategy": "token",
132
+ "train_dataloader_shuffle": true,
133
+ "group_by_length": false,
134
+ "max_epochs": null,
135
+ "aligner_lr": null,
136
+ "vit_lr": null,
137
+ "use_logits_to_keep": null,
138
+ "ds3_gather_for_generation": true,
139
+ "resume_only_model": false,
140
+ "optimizer": null,
141
+ "loss_type": null,
142
+ "eval_metric": null,
143
+ "callbacks": [],
144
+ "early_stop_interval": null,
145
+ "eval_use_evalscope": false,
146
+ "eval_dataset": [],
147
+ "eval_dataset_args": null,
148
+ "eval_limit": null,
149
+ "eval_generation_config": null,
150
+ "extra_eval_args": null,
151
+ "tuner_type": "lora",
152
+ "use_galore": false,
153
+ "galore_target_modules": null,
154
+ "galore_rank": 128,
155
+ "galore_update_proj_gap": 50,
156
+ "galore_scale": 1.0,
157
+ "galore_proj_type": "std",
158
+ "galore_optim_per_parameter": false,
159
+ "galore_with_embedding": false,
160
+ "galore_quantization": false,
161
+ "galore_proj_quant": false,
162
+ "galore_proj_bits": 4,
163
+ "galore_proj_group_size": 256,
164
+ "galore_cos_threshold": 0.4,
165
+ "galore_gamma_proj": 2,
166
+ "galore_queue_size": 5,
167
+ "lisa_activated_layers": 0,
168
+ "lisa_step_interval": 20,
169
+ "use_flash_ckpt": false,
170
+ "use_ray": false,
171
+ "ray_exp_name": null,
172
+ "device_groups": null,
173
+ "model": "openbmb/MiniCPM-V-4.6",
174
+ "model_type": "minicpmv4_6",
175
+ "model_revision": null,
176
+ "task_type": "causal_lm",
177
+ "torch_dtype": "bfloat16",
178
+ "attn_impl": "sdpa",
179
+ "experts_impl": null,
180
+ "new_special_tokens": [],
181
+ "num_labels": null,
182
+ "problem_type": null,
183
+ "rope_scaling": null,
184
+ "device_map": null,
185
+ "max_memory": {},
186
+ "max_model_len": null,
187
+ "local_repo_path": null,
188
+ "init_strategy": null,
189
+ "template": "minicpmv4_6",
190
+ "system": null,
191
+ "max_length": 2048,
192
+ "truncation_strategy": "delete",
193
+ "max_pixels": null,
194
+ "agent_template": null,
195
+ "norm_bbox": null,
196
+ "use_chat_template": true,
197
+ "padding_side": "right",
198
+ "padding_free": false,
199
+ "loss_scale": "default",
200
+ "sequence_parallel_size": 1,
201
+ "template_backend": "swift",
202
+ "response_prefix": null,
203
+ "enable_thinking": null,
204
+ "add_non_thinking_prefix": true,
205
+ "dataset": [
206
+ "rg_swift_train.jsonl"
207
+ ],
208
+ "val_dataset": [
209
+ "rg_swift_val.jsonl"
210
+ ],
211
+ "cached_dataset": [],
212
+ "cached_val_dataset": [],
213
+ "split_dataset_ratio": 0.0,
214
+ "dataset_num_proc": 8,
215
+ "load_from_cache_file": false,
216
+ "dataset_shuffle": true,
217
+ "val_dataset_shuffle": false,
218
+ "streaming": false,
219
+ "interleave_prob": null,
220
+ "stopping_strategy": "first_exhausted",
221
+ "shuffle_buffer_size": 1000,
222
+ "download_mode": "reuse_dataset_if_exists",
223
+ "columns": {},
224
+ "strict": false,
225
+ "disable_auto_column_mapping": false,
226
+ "model_name": null,
227
+ "model_author": null,
228
+ "custom_dataset_info": [],
229
+ "quant_method": null,
230
+ "quant_bits": null,
231
+ "hqq_axis": null,
232
+ "bnb_4bit_compute_dtype": "bfloat16",
233
+ "bnb_4bit_quant_type": "nf4",
234
+ "bnb_4bit_use_double_quant": true,
235
+ "bnb_4bit_quant_storage": null,
236
+ "max_new_tokens": 64,
237
+ "temperature": 0.0,
238
+ "top_k": null,
239
+ "top_p": null,
240
+ "repetition_penalty": null,
241
+ "num_beams": 1,
242
+ "stream": false,
243
+ "stop_words": [],
244
+ "logprobs": false,
245
+ "top_logprobs": null,
246
+ "structured_outputs_regex": null,
247
+ "adapters": [],
248
+ "external_plugins": [],
249
+ "custom_register_path": [],
250
+ "model_kwargs": {},
251
+ "enable_npu_model_patch": true,
252
+ "load_args": false,
253
+ "load_data_args": false,
254
+ "packing": false,
255
+ "packing_length": null,
256
+ "packing_num_proc": 1,
257
+ "lazy_tokenize": true,
258
+ "use_hf": true,
259
+ "ignore_args_error": false,
260
+ "use_swift_lora": false,
261
+ "freeze_parameters": [],
262
+ "freeze_parameters_regex": null,
263
+ "freeze_parameters_ratio": 0.0,
264
+ "trainable_parameters": [],
265
+ "trainable_parameters_regex": null,
266
+ "freeze_llm": false,
267
+ "freeze_vit": true,
268
+ "freeze_aligner": true,
269
+ "target_modules": [
270
+ "all-linear"
271
+ ],
272
+ "target_regex": null,
273
+ "target_parameters": null,
274
+ "modules_to_save": [],
275
+ "lora_rank": 16,
276
+ "lora_alpha": 32,
277
+ "lora_dropout": 0.05,
278
+ "lora_bias": "none",
279
+ "lora_dtype": null,
280
+ "lorap_lr_ratio": null,
281
+ "use_rslora": false,
282
+ "use_dora": false,
283
+ "lora_ga_batch_size": 2,
284
+ "lora_ga_iters": 2,
285
+ "lora_ga_max_length": 1024,
286
+ "lora_ga_direction": "ArB2r",
287
+ "lora_ga_scale": "stable",
288
+ "lora_ga_stable_gamma": 16,
289
+ "init_weights": true,
290
+ "fourier_n_frequency": 2000,
291
+ "fourier_scaling": 300.0,
292
+ "boft_block_size": 4,
293
+ "boft_block_num": 0,
294
+ "boft_n_butterfly_factor": 1,
295
+ "boft_dropout": 0.0,
296
+ "vera_rank": 256,
297
+ "vera_projection_prng_key": 0,
298
+ "vera_dropout": 0.0,
299
+ "vera_d_initial": 0.1,
300
+ "adapter_act": "gelu",
301
+ "adapter_length": 128,
302
+ "adalora_target_r": 8,
303
+ "adalora_init_r": 12,
304
+ "adalora_tinit": 0,
305
+ "adalora_tfinal": 0,
306
+ "adalora_deltaT": 1,
307
+ "adalora_beta1": 0.85,
308
+ "adalora_beta2": 0.85,
309
+ "adalora_orth_reg_weight": 0.5,
310
+ "llamapro_num_new_blocks": 4,
311
+ "llamapro_num_groups": null,
312
+ "reft_layer_key": null,
313
+ "reft_layers": null,
314
+ "reft_rank": 4,
315
+ "reft_intervention_type": "LoreftIntervention",
316
+ "reft_args": null,
317
+ "swanlab_token": null,
318
+ "swanlab_project": "ms-swift",
319
+ "swanlab_workspace": null,
320
+ "swanlab_exp_name": null,
321
+ "swanlab_notification_method": null,
322
+ "swanlab_webhook_url": null,
323
+ "swanlab_secret": null,
324
+ "swanlab_sender_email": null,
325
+ "swanlab_receiver_email": null,
326
+ "swanlab_smtp_server": null,
327
+ "swanlab_smtp_port": null,
328
+ "swanlab_email_language": "zh",
329
+ "swanlab_mode": "cloud",
330
+ "add_version": true,
331
+ "create_checkpoint_symlink": false,
332
+ "zero_hpz_partition_size": null,
333
+ "deepspeed_autotp_size": null,
334
+ "swift_version": "4.2.3",
335
+ "ckpt_dir": null,
336
+ "rank": -1,
337
+ "global_world_size": 1,
338
+ "local_world_size": 1,
339
+ "model_suffix": "MiniCPM-V-4.6",
340
+ "model_info": "ModelInfo(model_type='minicpmv4_6', model_dir='/root/.cache/huggingface/hub/models--openbmb--MiniCPM-V-4.6/snapshots/d7f5ed8d15462c508d4f9d9ce5a0cf1fe8d87bcc', torch_dtype=torch.bfloat16, max_model_len=262144, quant_method=None, quant_bits=None, rope_scaling=None, is_moe_model=False, is_multimodal=True, config=None, task_type='causal_lm', num_labels=None)",
341
+ "model_meta": "ModelMeta(model_type='minicpmv4_6', model_groups=[ModelGroup(models=[Model(ms_model_id='OpenBMB/MiniCPM-V-4.6', hf_model_id='openbmb/MiniCPM-V-4.6', model_path=None, ms_revision=None, hf_revision=None)], template=None, ignore_patterns=None, requires=None, tags=[])], loader=<class 'swift.model.models.minicpm.MiniCPMV4_6Loader'>, template='minicpmv4_6', model_arch=MultiModelKeys(arch_name='minicpmv4_6', 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.language_model'], aligner=['model.merger'], vision_tower=['model.vision_tower'], generator=[]), mcore_model_type=None, architectures=['MiniCPMV4_6ForConditionalGeneration'], additional_saved_files=[], torch_dtype=None, is_multimodal=True, is_reward=False, task_type=None, ignore_patterns=None, requires=['transformers>=5.7.0'], tags=[])",
342
+ "model_dir": "/root/.cache/huggingface/hub/models--openbmb--MiniCPM-V-4.6/snapshots/d7f5ed8d15462c508d4f9d9ce5a0cf1fe8d87bcc",
343
+ "template_meta": "ChatmlTemplateMeta(template_type='minicpmv4_6', prefix=[], prompt=['<|im_start|>user\\n{{QUERY}}<|im_end|>\\n<|im_start|>assistant\\n'], chat_sep=['<|im_end|>\\n'], suffix=['<|im_end|>\\n'], template_cls=<class 'swift.template.templates.minicpm.MiniCPMV4_6Template'>, system_prefix=['<|im_start|>system\\n{{SYSTEM}}<|im_end|>\\n'], default_system=None, auto_add_bos=True, stop_words=[], agent_template='react_en', is_thinking=True, thinking_prefix='<think>\\n', non_thinking_prefix='<think>\\n\\n</think>\\n\\n', history_thinking_prefix='')",
344
+ "_val_dataset_exists": true,
345
+ "hub": "<class 'swift.hub.hub.HFHub'>",
346
+ "evaluation_strategy": "steps",
347
+ "training_args": "Seq2SeqTrainingArguments(output_dir='/root/outputs/rune-goblin-vision-lora/v2-20260607-171815', per_device_train_batch_size=16, num_train_epochs=3.0, max_steps=-1, learning_rate=0.0001, lr_scheduler_type=<SchedulerType.COSINE: 'cosine'>, lr_scheduler_kwargs=None, warmup_steps=0.03, optim=<OptimizerNames.ADAMW_TORCH_FUSED: 'adamw_torch_fused'>, optim_args=None, weight_decay=0.1, adam_beta1=0.9, adam_beta2=0.95, adam_epsilon=1e-08, optim_target_modules=None, gradient_accumulation_steps=1, average_tokens_across_devices=None, max_grad_norm=1.0, label_smoothing_factor=0.0, bf16=True, fp16=False, bf16_full_eval=False, fp16_full_eval=False, tf32=None, gradient_checkpointing=True, gradient_checkpointing_kwargs=None, torch_compile=False, torch_compile_backend=None, torch_compile_mode=None, use_liger_kernel=False, liger_kernel_config=None, use_cache=False, neftune_noise_alpha=None, torch_empty_cache_steps=None, auto_find_batch_size=False, logging_strategy=<IntervalStrategy.STEPS: 'steps'>, logging_steps=10, logging_first_step=True, log_on_each_node=True, logging_nan_inf_filter=True, include_num_input_tokens_seen=None, log_level='passive', log_level_replica='warning', disable_tqdm=False, report_to=['wandb'], run_name='/root/outputs/rune-goblin-vision-lora/v2-20260607-171815', project='huggingface', trackio_space_id=None, trackio_bucket_id=None, trackio_static_space_id=None, eval_strategy=<IntervalStrategy.STEPS: 'steps'>, eval_steps=200, eval_delay=0, per_device_eval_batch_size=1, prediction_loss_only=False, eval_on_start=False, eval_do_concat_batches=True, eval_use_gather_object=False, eval_accumulation_steps=None, include_for_metrics=[], batch_eval_metrics=False, save_only_model=False, save_strategy=<SaveStrategy.STEPS: 'steps'>, save_steps=200, save_on_each_node=False, save_total_limit=2, enable_jit_checkpoint=False, push_to_hub=False, hub_token=None, hub_private_repo=None, hub_model_id=None, hub_strategy=<HubStrategy.EVERY_SAVE: 'every_save'>, hub_always_push=False, hub_revision=None, load_best_model_at_end=False, metric_for_best_model='loss', greater_is_better=False, ignore_data_skip=False, restore_callback_states_from_checkpoint=False, full_determinism=False, seed=42, data_seed=42, use_cpu=False, 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, dataloader_drop_last=False, dataloader_num_workers=8, dataloader_pin_memory=True, dataloader_persistent_workers=False, dataloader_prefetch_factor=2, remove_unused_columns=False, label_names=None, train_sampling_strategy='random', length_column_name='length', ddp_find_unused_parameters=None, ddp_bucket_cap_mb=None, ddp_broadcast_buffers=None, ddp_static_graph=None, ddp_backend=None, ddp_timeout=18000000, fsdp=[], fsdp_config={'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}, deepspeed=None, debug=[], skip_memory_metrics=True, do_train=False, do_eval=True, do_predict=False, resume_from_checkpoint=None, warmup_ratio=0.03, logging_dir='/root/outputs/rune-goblin-vision-lora/v2-20260607-171815/runs', local_rank=-1, sortish_sampler=False, predict_with_generate=False, generation_max_length=None, generation_num_beams=None, generation_config=None, tuner_backend='peft', vit_gradient_checkpointing=False, router_aux_loss_coef=0.0, enable_dft_loss=False, enable_channel_loss=False, safe_serialization=True, max_shard_size='5GB', check_model=True, acc_strategy='token', train_dataloader_shuffle=True, group_by_length=False, 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, eval_metric=None, callbacks=[], early_stop_interval=None, eval_use_evalscope=False, eval_dataset=[], eval_dataset_args=None, eval_limit=None, eval_generation_config=None, extra_eval_args=None, tuner_type='lora', use_galore=False, galore_target_modules=None, galore_rank=128, galore_update_proj_gap=50, galore_scale=1.0, galore_proj_type='std', galore_optim_per_parameter=False, galore_with_embedding=False, galore_quantization=False, galore_proj_quant=False, galore_proj_bits=4, galore_proj_group_size=256, galore_cos_threshold=0.4, galore_gamma_proj=2, galore_queue_size=5, lisa_activated_layers=0, lisa_step_interval=20, use_flash_ckpt=False)"
348
+ }
chat_template.jinja ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if enable_thinking is not defined -%}
2
+ {%- set enable_thinking = false -%}
3
+ {%- endif -%}
4
+ {%- macro render_content(content, is_system_content=false) -%}
5
+ {%- if content is string -%}
6
+ {{- content -}}
7
+ {%- elif content is iterable and content is not mapping -%}
8
+ {%- set ns = namespace(parts=[]) -%}
9
+ {%- for item in content -%}
10
+ {%- if 'image' in item or 'image_url' in item or item.type == 'image' -%}
11
+ {%- if is_system_content -%}
12
+ {{- raise_exception('System message cannot contain images.') -}}
13
+ {%- endif -%}
14
+ {%- set ns.parts = ns.parts + ['<|image_pad|>'] -%}
15
+ {%- elif 'video' in item or item.type == 'video' -%}
16
+ {%- if is_system_content -%}
17
+ {{- raise_exception('System message cannot contain videos.') -}}
18
+ {%- endif -%}
19
+ {%- set ns.parts = ns.parts + ['<|video_pad|>'] -%}
20
+ {%- elif 'text' in item -%}
21
+ {%- set ns.parts = ns.parts + [item.text] -%}
22
+ {%- else -%}
23
+ {{- raise_exception('Unexpected item type in content.') -}}
24
+ {%- endif -%}
25
+ {%- endfor -%}
26
+ {{- ns.parts | join('\n') -}}
27
+ {%- elif content is none or content is undefined -%}
28
+ {{- '' -}}
29
+ {%- else -%}
30
+ {{- raise_exception('Unexpected content type.') -}}
31
+ {%- endif -%}
32
+ {%- endmacro -%}
33
+ {%- if not messages %}
34
+ {{- raise_exception('No messages provided.') }}
35
+ {%- endif %}
36
+ {%- if tools and tools is iterable and tools is not mapping %}
37
+ {{- '<|im_start|>system\n' }}
38
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
39
+ {%- for tool in tools %}
40
+ {{- "\n" }}
41
+ {{- tool | tojson }}
42
+ {%- endfor %}
43
+ {{- "\n</tools>" }}
44
+ {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
45
+ {%- if messages[0].role == 'system' %}
46
+ {%- set content = render_content(messages[0].content, true)|trim %}
47
+ {%- if content %}
48
+ {{- '\n\n' + content }}
49
+ {%- endif %}
50
+ {%- endif %}
51
+ {{- '<|im_end|>\n' }}
52
+ {%- else %}
53
+ {%- if messages[0].role == 'system' %}
54
+ {%- set content = render_content(messages[0].content, true)|trim %}
55
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
56
+ {%- endif %}
57
+ {%- endif %}
58
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
59
+ {%- for message in messages[::-1] %}
60
+ {%- set index = (messages|length - 1) - loop.index0 %}
61
+ {%- if ns.multi_step_tool and message.role == "user" %}
62
+ {%- set content = render_content(message.content)|trim %}
63
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
64
+ {%- set ns.multi_step_tool = false %}
65
+ {%- set ns.last_query_index = index %}
66
+ {%- endif %}
67
+ {%- endif %}
68
+ {%- endfor %}
69
+ {%- if ns.multi_step_tool %}
70
+ {{- raise_exception('No user query found in messages.') }}
71
+ {%- endif %}
72
+ {%- for message in messages %}
73
+ {%- set content = render_content(message.content)|trim %}
74
+ {%- if message.role == "system" %}
75
+ {%- if not loop.first %}
76
+ {{- raise_exception('System message must be at the beginning.') }}
77
+ {%- endif %}
78
+ {%- elif message.role == "user" %}
79
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
80
+ {%- elif message.role == "assistant" %}
81
+ {%- set reasoning_content = '' %}
82
+ {%- if message.reasoning_content is string %}
83
+ {%- set reasoning_content = message.reasoning_content %}
84
+ {%- else %}
85
+ {%- if '</think>' in content %}
86
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
87
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
88
+ {%- endif %}
89
+ {%- endif %}
90
+ {%- set reasoning_content = reasoning_content|trim %}
91
+ {%- if loop.index0 > ns.last_query_index %}
92
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
93
+ {%- else %}
94
+ {{- '<|im_start|>' + message.role + '\n' + content }}
95
+ {%- endif %}
96
+ {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
97
+ {%- for tool_call in message.tool_calls %}
98
+ {%- if tool_call.function is defined %}
99
+ {%- set tool_call = tool_call.function %}
100
+ {%- endif %}
101
+ {%- if loop.first %}
102
+ {%- if content|trim %}
103
+ {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
104
+ {%- else %}
105
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
106
+ {%- endif %}
107
+ {%- else %}
108
+ {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
109
+ {%- endif %}
110
+ {%- if tool_call.arguments is defined %}
111
+ {%- for args_name, args_value in tool_call.arguments|items %}
112
+ {{- '<parameter=' + args_name + '>\n' }}
113
+ {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
114
+ {{- args_value }}
115
+ {{- '\n</parameter>\n' }}
116
+ {%- endfor %}
117
+ {%- endif %}
118
+ {{- '</function>\n</tool_call>' }}
119
+ {%- endfor %}
120
+ {%- endif %}
121
+ {{- '<|im_end|>\n' }}
122
+ {%- elif message.role == "tool" %}
123
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
124
+ {{- '<|im_start|>user' }}
125
+ {%- endif %}
126
+ {{- '\n<tool_response>\n' }}
127
+ {{- content }}
128
+ {{- '\n</tool_response>' }}
129
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
130
+ {{- '<|im_end|>\n' }}
131
+ {%- elif loop.last %}
132
+ {{- '<|im_end|>\n' }}
133
+ {%- endif %}
134
+ {%- else %}
135
+ {{- raise_exception('Unexpected message role.') }}
136
+ {%- endif %}
137
+ {%- endfor %}
138
+ {%- if add_generation_prompt %}
139
+ {{- '<|im_start|>assistant\n' }}
140
+ {%- if enable_thinking is defined and enable_thinking is false %}
141
+ {{- '<think>\n\n</think>\n\n' }}
142
+ {%- else %}
143
+ {{- '<think>\n' }}
144
+ {%- endif %}
145
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MiniCPMV4_6ForConditionalGeneration"
4
+ ],
5
+ "bos_token_id": null,
6
+ "downsample_mode": "16x",
7
+ "drop_vision_last_layer": false,
8
+ "dtype": "bfloat16",
9
+ "eos_token_id": 248044,
10
+ "hidden_size": 1024,
11
+ "image_size": 1120,
12
+ "image_token_id": 248056,
13
+ "insert_layer_id": 6,
14
+ "merge_kernel_size": [
15
+ 2,
16
+ 2
17
+ ],
18
+ "merger_times": 1,
19
+ "model_type": "minicpmv4_6",
20
+ "pad_token_id": 248044,
21
+ "patch_size": 14,
22
+ "text_config": {
23
+ "attention_bias": false,
24
+ "attention_dropout": 0.0,
25
+ "attn_output_gate": true,
26
+ "bos_token_id": null,
27
+ "dtype": "bfloat16",
28
+ "eos_token_id": null,
29
+ "full_attention_interval": 4,
30
+ "head_dim": 256,
31
+ "hidden_act": "silu",
32
+ "hidden_size": 1024,
33
+ "initializer_range": 0.02,
34
+ "intermediate_size": 3584,
35
+ "layer_types": [
36
+ "linear_attention",
37
+ "linear_attention",
38
+ "linear_attention",
39
+ "full_attention",
40
+ "linear_attention",
41
+ "linear_attention",
42
+ "linear_attention",
43
+ "full_attention",
44
+ "linear_attention",
45
+ "linear_attention",
46
+ "linear_attention",
47
+ "full_attention",
48
+ "linear_attention",
49
+ "linear_attention",
50
+ "linear_attention",
51
+ "full_attention",
52
+ "linear_attention",
53
+ "linear_attention",
54
+ "linear_attention",
55
+ "full_attention",
56
+ "linear_attention",
57
+ "linear_attention",
58
+ "linear_attention",
59
+ "full_attention"
60
+ ],
61
+ "linear_conv_kernel_dim": 4,
62
+ "linear_key_head_dim": 128,
63
+ "linear_num_key_heads": 16,
64
+ "linear_num_value_heads": 16,
65
+ "linear_value_head_dim": 128,
66
+ "mamba_ssm_dtype": "float32",
67
+ "max_position_embeddings": 262144,
68
+ "mlp_only_layers": [],
69
+ "model_type": "qwen3_5_text",
70
+ "mtp_num_hidden_layers": 1,
71
+ "mtp_use_dedicated_embeddings": false,
72
+ "num_attention_heads": 8,
73
+ "num_hidden_layers": 24,
74
+ "num_key_value_heads": 2,
75
+ "pad_token_id": 248044,
76
+ "partial_rotary_factor": 0.25,
77
+ "rms_norm_eps": 1e-06,
78
+ "rope_parameters": {
79
+ "partial_rotary_factor": 0.25,
80
+ "rope_theta": 10000000,
81
+ "rope_type": "default"
82
+ },
83
+ "tie_word_embeddings": true,
84
+ "use_cache": true,
85
+ "vocab_size": 248094
86
+ },
87
+ "tie_word_embeddings": true,
88
+ "transformers_version": "5.8.1",
89
+ "video_token_id": 248057,
90
+ "vision_config": {
91
+ "attention_dropout": 0.0,
92
+ "dtype": "bfloat16",
93
+ "hidden_act": "gelu_pytorch_tanh",
94
+ "hidden_size": 1152,
95
+ "image_size": 980,
96
+ "insert_layer_id": 6,
97
+ "intermediate_size": 4304,
98
+ "layer_norm_eps": 1e-06,
99
+ "model_type": "minicpmv4_6_vision",
100
+ "num_attention_heads": 16,
101
+ "num_channels": 3,
102
+ "num_hidden_layers": 27,
103
+ "patch_size": 14,
104
+ "window_kernel_size": [
105
+ 2,
106
+ 2
107
+ ]
108
+ }
109
+ }
generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 248045,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 248044,
6
+ 248046
7
+ ],
8
+ "repetition_penalty": 1.0,
9
+ "temperature": 0.7,
10
+ "top_k": 0,
11
+ "top_p": 1.0,
12
+ "transformers_version": "5.8.1"
13
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c70c6235402cb09364284684d23537bef0326083c83c93550e631cfcae2d657a
3
+ size 2600957560
preprocessor_config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor_type": "MiniCPMV4_6ImageProcessor",
3
+ "processor_class": "MiniCPMV4_6Processor",
4
+ "max_slice_nums": 9,
5
+ "scale_resolution": 448,
6
+ "patch_size": 14,
7
+ "use_image_id": true,
8
+ "slice_mode": true,
9
+ "image_mean": [
10
+ 0.5,
11
+ 0.5,
12
+ 0.5
13
+ ],
14
+ "image_std": [
15
+ 0.5,
16
+ 0.5,
17
+ 0.5
18
+ ]
19
+ }
processor_config.json ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "do_convert_rgb": true,
4
+ "do_normalize": true,
5
+ "do_rescale": true,
6
+ "do_resize": true,
7
+ "downsample_mode": "16x",
8
+ "image_mean": [
9
+ 0.5,
10
+ 0.5,
11
+ 0.5
12
+ ],
13
+ "image_processor_type": "MiniCPMV4_6ImageProcessor",
14
+ "image_std": [
15
+ 0.5,
16
+ 0.5,
17
+ 0.5
18
+ ],
19
+ "max_slice_nums": 9,
20
+ "patch_size": 14,
21
+ "resample": 3,
22
+ "rescale_factor": 0.00392156862745098,
23
+ "scale_resolution": 448,
24
+ "slice_mode": true,
25
+ "use_image_id": true
26
+ },
27
+ "processor_class": "MiniCPMV4_6Processor",
28
+ "video_processor": {
29
+ "do_convert_rgb": true,
30
+ "do_normalize": true,
31
+ "do_rescale": true,
32
+ "do_resize": true,
33
+ "do_sample_frames": true,
34
+ "downsample_mode": "16x",
35
+ "image_mean": [
36
+ 0.5,
37
+ 0.5,
38
+ 0.5
39
+ ],
40
+ "image_std": [
41
+ 0.5,
42
+ 0.5,
43
+ 0.5
44
+ ],
45
+ "max_num_frames": 128,
46
+ "max_slice_nums": 9,
47
+ "patch_size": 14,
48
+ "resample": 3,
49
+ "rescale_factor": 0.00392156862745098,
50
+ "return_metadata": false,
51
+ "scale_resolution": 448,
52
+ "slice_mode": true,
53
+ "stack_frames": 1,
54
+ "use_image_id": true,
55
+ "video_processor_type": "MiniCPMV4_6VideoProcessor"
56
+ }
57
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:33861e37bb955af1e3f3061182b820f347eba2b9c2c1011c82794bf0d6e77b54
3
+ size 19992481
tokenizer_config.json ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "audio_bos_token": "<|audio_start|>",
4
+ "audio_eos_token": "<|audio_end|>",
5
+ "audio_token": "<|audio_pad|>",
6
+ "backend": "tokenizers",
7
+ "bos_token": "<|im_start|>",
8
+ "clean_up_tokenization_spaces": false,
9
+ "eos_token": "<|im_end|>",
10
+ "errors": "replace",
11
+ "image_end_token": "</image>",
12
+ "image_id_end_token": "</image_id>",
13
+ "image_id_start_token": "<image_id>",
14
+ "image_start_token": "<image>",
15
+ "image_token": "<|image_pad|>",
16
+ "is_local": true,
17
+ "local_files_only": false,
18
+ "model_max_length": 262144,
19
+ "model_specific_special_tokens": {
20
+ "audio_bos_token": "<|audio_start|>",
21
+ "audio_eos_token": "<|audio_end|>",
22
+ "audio_token": "<|audio_pad|>",
23
+ "image_end_token": "</image>",
24
+ "image_id_end_token": "</image_id>",
25
+ "image_id_start_token": "<image_id>",
26
+ "image_start_token": "<image>",
27
+ "image_token": "<|image_pad|>",
28
+ "slice_end_token": "</slice>",
29
+ "slice_start_token": "<slice>",
30
+ "video_token": "<|video_pad|>",
31
+ "vision_bos_token": "<|vision_start|>",
32
+ "vision_eos_token": "<|vision_end|>"
33
+ },
34
+ "pad_token": "<|endoftext|>",
35
+ "pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
36
+ "processor_class": "MiniCPMV4_6Processor",
37
+ "slice_end_token": "</slice>",
38
+ "slice_start_token": "<slice>",
39
+ "split_special_tokens": false,
40
+ "tokenizer_class": "TokenizersBackend",
41
+ "unk_token": "<unk>",
42
+ "video_token": "<|video_pad|>",
43
+ "vision_bos_token": "<|vision_start|>",
44
+ "vision_eos_token": "<|vision_end|>"
45
+ }