yiqichen01 commited on
Commit
b53bd70
·
verified ·
1 Parent(s): 0de7283

Upload folder using huggingface_hub

Browse files
chat_template.jinja ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {# ----------‑‑‑ special token variables ‑‑‑---------- #}
2
+ {%- set HYTK = '' %}
3
+ {%- set bos_token = '<|hy_begin▁of▁sentence|>' %}
4
+ {%- set pad_token = '<|hy_▁pad▁|>' %}
5
+ {%- set user_token = '<|hy_User|>' %}
6
+ {%- set assistant_token = '<|hy_Assistant|>' %}
7
+ {%- set eos_token = '<eos:6124c78e>' %}
8
+ {# ----------‑‑‑ tokens with md5 encoding (conditional on HYTK) ‑‑‑---------- #}
9
+ {%- if HYTK %}
10
+ {%- set think_begin_token = '<think:{}>'.format(HYTK) %}
11
+ {%- set think_end_token = '</think:{}>'.format(HYTK) %}
12
+ {%- set toolcalls_begin_token = '<tool_calls:{}>'.format(HYTK) %}
13
+ {%- set toolcalls_end_token = '</tool_calls:{}>'.format(HYTK) %}
14
+ {%- set toolcall_begin_token = '<tool_call:{}>'.format(HYTK) %}
15
+ {%- set toolcall_end_token = '</tool_call:{}>'.format(HYTK) %}
16
+ {%- set toolsep_token = '<tool_sep:{}>'.format(HYTK) %}
17
+ {%- set argkey_begin_token = '<arg_key:{}>'.format(HYTK) %}
18
+ {%- set argkey_end_token = '</arg_key:{}>'.format(HYTK) %}
19
+ {%- set argvalue_begin_token = '<arg_value:{}>'.format(HYTK) %}
20
+ {%- set argvalue_end_token = '</arg_value:{}>'.format(HYTK) %}
21
+ {%- set toolresponses_begin_token = '<tool_responses:{}>'.format(HYTK) %}
22
+ {%- set toolresponses_end_token = '</tool_responses:{}>'.format(HYTK) %}
23
+ {%- set toolresponse_begin_token = '<tool_response:{}>'.format(HYTK) %}
24
+ {%- set toolresponse_end_token = '</tool_response:{}>'.format(HYTK) %}
25
+ {%- set reasoning_mode_token = '<|reasoning_mode|>' %}
26
+ {%- set toolcalls_begin_ds_token = '<|tool▁calls▁begin|>' %}
27
+ {%- set toolcalls_end_ds_token = '<|tool▁calls▁end|>' %}
28
+ {%- set toolcall_begin_ds_token = '<|tool▁call▁begin|>' %}
29
+ {%- set toolcall_end_ds_token = '<|tool▁call▁end|>' %}
30
+ {%- set toolsep_ds_token = '<|tool▁sep|>' %}
31
+ {%- set tooloutput_begin_ds_token = '<|tool▁output▁begin|>' %}
32
+ {%- set tooloutput_end_ds_token = '<|tool▁output▁end|>' %}
33
+ {%- else %}
34
+ {%- set think_begin_token = '<think>' %}
35
+ {%- set think_end_token = '</think>' %}
36
+ {%- set toolcalls_begin_token = '<tool_calls>' %}
37
+ {%- set toolcalls_end_token = '</tool_calls>' %}
38
+ {%- set toolcall_begin_token = '<tool_call>' %}
39
+ {%- set toolcall_end_token = '</tool_call>' %}
40
+ {%- set toolsep_token = '<tool_sep>' %}
41
+ {%- set argkey_begin_token = '<arg_key>' %}
42
+ {%- set argkey_end_token = '</arg_key>' %}
43
+ {%- set argvalue_begin_token = '<arg_value>' %}
44
+ {%- set argvalue_end_token = '</arg_value>' %}
45
+ {%- set toolresponses_begin_token = '<tool_responses>' %}
46
+ {%- set toolresponses_end_token = '</tool_responses>' %}
47
+ {%- set toolresponse_begin_token = '<tool_response>' %}
48
+ {%- set toolresponse_end_token = '</tool_response>' %}
49
+ {%- set reasoning_mode_token = '<|reasoning_mode|>' %}
50
+ {%- set toolcalls_begin_ds_token = '<|tool▁calls▁begin|>' %}
51
+ {%- set toolcalls_end_ds_token = '<|tool▁calls▁end|>' %}
52
+ {%- set toolcall_begin_ds_token = '<|tool▁call▁begin|>' %}
53
+ {%- set toolcall_end_ds_token = '<|tool▁call▁end|>' %}
54
+ {%- set toolsep_ds_token = '<|tool▁sep|>' %}
55
+ {%- set tooloutput_begin_ds_token = '<|tool▁output▁begin|>' %}
56
+ {%- set tooloutput_end_ds_token = '<|tool▁output▁end|>' %}
57
+ {%- endif %}
58
+ {# ----------‑‑‑ hyperparameters variables ‑‑‑---------- #}
59
+ {%- if not add_generation_prompt is defined %}
60
+ {%- set add_generation_prompt = false %}
61
+ {%- endif %}
62
+ {%- if not interleaved_thinking is defined %}
63
+ {%- set interleaved_thinking = false %}
64
+ {%- endif %}
65
+ {%- if not tools %}
66
+ {%- set interleaved_thinking = false %}
67
+ {%- endif %}
68
+ {%- if not is_training is defined %}
69
+ {%- set is_training = false %}
70
+ {%- endif %}
71
+ {%- if not is_ai_search is defined %}
72
+ {%- set is_ai_search = false %}
73
+ {%- endif %}
74
+ {%- if not reasoning_effort is defined or reasoning_effort not in ['high', 'low', 'no_think'] %}
75
+ {%- set reasoning_effort = 'no_think' %}
76
+ {%- endif %}
77
+
78
+ {%- macro visible_text(content) -%}
79
+ {%- if content is string -%}
80
+ {{- content }}
81
+ {%- elif content is iterable and content is not mapping -%}
82
+ {%- for item in content -%}
83
+ {%- if item is mapping and item.type == 'text' -%}
84
+ {{- item.text }}
85
+ {%- elif item is string -%}
86
+ {{- item }}
87
+ {%- endif -%}
88
+ {%- endfor -%}
89
+ {%- elif content is none -%}
90
+ {{- '' }}
91
+ {%- else -%}
92
+ {{- content }}
93
+ {%- endif -%}
94
+ {%- endmacro -%}
95
+
96
+ {%- set ns = namespace(last_user_index=-1) %}
97
+ {%- set sp_ns = namespace(system_prompt='', is_first_sp=true) %}
98
+ {%- for message in messages %}
99
+ {%- if message['role'] == 'system' %}
100
+ {%- set sp_ns.system_prompt = sp_ns.system_prompt + visible_text(message['content']) %}
101
+ {%- endif %}
102
+ {%- if message['role'] == 'user' %}
103
+ {%- set ns.last_user_index = loop.index0 %}
104
+ {%- endif %}
105
+ {%- endfor %}
106
+ {%- if reasoning_effort is defined and reasoning_effort is string and reasoning_effort != '' and not tools %}
107
+ {%- set sp_ns.system_prompt = sp_ns.system_prompt + reasoning_mode_token + 'reasoning_effort:' + reasoning_effort %}
108
+ {%- endif %}
109
+ {{- bos_token }}
110
+ {{- sp_ns.system_prompt }}
111
+ {%- if tools %}
112
+ {%- if sp_ns.system_prompt != '' %}
113
+ {{- '\n\n# Tools\n\nYou may call one or more functions to assist with the user query.' }}
114
+ {%- else %}
115
+ {{- '# Tools\n\nYou may call one or more functions to assist with the user query.' }}
116
+ {%- endif %}
117
+ {{- '\n\nYou are provided with function signatures within <tools></tools> XML tags:' }}
118
+ {{- '\n<tools>\n' }}
119
+ {%- for tool in tools %}
120
+ {%- if loop.index0 > 0 %}
121
+ {{- '\n' }}
122
+ {%- endif %}
123
+ {{- tool | tojson }}
124
+ {%- endfor %}
125
+ {{- '\n</tools>\n\n' }}
126
+ {{- 'For function call returns, you should first print ' + toolcalls_begin_token + '\n' }}
127
+ {{- 'For each function call, you should return object like:\n' }}
128
+ {{- toolcall_begin_token + '{function-name}' + toolsep_token + '\n' }}
129
+ {{- argkey_begin_token + '{arg-key-1}' + argkey_end_token + '\n' }}
130
+ {{- argvalue_begin_token + '{arg-value-1}' + argvalue_end_token + '\n' }}
131
+ {{- argkey_begin_token + '{arg-key-2}' + argkey_end_token + '\n' }}
132
+ {{- argvalue_begin_token + '{arg-value-2}' + argvalue_end_token + '\n' }}
133
+ {{- '...\n' }}
134
+ {{- toolcall_end_token + '\n' }}
135
+ {%- if reasoning_effort is defined and reasoning_effort is string and reasoning_effort != '' %}
136
+ {{- 'At the end of function call returns, you should print ' + toolcalls_end_token + reasoning_mode_token + 'reasoning_effort:' + reasoning_effort }}
137
+ {%- else %}
138
+ {{- 'At the end of function call returns, you should print ' + toolcalls_end_token }}
139
+ {%- endif %}
140
+ {%- endif %}
141
+
142
+ {%- set prev_ns = namespace(is_tool=false, is_tool_first=true) %}
143
+ {%- set last_ns = namespace(last_is_assistant=false) %}
144
+ {%- for message in messages %}
145
+ {%- if message['role'] == 'user' %}
146
+ {%- if prev_ns.is_tool and not is_ai_search %}
147
+ {{- toolresponses_end_token }}
148
+ {%- endif %}
149
+ {{- user_token + visible_text(message['content']) }}
150
+ {%- set prev_ns.is_tool = false %}
151
+ {%- endif %}
152
+ {%- if message['role'] == 'assistant' %}
153
+ {%- if is_training %}
154
+ {%- if 'reasoning_content' in message and message['reasoning_content'] is string %}
155
+ {%- set content = think_begin_token + message['reasoning_content'] + think_end_token + visible_text(message['content']) %}
156
+ {%- else %}
157
+ {%- set content = think_begin_token + think_end_token + visible_text(message['content']) %}
158
+ {%- endif %}
159
+ {%- else %}
160
+ {%- if interleaved_thinking %}
161
+ {%- if loop.index0 > ns.last_user_index and 'reasoning_content' in message and message['reasoning_content'] is string %}
162
+ {%- set content = think_begin_token + message['reasoning_content'] + think_end_token + visible_text(message['content']) %}
163
+ {%- else %}
164
+ {%- set content = think_begin_token + think_end_token + visible_text(message['content']) %}
165
+ {%- endif %}
166
+ {%- else %}
167
+ {%- set content = think_begin_token + think_end_token + visible_text(message['content']) %}
168
+ {%- endif %}
169
+ {%- endif %}
170
+ {%- if prev_ns.is_tool and not is_ai_search %}
171
+ {{- toolresponses_end_token }}
172
+ {%- endif %}
173
+ {{- assistant_token }}
174
+ {%- if message['tool_calls'] is defined and message['tool_calls'] %}
175
+ {%- set prev_ns.is_tool_first = true %}
176
+ {{- content }}
177
+ {{- toolcalls_begin_token + '\n' }}
178
+ {%- for tool in message['tool_calls'] %}
179
+ {%- set arguments = tool['function']['arguments'] %}
180
+ {{- toolcall_begin_token + tool['function']['name'] + toolsep_token + '\n' }}
181
+ {%- for key, value in arguments.items() %}
182
+ {{- argkey_begin_token + key + argkey_end_token + '\n' }}
183
+ {%- if value is not string %}
184
+ {%- set value = value | tojson(ensure_ascii=False) %}
185
+ {%- endif %}
186
+ {{- argvalue_begin_token + value + argvalue_end_token + '\n' }}
187
+ {%- endfor %}
188
+ {{- toolcall_end_token + '\n' }}
189
+ {%- endfor %}
190
+ {{- toolcalls_end_token + eos_token }}
191
+ {%- else %}
192
+ {%- if not loop.last or is_training %}
193
+ {{- content + eos_token }}
194
+ {%- else %}
195
+ {{- content }}
196
+ {%- endif %}
197
+ {%- endif %}
198
+ {%- set prev_ns.is_tool = false %}
199
+ {%- endif %}
200
+ {%- if message['role'] == 'tool' %}
201
+ {%- set prev_ns.is_tool = true %}
202
+ {%- if prev_ns.is_tool_first and not is_ai_search %}
203
+ {{- toolresponses_begin_token + '\n' }}
204
+ {%- set prev_ns.is_tool_first = false %}
205
+ {%- endif %}
206
+ {%- if is_ai_search %}
207
+ {{- tooloutput_begin_ds_token + visible_text(message['content']) + tooloutput_end_ds_token }}
208
+ {%- else %}
209
+ {{- toolresponse_begin_token + '\n' + visible_text(message['content']) + '\n' + toolresponse_end_token + '\n' }}
210
+ {%- endif %}
211
+ {%- endif %}
212
+ {%- if loop.last and message['role'] == 'assistant' %}
213
+ {%- set last_ns.last_is_assistant = true %}
214
+ {%- endif %}
215
+
216
+ {%- endfor %}
217
+ {%- if prev_ns.is_tool and not is_ai_search %}
218
+ {{- toolresponses_end_token }}
219
+ {%- endif %}
220
+ {%- if add_generation_prompt %}
221
+ {%- if not last_ns.last_is_assistant %}
222
+ {%- if is_ai_search %}
223
+ {{- assistant_token }}
224
+ {{- think_begin_token + think_end_token }}
225
+ {%- elif reasoning_effort is defined and reasoning_effort in ['low', 'high'] %}
226
+ {{- assistant_token + think_begin_token }}
227
+ {%- elif reasoning_effort is defined and reasoning_effort == 'no_think' %}
228
+ {{- assistant_token + think_begin_token + think_end_token }}
229
+ {%- else %}
230
+ {{- assistant_token }}
231
+ {%- endif %}
232
+ {%- endif %}
233
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "HYV3ForCausalLM"
4
+ ],
5
+ "bos_token_id": 120000,
6
+ "enable_attention_fp32_softmax": false,
7
+ "enable_lm_head_fp32": true,
8
+ "enable_moe_fp32_combine": false,
9
+ "eod_token_id": 120026,
10
+ "eos_token_id": 120025,
11
+ "expert_hidden_dim": 1536,
12
+ "moe_intermediate_size": 1536,
13
+ "first_k_dense_replace": 1,
14
+ "head_dim": 128,
15
+ "hidden_act": "silu",
16
+ "hidden_size": 4096,
17
+ "initializer_range": 0.006,
18
+ "intermediate_size": 13312,
19
+ "max_position_embeddings": 262144,
20
+ "model_type": "hy_v3",
21
+ "moe_router_enable_expert_bias": true,
22
+ "moe_router_use_sigmoid": true,
23
+ "num_attention_heads": 64,
24
+ "num_experts": 192,
25
+ "num_experts_per_tok": 8,
26
+ "num_hidden_layers": 80,
27
+ "num_key_value_heads": 8,
28
+ "num_shared_experts": 1,
29
+ "output_router_logits": true,
30
+ "pad_token_id": 120002,
31
+ "qk_norm": true,
32
+ "rms_norm_eps": 1e-05,
33
+ "rope_parameters": {
34
+ "rope_theta": 11158840.0,
35
+ "rope_type": "default"
36
+ },
37
+ "route_norm": true,
38
+ "router_scaling_factor": 2.826,
39
+ "sep_token_id": 120007,
40
+ "tie_word_embeddings": false,
41
+ "transformers_version": "5.6.0",
42
+ "use_cache": true,
43
+ "use_grouped_mm": false,
44
+ "vocab_size": 120832,
45
+ "num_nextn_predict_layers": 1
46
+ }
generation_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 120000,
3
+ "do_sample": true,
4
+ "eos_token_id": 120025,
5
+ "pad_token_id": 120002,
6
+ "temperature": 0.9,
7
+ "top_k": -1,
8
+ "top_p": 1,
9
+ "transformers_version": "5.6.0"
10
+ }
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