Mike0021 commited on
Commit
04a6c49
·
verified ·
1 Parent(s): 6c84b93

Publish independently converted and validated MiniCPM5-2B q4f16

Browse files
.gitattributes CHANGED
@@ -33,3 +33,10 @@ 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
+ onnx/model_q4f16.onnx_data filter=lfs diff=lfs merge=lfs -text
37
+ onnx/model_q4f16.onnx_data_1 filter=lfs diff=lfs merge=lfs -text
38
+ onnx/model_q4f16.onnx_data_2 filter=lfs diff=lfs merge=lfs -text
39
+ onnx/model_q4f16.onnx_data_3 filter=lfs diff=lfs merge=lfs -text
40
+ onnx/model_q4f16.onnx_data_4 filter=lfs diff=lfs merge=lfs -text
41
+ onnx/model_q4f16.onnx_data_5 filter=lfs diff=lfs merge=lfs -text
42
+ onnx/model_q4f16.onnx_data_6 filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: transformers.js
4
+ pipeline_tag: text-generation
5
+ base_model: openbmb/MiniCPM5-2B
6
+ tags:
7
+ - onnx
8
+ - webgpu
9
+ - int4
10
+ ---
11
+
12
+ # MiniCPM5-2B ONNX for browser WebGPU
13
+
14
+ Independently converted from the pinned official checkpoint. Try the [browser demo](https://huggingface.co/spaces/Mike0021/MiniCPM5-2B-WebGPU); its repository contains conversion scripts and validation evidence.
15
+
16
+ ## Our conversion
17
+
18
+ The included `q4f16` model was converted directly from the official [OpenBMB MiniCPM5-2B BF16 checkpoint](https://huggingface.co/openbmb/MiniCPM5-2B/tree/abe115e887989b14f05e64a3b260648329324c3f), not from community-converted weights.
19
+
20
+ - Source revision: `abe115e887989b14f05e64a3b260648329324c3f`.
21
+ - Official weight SHA-256, verified before conversion: `14fb8e7f0a18d53d1f239773758bf581cee7e456a4523a54622c3a245b64402c`.
22
+ - ONNX Runtime GenAI 0.15.2; symmetric int4, block size 32; FP16 activations and KV cache.
23
+ - Fused QKV, GQA, RoPE, and normalization operations.
24
+ - Last-position logits selected before the output projection.
25
+ - Lossless splitting of the 510 MiB embedding allocation into four 127.5 MiB tensors.
26
+ - Seven external-data shards; corrected tool-history serialization and Jinja compatibility.
27
+
28
+ The [package manifest](manifest.json) contains file sizes and SHA-256 hashes.
29
+
30
+ ## Validation
31
+
32
+ Six prompts with prefill and cached decoding give 41 tested prediction positions. These are scoped conversion checks, not a broad quality evaluation.
33
+
34
+ | Comparison | Top-token agreement | Mean KL divergence |
35
+ |---|---:|---:|
36
+ | FP16 ONNX vs FP16 PyTorch | 41/41 | 0.00000815 |
37
+ | Int4 ONNX vs official BF16 PyTorch | 36/41 | 0.125916 |
38
+ | Packaged int4 vs our original int4 export | 41/41; all logits bit-identical | 0 |
39
+ | Browser WebGPU vs native packaged ONNX | 41/41 | 0.002517 |
40
+
41
+ Local Chromium tests on an AMD Radeon 8060S covered streaming, stopping, thinking mode, XML tool-call generation, and one retrieval fixture at 3,888 prompt tokens. Inference also passed with the GPU device capped at a 128 MiB storage binding limit and 256 MiB buffer limit. This desktop allocation test does not emulate a phone's memory pressure or thermals.
42
+
43
+ Warm local benchmark medians were about 35–42 decode tokens/s. At 1,890 prompt tokens, first-token latency improved about 9.5% against our own identical-weight control with all-position logits and unsplit embeddings. Timings depend on device, browser, prompt, and thermal state. See [raw validation summaries](https://huggingface.co/spaces/Mike0021/MiniCPM5-2B-WebGPU/tree/main/validation).
44
+
45
+ Four-bit quantization has measurable quality loss. The base model also makes mistakes: one Chinese arithmetic prompt produced an incorrect answer in both the official BF16 model and the conversion. This Space is an inference demo, not an autonomous agent or a guarantee of accurate answers. Tool calls are XML; the demo does not execute them.
46
+
chat_template.jinja ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- bos_token }}{%- if tools %}
2
+ {%- set tool_definitions %}
3
+ {{- "# Tools\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
4
+ {%- for tool in tools %}
5
+ {{- "\n" }}
6
+ {{- tool | tojson(ensure_ascii=False) }}
7
+ {%- endfor %}
8
+ {{- '\n</tools>\n\nTool usage guidelines:\n- You may call zero or more functions. If no function calls are needed, just answer normally and do not include any <function ... </function>.\n- When calling a function, return an XML object within <function ... </function> using:\n<function name="function-name"><param name="param-name">param-value</param></function>\n- param-value may be multi-line. If it contains <, & or newline characters, wrap it in a CDATA block: <param name="param-name"><![CDATA[...multi-line value...]]></param>' }}
9
+ {%- endset %}
10
+
11
+ {{- '<|im_start|>system\n' }}
12
+ {%- if messages[0].role == 'system' %}
13
+ {%- if '<tool_def_sep>' in messages[0].content %}
14
+ {{- messages[0].content.replace('<tool_def_sep>', tool_definitions) }}
15
+ {%- else %}
16
+ {{- messages[0].content + '\n\n' + tool_definitions }}
17
+ {%- endif %}
18
+ {%- else %}
19
+ {{- tool_definitions.lstrip() }}
20
+ {%- endif %}
21
+ {{- '<|im_end|>\n' }}
22
+ {%- else %}
23
+ {%- if messages[0].role == 'system' %}
24
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
25
+ {%- endif %}
26
+ {%- endif %}
27
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
28
+ {%- for message in messages[::-1] %}
29
+ {%- set index = (messages|length - 1) - loop.index0 %}
30
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
31
+ {%- set ns.multi_step_tool = false %}
32
+ {%- set ns.last_query_index = index %}
33
+ {%- endif %}
34
+ {%- endfor %}
35
+ {%- for message in messages %}
36
+ {%- if message.content is string %}
37
+ {%- set content = message.content %}
38
+ {%- else %}
39
+ {%- set content = '' %}
40
+ {%- endif %}
41
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
42
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
43
+ {%- elif message.role == "assistant" %}
44
+ {%- set reasoning_content = '' %}
45
+ {%- if message.reasoning_content is string %}
46
+ {%- set reasoning_content = message.reasoning_content %}
47
+ {%- else %}
48
+ {%- if '</think>' in content %}
49
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
50
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
51
+ {%- endif %}
52
+ {%- endif %}
53
+
54
+ {%- if message.tool_calls %}
55
+ {%- set content_parts = content.split('<tool_sep>') %}
56
+ {%- set rendered_tool = namespace(content=content_parts[0]) %}
57
+ {%- set tool_calls_count = message.tool_calls|length %}
58
+ {%- set tool_sep_count = content_parts|length - 1 %}
59
+
60
+ {%- for i in range(1, content_parts|length) %}
61
+ {%- set tool_index = i - 1 %}
62
+ {%- if tool_index < tool_calls_count %}
63
+ {%- set tool_call = message.tool_calls[tool_index] %}
64
+ {%- if tool_call.function %}
65
+ {%- set tool_call = tool_call.function %}
66
+ {%- endif %}
67
+ {%- set single_tool_xml %}
68
+ {{- '<function name="' ~ tool_call.name ~ '">' }}
69
+ {%- if tool_call.arguments %}
70
+ {%- set args_dict = tool_call.arguments %}
71
+ {%- for param_name, param_value in args_dict.items() %}
72
+ {{- '<param name="' ~ param_name ~ '">' }}
73
+ {%- if param_value is string and ('<' in param_value or '&' in param_value or '\n' in param_value) %}
74
+ {{- '<![CDATA[' + param_value.replace(']]>', ']]]]><![CDATA[>') + ']]>' }}
75
+ {%- elif param_value is string %}
76
+ {{- param_value }}
77
+ {%- else %}
78
+ {{- param_value | tojson }}
79
+ {%- endif %}
80
+ {{- '</param>' }}
81
+ {%- endfor %}
82
+ {%- endif %}
83
+ {{- '</function>' }}
84
+ {%- endset %}
85
+ {%- set rendered_tool.content = rendered_tool.content + single_tool_xml + content_parts[i] %}
86
+ {%- else %}
87
+ {%- set rendered_tool.content = rendered_tool.content + content_parts[i] %}
88
+ {%- endif %}
89
+ {%- endfor %}
90
+
91
+ {%- if tool_calls_count > tool_sep_count %}
92
+ {%- for remaining_index in range(tool_sep_count, tool_calls_count) %}
93
+ {%- set tool_call = message.tool_calls[remaining_index] %}
94
+ {%- if tool_call.function %}
95
+ {%- set tool_call = tool_call.function %}
96
+ {%- endif %}
97
+ {%- set remaining_tool_xml %}
98
+ {{- '<function name="' ~ tool_call.name ~ '">' }}
99
+ {%- if tool_call.arguments %}
100
+ {%- set args_dict = tool_call.arguments %}
101
+ {%- for param_name, param_value in args_dict.items() %}
102
+ {{- '<param name="' ~ param_name ~ '">' }}
103
+ {%- if param_value is string and ('<' in param_value or '&' in param_value or '\n' in param_value) %}
104
+ {{- '<![CDATA[' + param_value.replace(']]>', ']]]]><![CDATA[>') + ']]>' }}
105
+ {%- elif param_value is string %}
106
+ {{- param_value }}
107
+ {%- else %}
108
+ {{- param_value | tojson }}
109
+ {%- endif %}
110
+ {{- '</param>' }}
111
+ {%- endfor %}
112
+ {%- endif %}
113
+ {{- '</function>' }}
114
+ {%- endset %}
115
+ {%- set rendered_tool.content = rendered_tool.content + remaining_tool_xml %}
116
+ {%- endfor %}
117
+ {%- endif %}
118
+
119
+ {%- set content = rendered_tool.content %}
120
+ {%- endif %}
121
+
122
+ {%- if reasoning_content %}
123
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
124
+ {%- elif '<think>' not in content and '</think>' not in content %}
125
+ {{- '<|im_start|>' + message.role + '\n<think>\n\n</think>\n\n' + content.lstrip('\n') }}
126
+ {%- else %}
127
+ {{- '<|im_start|>' + message.role + '\n' + content }}
128
+ {%- endif %}
129
+
130
+ {{- '<|im_end|>\n' }}
131
+ {%- elif message.role == "tool" %}
132
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
133
+ {{- '<|im_start|>user' }}
134
+ {%- endif %}
135
+ {{- '\n<tool_response>\n' }}
136
+ {%- if message.content is string %}
137
+ {{- content }}
138
+ {%- else %}
139
+ {{- message.content | tojson(ensure_ascii=False) }}
140
+ {%- endif %}
141
+ {{- '\n</tool_response>' }}
142
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
143
+ {{- '<|im_end|>\n' }}
144
+ {%- endif %}
145
+ {%- endif %}
146
+ {%- endfor %}
147
+ {%- if add_generation_prompt %}
148
+ {{- '<|im_start|>assistant\n' }}
149
+ {%- if enable_thinking is defined %}
150
+ {%- if enable_thinking is false %}
151
+ {{- '<think>\n\n</think>\n\n' }}
152
+ {%- elif enable_thinking is true %}
153
+ {{- '<think>\n' }}
154
+ {%- endif %}
155
+ {%- endif %}
156
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "openbmb/MiniCPM5-2B",
3
+ "architectures": [
4
+ "LlamaForCausalLM"
5
+ ],
6
+ "bos_token_id": 0,
7
+ "eos_token_id": [
8
+ 1,
9
+ 130073
10
+ ],
11
+ "pad_token_id": 1,
12
+ "hidden_act": "silu",
13
+ "hidden_size": 2048,
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 6144,
16
+ "max_position_embeddings": 131072,
17
+ "model_type": "llama",
18
+ "num_attention_heads": 16,
19
+ "num_hidden_layers": 42,
20
+ "num_key_value_heads": 2,
21
+ "head_dim": 128,
22
+ "rms_norm_eps": 1e-06,
23
+ "rope_theta": 5000000,
24
+ "rope_scaling": null,
25
+ "tie_word_embeddings": false,
26
+ "torch_dtype": "bfloat16",
27
+ "transformers_version": "5.6.2",
28
+ "use_cache": true,
29
+ "vocab_size": 130560,
30
+ "transformers.js_config": {
31
+ "kv_cache_dtype": {
32
+ "q4f16": "float16"
33
+ },
34
+ "use_external_data_format": {
35
+ "model_q4f16.onnx": 7
36
+ }
37
+ }
38
+ }
generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "eos_token_id": [
5
+ 1,
6
+ 130073
7
+ ],
8
+ "pad_token_id": 1,
9
+ "do_sample": true,
10
+ "temperature": 1.0,
11
+ "top_p": 0.95,
12
+ "transformers_version": "5.6.2"
13
+ }
manifest.json ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source": {
3
+ "repo": "openbmb/MiniCPM5-2B",
4
+ "revision": "abe115e887989b14f05e64a3b260648329324c3f",
5
+ "files": {
6
+ "config.json": {
7
+ "bytes": 704,
8
+ "sha256": "59613157e5357d62bcb121e04cb90f2170b43d789b142380c12c3d4277d95180"
9
+ },
10
+ "generation_config.json": {
11
+ "bytes": 213,
12
+ "sha256": "9ac4f32e5f32358697a9f438a3ea89ef80e6ba786c72c49e932f9f21c122fdb1"
13
+ },
14
+ "tokenizer.json": {
15
+ "bytes": 9894271,
16
+ "sha256": "3e065a558a034185fe299917b398685c1facd0169a9eea1e629eb30c171fed81"
17
+ },
18
+ "tokenizer_config.json": {
19
+ "bytes": 94391,
20
+ "sha256": "e9b1064649e771d7a8e15637c68b2d2749724877ba3648bd74a4ece31c26303b"
21
+ },
22
+ "special_tokens_map.json": {
23
+ "bytes": 551,
24
+ "sha256": "82d96d7a9e6ced037f12394b7ea6a5b02e6ca87e0d11edaa8d60d9be857ce7db"
25
+ },
26
+ "chat_template.jinja": {
27
+ "bytes": 9060,
28
+ "sha256": "cc945752db555d60949b16989df4ccfeb52a313d6b4b5c5229dd786e2e9fcf1c"
29
+ },
30
+ "model.safetensors.index.json": {
31
+ "bytes": 31378,
32
+ "sha256": "6d839cd76e8395de548a0e6cc310386f66d1ecbb2c75d198a8dfd3d70892b756"
33
+ },
34
+ "model-00000-of-00001.safetensors": {
35
+ "bytes": 5033557096,
36
+ "sha256": "14fb8e7f0a18d53d1f239773758bf581cee7e456a4523a54622c3a245b64402c"
37
+ }
38
+ }
39
+ },
40
+ "changes": [
41
+ "last-position LM head at export",
42
+ "four lossless embedding column shards",
43
+ "concrete cache head dimensions",
44
+ "template serialization and compatibility"
45
+ ],
46
+ "graph_nodes": 480,
47
+ "external_chunks": 7,
48
+ "files": {
49
+ "chat_template.jinja": {
50
+ "bytes": 8154,
51
+ "sha256": "48636abac6ea1ae7442893ee234e55cce5d45c770ddcc87476555fbf4efde8fe"
52
+ },
53
+ "config.json": {
54
+ "bytes": 822,
55
+ "sha256": "9103173d5af7567b80f15914f95205652f6475f459e843fdc47a4bbb5bdadade"
56
+ },
57
+ "generation_config.json": {
58
+ "bytes": 213,
59
+ "sha256": "9ac4f32e5f32358697a9f438a3ea89ef80e6ba786c72c49e932f9f21c122fdb1"
60
+ },
61
+ "onnx/model_q4f16.onnx": {
62
+ "bytes": 318519,
63
+ "sha256": "d83a86b8ae2566b5bdde23fae366f94a35383f3aefdf3300f138e6dde4ad9d57"
64
+ },
65
+ "onnx/model_q4f16.onnx_data": {
66
+ "bytes": 265703424,
67
+ "sha256": "57ad7c0aef4bdb7ea57ae34f5f2327b88de701c65b52a45b5dc94ff9af1bb985"
68
+ },
69
+ "onnx/model_q4f16.onnx_data_1": {
70
+ "bytes": 265420800,
71
+ "sha256": "19e766345e32a1f1162ab1d418583d94643c01c5ea89b4160c1e68afeca5cfe4"
72
+ },
73
+ "onnx/model_q4f16.onnx_data_2": {
74
+ "bytes": 265420800,
75
+ "sha256": "a83508febe793e70a5c2ce13d7fe029ee5116f33d69863c75a17343caf72ca56"
76
+ },
77
+ "onnx/model_q4f16.onnx_data_3": {
78
+ "bytes": 265420800,
79
+ "sha256": "5d5e46728e6101139e5e8527a0d192a5552393d74f6075f7ffee28fd5881ef0b"
80
+ },
81
+ "onnx/model_q4f16.onnx_data_4": {
82
+ "bytes": 237109248,
83
+ "sha256": "62fe730b14bc33fce8fafa4797b43579abc9b366ec30fb966ba9daad8243be5a"
84
+ },
85
+ "onnx/model_q4f16.onnx_data_5": {
86
+ "bytes": 267386880,
87
+ "sha256": "87c6ba0cd37a3bbbbcba46f33a4adf44214ad9d06854e6cd49e67a03769c1df1"
88
+ },
89
+ "onnx/model_q4f16.onnx_data_6": {
90
+ "bytes": 267386880,
91
+ "sha256": "1b054f4046373d1a4f8c4a70421472e4f6b8fc419151e6911ffe33f8614bb77c"
92
+ },
93
+ "special_tokens_map.json": {
94
+ "bytes": 551,
95
+ "sha256": "82d96d7a9e6ced037f12394b7ea6a5b02e6ca87e0d11edaa8d60d9be857ce7db"
96
+ },
97
+ "tokenizer.json": {
98
+ "bytes": 9894271,
99
+ "sha256": "3e065a558a034185fe299917b398685c1facd0169a9eea1e629eb30c171fed81"
100
+ },
101
+ "tokenizer_config.json": {
102
+ "bytes": 102804,
103
+ "sha256": "36b50abe63f32fc16e21a2ab30af359601915c6d2e58d7466629458adc2492a1"
104
+ }
105
+ }
106
+ }
onnx/model_q4f16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d83a86b8ae2566b5bdde23fae366f94a35383f3aefdf3300f138e6dde4ad9d57
3
+ size 318519
onnx/model_q4f16.onnx_data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:57ad7c0aef4bdb7ea57ae34f5f2327b88de701c65b52a45b5dc94ff9af1bb985
3
+ size 265703424
onnx/model_q4f16.onnx_data_1 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:19e766345e32a1f1162ab1d418583d94643c01c5ea89b4160c1e68afeca5cfe4
3
+ size 265420800
onnx/model_q4f16.onnx_data_2 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a83508febe793e70a5c2ce13d7fe029ee5116f33d69863c75a17343caf72ca56
3
+ size 265420800
onnx/model_q4f16.onnx_data_3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5d5e46728e6101139e5e8527a0d192a5552393d74f6075f7ffee28fd5881ef0b
3
+ size 265420800
onnx/model_q4f16.onnx_data_4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62fe730b14bc33fce8fafa4797b43579abc9b366ec30fb966ba9daad8243be5a
3
+ size 237109248
onnx/model_q4f16.onnx_data_5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:87c6ba0cd37a3bbbbcba46f33a4adf44214ad9d06854e6cd49e67a03769c1df1
3
+ size 267386880
onnx/model_q4f16.onnx_data_6 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b054f4046373d1a4f8c4a70421472e4f6b8fc419151e6911ffe33f8614bb77c
3
+ size 267386880
special_tokens_map.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "unk_token": {
24
+ "content": "<unk>",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ }
30
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff