rkazants commited on
Commit
fde0780
·
verified ·
1 Parent(s): e918859

Upload 7 files

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
chat_template.jinja ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- macro render_content(content, is_system_content=false) -%}
2
+ {%- if content is string -%}
3
+ {{- content -}}
4
+ {%- elif content is iterable and content is not mapping -%}
5
+ {%- set ns = namespace(parts=[]) -%}
6
+ {%- for item in content -%}
7
+ {%- if 'image' in item or 'image_url' in item or item.type == 'image' -%}
8
+ {%- if is_system_content -%}
9
+ {{- raise_exception('System message cannot contain images.') -}}
10
+ {%- endif -%}
11
+ {%- set ns.parts = ns.parts + ['<|image_pad|>'] -%}
12
+ {%- elif 'video' in item or item.type == 'video' -%}
13
+ {%- if is_system_content -%}
14
+ {{- raise_exception('System message cannot contain videos.') -}}
15
+ {%- endif -%}
16
+ {%- set ns.parts = ns.parts + ['<|video_pad|>'] -%}
17
+ {%- elif 'text' in item -%}
18
+ {%- set ns.parts = ns.parts + [item.text] -%}
19
+ {%- else -%}
20
+ {{- raise_exception('Unexpected item type in content.') -}}
21
+ {%- endif -%}
22
+ {%- endfor -%}
23
+ {{- ns.parts | join('\n') -}}
24
+ {%- elif content is none or content is undefined -%}
25
+ {{- '' -}}
26
+ {%- else -%}
27
+ {{- raise_exception('Unexpected content type.') -}}
28
+ {%- endif -%}
29
+ {%- endmacro -%}
30
+ {%- if not messages %}
31
+ {{- raise_exception('No messages provided.') }}
32
+ {%- endif %}
33
+ {%- if tools and tools is iterable and tools is not mapping %}
34
+ {{- '<|im_start|>system\n' }}
35
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
36
+ {%- for tool in tools %}
37
+ {{- "\n" }}
38
+ {{- tool | tojson }}
39
+ {%- endfor %}
40
+ {{- "\n</tools>" }}
41
+ {{- '\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>' }}
42
+ {%- if messages[0].role == 'system' %}
43
+ {%- set content = render_content(messages[0].content, true)|trim %}
44
+ {%- if content %}
45
+ {{- '\n\n' + content }}
46
+ {%- endif %}
47
+ {%- endif %}
48
+ {{- '<|im_end|>\n' }}
49
+ {%- else %}
50
+ {%- if messages[0].role == 'system' %}
51
+ {%- set content = render_content(messages[0].content, true)|trim %}
52
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
53
+ {%- endif %}
54
+ {%- endif %}
55
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
56
+ {%- for message in messages[::-1] %}
57
+ {%- set index = (messages|length - 1) - loop.index0 %}
58
+ {%- if ns.multi_step_tool and message.role == "user" %}
59
+ {%- set content = render_content(message.content)|trim %}
60
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
61
+ {%- set ns.multi_step_tool = false %}
62
+ {%- set ns.last_query_index = index %}
63
+ {%- endif %}
64
+ {%- endif %}
65
+ {%- endfor %}
66
+ {%- if ns.multi_step_tool %}
67
+ {{- raise_exception('No user query found in messages.') }}
68
+ {%- endif %}
69
+ {%- for message in messages %}
70
+ {%- set content = render_content(message.content)|trim %}
71
+ {%- if message.role == "system" %}
72
+ {%- if not loop.first %}
73
+ {{- raise_exception('System message must be at the beginning.') }}
74
+ {%- endif %}
75
+ {%- elif message.role == "user" %}
76
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
77
+ {%- elif message.role == "assistant" %}
78
+ {%- set reasoning_content = '' %}
79
+ {%- if message.reasoning_content is string %}
80
+ {%- set reasoning_content = message.reasoning_content %}
81
+ {%- else %}
82
+ {%- if '</think>' in content %}
83
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
84
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
85
+ {%- endif %}
86
+ {%- endif %}
87
+ {%- set reasoning_content = reasoning_content|trim %}
88
+ {%- if loop.index0 > ns.last_query_index and reasoning_content %}
89
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
90
+ {%- else %}
91
+ {{- '<|im_start|>' + message.role + '\n<think>\n\n</think>\n\n' + content }}
92
+ {%- endif %}
93
+ {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
94
+ {%- for tool_call in message.tool_calls %}
95
+ {%- if tool_call.function is defined %}
96
+ {%- set tool_call = tool_call.function %}
97
+ {%- endif %}
98
+ {%- if loop.first %}
99
+ {%- if content|trim %}
100
+ {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
101
+ {%- else %}
102
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
103
+ {%- endif %}
104
+ {%- else %}
105
+ {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
106
+ {%- endif %}
107
+ {%- if tool_call.arguments is defined %}
108
+ {%- for args_name, args_value in tool_call.arguments|items %}
109
+ {{- '<parameter=' + args_name + '>\n' }}
110
+ {%- 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 %}
111
+ {{- args_value }}
112
+ {{- '\n</parameter>\n' }}
113
+ {%- endfor %}
114
+ {%- endif %}
115
+ {{- '</function>\n</tool_call>' }}
116
+ {%- endfor %}
117
+ {%- endif %}
118
+ {{- '<|im_end|>\n' }}
119
+ {%- elif message.role == "tool" %}
120
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
121
+ {{- '<|im_start|>user' }}
122
+ {%- endif %}
123
+ {{- '\n<tool_response>\n' }}
124
+ {{- content }}
125
+ {{- '\n</tool_response>' }}
126
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
127
+ {{- '<|im_end|>\n' }}
128
+ {%- elif loop.last %}
129
+ {{- '<|im_end|>\n' }}
130
+ {%- endif %}
131
+ {%- else %}
132
+ {{- raise_exception('Unexpected message role.') }}
133
+ {%- endif %}
134
+ {%- endfor %}
135
+ {%- if add_generation_prompt %}
136
+ {{- '<|im_start|>assistant\n' }}
137
+ {%- if enable_thinking is defined and enable_thinking is false %}
138
+ {{- '<think>\n\n</think>\n\n' }}
139
+ {%- else %}
140
+ {{- '<think>\n' }}
141
+ {%- endif %}
142
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MiniCPMV4_7ForConditionalGeneration"
4
+ ],
5
+ "downsample_mode": "16x",
6
+ "dtype": "float32",
7
+ "image_end_id": null,
8
+ "image_size": 448,
9
+ "image_start_id": null,
10
+ "image_token_id": 248056,
11
+ "insert_layer_id": 1,
12
+ "merge_kernel_size": [
13
+ 2,
14
+ 2
15
+ ],
16
+ "merger_times": 1,
17
+ "model_type": "minicpmv4_7",
18
+ "mrope_mode": "canvas",
19
+ "newline_id": null,
20
+ "patch_size": 14,
21
+ "slice_end_id": null,
22
+ "slice_start_id": null,
23
+ "text_config": {
24
+ "attention_bias": false,
25
+ "attention_dropout": 0.0,
26
+ "attn_output_gate": true,
27
+ "bos_token_id": null,
28
+ "eos_token_id": null,
29
+ "full_attention_interval": 4,
30
+ "head_dim": 32,
31
+ "hidden_act": "silu",
32
+ "hidden_size": 8,
33
+ "initializer_range": 0.02,
34
+ "layer_types": [
35
+ "linear_attention",
36
+ "linear_attention",
37
+ "linear_attention",
38
+ "full_attention"
39
+ ],
40
+ "linear_conv_kernel_dim": 4,
41
+ "linear_key_head_dim": 8,
42
+ "linear_num_key_heads": 2,
43
+ "linear_num_value_heads": 4,
44
+ "linear_value_head_dim": 8,
45
+ "mamba_ssm_dtype": "float32",
46
+ "max_position_embeddings": 262144,
47
+ "model_type": "qwen3_5_moe_text",
48
+ "moe_intermediate_size": 16,
49
+ "mtp_num_hidden_layers": 0,
50
+ "mtp_use_dedicated_embeddings": false,
51
+ "num_attention_heads": 2,
52
+ "num_experts": 8,
53
+ "num_experts_per_tok": 2,
54
+ "num_hidden_layers": 4,
55
+ "num_key_value_heads": 1,
56
+ "output_router_logits": false,
57
+ "pad_token_id": null,
58
+ "partial_rotary_factor": 0.25,
59
+ "rms_norm_eps": 1e-06,
60
+ "rope_parameters": {
61
+ "mrope_interleaved": true,
62
+ "mrope_section": [
63
+ 2,
64
+ 1,
65
+ 1
66
+ ],
67
+ "partial_rotary_factor": 0.25,
68
+ "rope_theta": 10000000,
69
+ "rope_type": "default"
70
+ },
71
+ "router_aux_loss_coef": 0.001,
72
+ "shared_expert_intermediate_size": 16,
73
+ "tie_word_embeddings": true,
74
+ "use_cache": true,
75
+ "vocab_size": 248144
76
+ },
77
+ "tie_word_embeddings": true,
78
+ "transformers_version": "5.18.0.dev0",
79
+ "video_token_id": 248057,
80
+ "vision_config": {
81
+ "attention_dropout": 0.0,
82
+ "hidden_act": "gelu_pytorch_tanh",
83
+ "hidden_size": 16,
84
+ "image_size": 980,
85
+ "insert_layer_id": 1,
86
+ "intermediate_size": 32,
87
+ "layer_norm_eps": 1e-06,
88
+ "model_type": "minicpmv4_7_vision",
89
+ "num_attention_heads": 2,
90
+ "num_channels": 3,
91
+ "num_hidden_layers": 3,
92
+ "patch_size": 14,
93
+ "window_kernel_size": [
94
+ 2,
95
+ 2
96
+ ]
97
+ }
98
+ }
generation_config.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 248045,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 248044,
6
+ 248046
7
+ ],
8
+ "temperature": 1.0,
9
+ "top_k": 20,
10
+ "top_p": 0.95,
11
+ "transformers_version": "5.9.0"
12
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:053d492ffa72433c96658dd1600d204f9c2853c4fb8986194646ba38a5569dd4
3
+ size 8494616
processor_config.json ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "auto_map": {
4
+ "AutoImageProcessor": "image_processing_minicpmv4_7.MiniCPMV4_7ImageProcessor",
5
+ "AutoVideoProcessor": "video_processing_minicpmv4_7.MiniCPMV4_7VideoProcessor"
6
+ },
7
+ "do_convert_rgb": true,
8
+ "do_normalize": true,
9
+ "do_rescale": true,
10
+ "do_resize": true,
11
+ "downsample_mode": "16x",
12
+ "image_mean": [
13
+ 0.5,
14
+ 0.5,
15
+ 0.5
16
+ ],
17
+ "image_processor_type": "MiniCPMV4_6ImageProcessor",
18
+ "image_std": [
19
+ 0.5,
20
+ 0.5,
21
+ 0.5
22
+ ],
23
+ "max_slice_nums": 9,
24
+ "mrope_mode": "canvas",
25
+ "patch_size": 14,
26
+ "resample": 3,
27
+ "rescale_factor": 0.00392156862745098,
28
+ "scale_resolution": 448,
29
+ "slice_mode": true,
30
+ "use_image_id": true
31
+ },
32
+ "processor_class": "MiniCPMV4_7Processor",
33
+ "video_processor": {
34
+ "auto_map": {
35
+ "AutoImageProcessor": "image_processing_minicpmv4_7.MiniCPMV4_7ImageProcessor",
36
+ "AutoVideoProcessor": "video_processing_minicpmv4_7.MiniCPMV4_7VideoProcessor"
37
+ },
38
+ "do_convert_rgb": true,
39
+ "do_normalize": true,
40
+ "do_rescale": true,
41
+ "do_resize": true,
42
+ "do_sample_frames": true,
43
+ "downsample_mode": "16x",
44
+ "image_mean": [
45
+ 0.5,
46
+ 0.5,
47
+ 0.5
48
+ ],
49
+ "image_std": [
50
+ 0.5,
51
+ 0.5,
52
+ 0.5
53
+ ],
54
+ "max_num_frames": 128,
55
+ "max_slice_nums": 9,
56
+ "mrope_mode": "canvas",
57
+ "patch_size": 14,
58
+ "resample": 3,
59
+ "rescale_factor": 0.00392156862745098,
60
+ "return_metadata": false,
61
+ "scale_resolution": 448,
62
+ "slice_mode": true,
63
+ "stack_frames": 1,
64
+ "use_image_id": true,
65
+ "video_processor_type": "MiniCPMV4_6VideoProcessor"
66
+ }
67
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e4608c5d7b3f4f30ba83be16a82cdac856b2e7191d40f0a08cbacc76c2a926ee
3
+ size 20001935
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_7Processor",
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
+ }