webbrain-one commited on
Commit
1bf438d
·
verified ·
1 Parent(s): 6007caa

Upload private Compass v2 model batch 1/3

Browse files
ATTRIBUTIONS.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Source attributions and project restrictions
2
+
3
+ Base: OpenBMB MiniCPM5-2B, revision 3497c460c89e00520c3cfa2e73f49ab7647f1177,
4
+ Apache-2.0. https://huggingface.co/openbmb/MiniCPM5-2B
5
+ Modified by WebBrain through LoRA training and full-model merging.
6
+ Original authors do not endorse this derived release.
7
+
8
+ Training dataset: https://huggingface.co/datasets/webbrain-one/webbrain-compass-v2-dataset
9
+ Preserve the source attributions, manifests and restrictions in that private repository.
10
+ WebLINX: McGill-NLP contributors, CC BY-NC-SA 4.0.
11
+ https://huggingface.co/datasets/McGill-NLP/weblinx
12
+ https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.en
13
+
14
+ Project policy restricts this derived model to noncommercial research. Preserve
15
+ all source terms, attribution and applicable share-alike obligations. Private
16
+ hosting does not grant commercial rights. This is an experimental release with
17
+ a disclosed failed behavioral gate, not a claim of general safety or success.
LICENSE-BASE-APACHE-2.0.txt 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,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: webbrain-noncommercial-research-restrictions
4
+ license_link: https://huggingface.co/webbrain-one/webbrain-compass-v2/blob/main/ATTRIBUTIONS.md
5
+ library_name: transformers
6
+ base_model: openbmb/MiniCPM5-2B
7
+ tags:
8
+ - experimental
9
+ - web-agent
10
+ - tool-calling
11
+ - lora-merged
12
+ - bf16
13
+ ---
14
+ # WebBrain Compass v2 — experimental private BF16
15
+
16
+ Full merged model weights, **not an adapter**. This experimental release was
17
+ explicitly authorized after disclosure of a failed behavioral gate. It is NOT
18
+ a release that passed every v4 gate. Do not deploy unattended browser actions
19
+ on the strength of these small-suite results.
20
+
21
+ ## Training and representation
22
+
23
+ Base: OpenBMB MiniCPM5-2B, revision
24
+ `3497c460c89e00520c3cfa2e73f49ab7647f1177`. One epoch, 7,311 training examples,
25
+ 213 validation examples, 457 optimizer steps. LoRA r16/alpha32 deltas were
26
+ accumulated in FP32 and parameters cast once to BF16. Native nonpersistent
27
+ rotary-position buffers remain FP32, as in stock Transformers loading.
28
+ No optimizer, RNG state or training examples are included here.
29
+
30
+ ## Candidate-specific evaluation
31
+
32
+ | Metric | This merged BF16 | Native adapter | Historical Qwen3.8-27B |
33
+ |---|---:|---:|---:|
34
+ | Structured first turn | 94/100 | 93/100 | 99/100 |
35
+ | Strict tool and arguments | 16/89 | 15/89 | 17/89 |
36
+ | Loose tool/name credit | 41/89 (46.1%) | 43/89 (48.3%) | 39/89 (43.8%) |
37
+
38
+ Eleven out-of-scope cases are skipped; all other cases, including technical
39
+ errors, stay in the 89-case denominator. This BF16 run had one known
40
+ anti-pattern, zero HTTP/runner errors or timeouts, and **one malformed XML
41
+ response**. The parse failure was not repaired or regraded. The native-adapter
42
+ run had one timeout, retained in its score.
43
+
44
+ **Failed v4 gate: loose >=43/89; observed 41/89.** Other aggregate v4 gates
45
+ passed. The user accepted an experimental/private distribution with this
46
+ limitation disclosed; neither the failed gate nor the original evidence was
47
+ changed. This is separate from numerical weight/reload verification.
48
+
49
+ All 193 frozen input/code hashes and scenario references match between the
50
+ native-adapter and merged-BF16 runs. GPU: RTX 5090; thinking disabled; seed 3407;
51
+ action temperature 0.15, Ask temperature 0.3. No selective retries. These tests
52
+ predict the next response; **browser actions were not executed**, so this is
53
+ not end-to-end task success, general capability equivalence or a safety claim.
54
+
55
+ Qwen figures are historical results from the
56
+ [public routing comparison](https://www.webbrain.one/blog/compact-tool-routing-models-compared).
57
+ Historical/current byte-identical prompts and tools have not been established.
58
+ The small differences do not establish statistical superiority or parity with
59
+ Qwen's broader capabilities. These are not controlled speed comparisons.
60
+
61
+ ## Numerical validation and preserved failures
62
+
63
+ All 294 adapted weight deltas were independently checked against the pinned
64
+ raw base and adapter, with unchanged unadapted weights and finite parameters.
65
+ Eight frozen calibration probes passed FP32 merged/unmerged comparisons
66
+ (maximum absolute logit error <=0.001, relative L2 <=0.0001, identical greedy
67
+ tokens). The saved/reloaded BF16 weight bits, config, tokenizer and template
68
+ match; all eight reload logit comparisons had zero error, and corresponding
69
+ KV-cache decode outputs matched.
70
+
71
+ This is **not numerically identical to unmerged BF16 inference**. Earlier v1/v2
72
+ absolute-logit parity gates failed and remain failed. An earlier v4 reload
73
+ comparison also failed after whole-module casting rounded nonpersistent RoPE
74
+ buffers. An independent diagnostic reproduced that discrepancy exactly by
75
+ changing only those buffers. The frozen v4.2 source casts parameters only and
76
+ preserves FP32 runtime buffers; stored model weight bits are unchanged from
77
+ the earlier v4 candidate. A v4.1 startup attempt failed before inference due
78
+ to Windows source-decoding differences; explicit UTF-8 restored exact frozen
79
+ inputs. None of these failures was deleted or relabeled as a pass.
80
+
81
+ ## Native inference interface
82
+
83
+ Verified runtime: Transformers 5.16.1, PyTorch 2.13.0+cu130, stock
84
+ `LlamaForCausalLM`, with the included tokenizer and chat template. Load with
85
+ `dtype=torch.bfloat16`; do not cast the whole module afterward, which can
86
+ round native FP32 runtime buffers.
87
+
88
+ Use `enable_thinking=False` and `add_generation_prompt=True`. Tool-call
89
+ arguments in conversation history must be dictionaries, not JSON strings.
90
+ Output uses native XML, for example
91
+ `<function name="..."><param name="...">...</param></function>`.
92
+ Do not decode using `skip_special_tokens=True`: it removes tool delimiters.
93
+ Remove only terminal EOS token IDs 1 or 130073. Preserve raw outputs and parse
94
+ complete XML; fail closed on malformed output without repairing arguments.
95
+
96
+ ## Access, attribution and restrictions
97
+
98
+ **Private, experimental, noncommercial/research-only under project policy.**
99
+ The training package includes WebLINX (CC BY-NC-SA 4.0); preserve attribution,
100
+ applicable share-alike requirements and all dataset source obligations.
101
+ The base model is Apache-2.0. Private hosting is not permission for commercial
102
+ use. See ATTRIBUTIONS.md and LICENSE-BASE-APACHE-2.0.txt.
103
+
104
+ The associated dataset is
105
+ [private](https://huggingface.co/datasets/webbrain-one/webbrain-compass-v2-dataset).
106
+ Release provenance, original failed-gate audit, numerical verification and
107
+ explicit experimental authorization are in `provenance/`.
108
+ ONNX requires separate export/runtime verification; these BF16 results must
109
+ not be claimed as measured ONNX results.
chat_template.jinja ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 processed_content = content_parts[0] %}
57
+ {%- set tool_calls_count = message.tool_calls|length %}
58
+ {%- set tool_sep_count = content_parts|length - 1 %}
59
+ {%- set min_count = [tool_calls_count, tool_sep_count]|min %}
60
+
61
+ {%- for i in range(1, content_parts|length) %}
62
+ {%- set tool_index = i - 1 %}
63
+ {%- if tool_index < tool_calls_count %}
64
+ {%- set tool_call = message.tool_calls[tool_index] %}
65
+ {%- if tool_call.function %}
66
+ {%- set tool_call = tool_call.function %}
67
+ {%- endif %}
68
+ {%- set single_tool_xml %}
69
+ {{- '<function name="' ~ tool_call.name ~ '">' }}
70
+ {%- if tool_call.arguments %}
71
+ {%- set args_dict = tool_call.arguments %}
72
+ {%- for param_name, param_value in args_dict.items() %}
73
+ {{- '<param name="' ~ param_name ~ '">' }}
74
+ {%- if param_value is string and ('<' in param_value or '&' in param_value or '\n' in param_value) %}
75
+ {{- '<![CDATA[' + param_value + ']]>' }}
76
+ {%- else %}
77
+ {{- param_value }}
78
+ {%- endif %}
79
+ {{- '</param>' }}
80
+ {%- endfor %}
81
+ {%- endif %}
82
+ {{- '</function>' }}
83
+ {%- endset %}
84
+ {%- set processed_content = processed_content + single_tool_xml + content_parts[i] %}
85
+ {%- else %}
86
+ {%- set processed_content = processed_content + content_parts[i] %}
87
+ {%- endif %}
88
+ {%- endfor %}
89
+
90
+ {%- if tool_calls_count > tool_sep_count %}
91
+ {%- for remaining_index in range(tool_sep_count, tool_calls_count) %}
92
+ {%- set tool_call = message.tool_calls[remaining_index] %}
93
+ {%- if tool_call.function %}
94
+ {%- set tool_call = tool_call.function %}
95
+ {%- endif %}
96
+ {%- set remaining_tool_xml %}
97
+ {{- '<function name="' ~ tool_call.name ~ '">' }}
98
+ {%- if tool_call.arguments %}
99
+ {%- set args_dict = tool_call.arguments %}
100
+ {%- for param_name, param_value in args_dict.items() %}
101
+ {{- '<param name="' ~ param_name ~ '">' }}
102
+ {%- if param_value is string and ('<' in param_value or '&' in param_value or '\n' in param_value) %}
103
+ {{- '<![CDATA[' + param_value + ']]>' }}
104
+ {%- else %}
105
+ {{- param_value }}
106
+ {%- endif %}
107
+ {{- '</param>' }}
108
+ {%- endfor %}
109
+ {%- endif %}
110
+ {{- '</function>' }}
111
+ {%- endset %}
112
+ {%- set processed_content = processed_content + remaining_tool_xml %}
113
+ {%- endfor %}
114
+ {%- endif %}
115
+
116
+ {%- set content = processed_content %}
117
+ {%- endif %}
118
+
119
+ {%- if reasoning_content %}
120
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
121
+ {%- elif '<think>' not in content and '</think>' not in content %}
122
+ {{- '<|im_start|>' + message.role + '\n<think>\n\n</think>\n\n' + content.lstrip('\n') }}
123
+ {%- else %}
124
+ {{- '<|im_start|>' + message.role + '\n' + content }}
125
+ {%- endif %}
126
+
127
+ {%- if message.tool_calls and not has_tool_sep %}
128
+ {%- for tool_call in message.tool_calls %}
129
+ {%- if (loop.first and content) or (not loop.first) %}
130
+ {{- '\n' }}
131
+ {%- endif %}
132
+ {%- if tool_call.function %}
133
+ {%- set tool_call = tool_call.function %}
134
+ {%- endif %}
135
+ {{- '<function name="' ~ tool_call.name ~ '">' }}
136
+ {%- if tool_call.arguments %}
137
+ {%- set args_dict = tool_call.arguments %}
138
+ {%- for param_name, param_value in args_dict.items() %}
139
+ {{- '<param name="' ~ param_name ~ '">' }}
140
+ {%- if param_value is string and ('<' in param_value or '&' in param_value or '\n' in param_value) %}
141
+ {{- '<![CDATA[' + param_value + ']]>' }}
142
+ {%- else %}
143
+ {{- param_value }}
144
+ {%- endif %}
145
+ {{- '</param>' }}
146
+ {%- endfor %}
147
+ {%- endif %}
148
+ {{- '</function>' }}
149
+ {%- endfor %}
150
+ {%- endif %}
151
+ {{- '<|im_end|>\n' }}
152
+ {%- elif message.role == "tool" %}
153
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
154
+ {{- '<|im_start|>user' }}
155
+ {%- endif %}
156
+ {{- '\n<tool_response>\n' }}
157
+ {%- if message.content is string %}
158
+ {{- content }}
159
+ {%- else %}
160
+ {{- message.content | tojson(ensure_ascii=False) }}
161
+ {%- endif %}
162
+ {{- '\n</tool_response>' }}
163
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
164
+ {{- '<|im_end|>\n' }}
165
+ {%- endif %}
166
+ {%- endif %}
167
+ {%- endfor %}
168
+ {%- if add_generation_prompt %}
169
+ {{- '<|im_start|>assistant\n' }}
170
+ {%- if enable_thinking is defined %}
171
+ {%- if enable_thinking is false %}
172
+ {{- '<think>\n\n</think>\n\n' }}
173
+ {%- elif enable_thinking is true %}
174
+ {{- '<think>\n' }}
175
+ {%- endif %}
176
+ {%- endif %}
177
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "LlamaForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 0,
8
+ "dtype": "bfloat16",
9
+ "eos_token_id": [
10
+ 1,
11
+ 130073
12
+ ],
13
+ "head_dim": 128,
14
+ "hidden_act": "silu",
15
+ "hidden_size": 2048,
16
+ "initializer_range": 0.02,
17
+ "intermediate_size": 6144,
18
+ "max_position_embeddings": 131072,
19
+ "mlp_bias": false,
20
+ "model_type": "llama",
21
+ "num_attention_heads": 16,
22
+ "num_hidden_layers": 42,
23
+ "num_key_value_heads": 2,
24
+ "pad_token_id": 1,
25
+ "pretraining_tp": 1,
26
+ "rms_norm_eps": 1e-06,
27
+ "rope_parameters": {
28
+ "rope_theta": 5000000,
29
+ "rope_type": "default"
30
+ },
31
+ "tie_word_embeddings": false,
32
+ "transformers_version": "5.16.1",
33
+ "use_cache": true,
34
+ "vocab_size": 130560
35
+ }
generation_config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "transformers_version": "5.16.1",
10
+ "use_cache": true
11
+ }
model-00001-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7c1987b5447a28eb20bfd3735b2d63e4d5eace5bf143980e72306727ee318a8f
3
+ size 3995365288
model-00002-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a81767b62535403421571c90b1abe4f907101676133d2136407fd5ee35046314
3
+ size 1038191672