YummyYum commited on
Commit
849f1c9
·
verified ·
1 Parent(s): 374421d

Upload folder using huggingface_hub

Browse files
.msc ADDED
Binary file (8.95 kB). View file
 
chat_template.jinja ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {#- ----------‑‑‑ special token variables ‑‑‑---------- -#}
2
+ {%- set HYTK = ':opensource' %}
3
+ {%- set eos_token = '<|hy_eos{}|>'.format(HYTK) %}
4
+ {%- set bos_token = '<|hy_begin_of_sentence{}|>'.format(HYTK) %}
5
+ {%- set pad_token = '<|hy_pad{}|>'.format(HYTK) %}
6
+ {%- set user_token = '<|hy_User{}|>'.format(HYTK) %}
7
+ {%- set assistant_token = '<|hy_Assistant{}|>'.format(HYTK) %}
8
+ {%- set think_begin_token = '<think{}>'.format(HYTK) %}
9
+ {%- set think_end_token = '</think{}>'.format(HYTK) %}
10
+ {%- set toolcalls_begin_token = '<tool_calls{}>'.format(HYTK) %}
11
+ {%- set toolcalls_end_token = '</tool_calls{}>'.format(HYTK) %}
12
+ {%- set toolcall_begin_token = '<tool_call{}>'.format(HYTK) %}
13
+ {%- set toolcall_end_token = '</tool_call{}>'.format(HYTK) %}
14
+ {%- set toolsep_token = '<tool_sep{}>'.format(HYTK) %}
15
+ {%- set argkey_begin_token = '<arg_key{}>'.format(HYTK) %}
16
+ {%- set argkey_end_token = '</arg_key{}>'.format(HYTK) %}
17
+ {%- set argvalue_begin_token = '<arg_value{}>'.format(HYTK) %}
18
+ {%- set argvalue_end_token = '</arg_value{}>'.format(HYTK) %}
19
+ {%- set toolresponses_begin_token = '<tool_responses{}>'.format(HYTK) %}
20
+ {%- set toolresponses_end_token = '</tool_responses{}>'.format(HYTK) %}
21
+ {%- set toolresponse_begin_token = '<tool_response{}>'.format(HYTK) %}
22
+ {%- set toolresponse_end_token = '</tool_response{}>'.format(HYTK) %}
23
+ {%- set reasoning_mode_token = '<|reasoning_mode{}|>'.format(HYTK) %}
24
+
25
+ {#- ----------‑‑‑ hyperparameters variables ‑‑‑---------- -#}
26
+ {%- if not add_generation_prompt is defined %}
27
+ {%- set add_generation_prompt = false %}
28
+ {%- endif %}
29
+ {%- if not preserved_thinking is defined %}
30
+ {%- if not tools %}
31
+ {%- set preserved_thinking = false %}
32
+ {%- else %}
33
+ {%- set preserved_thinking = true %}
34
+ {%- endif %}
35
+ {%- endif %}
36
+ {%- if not is_training is defined %}
37
+ {%- set is_training = false %}
38
+ {%- endif %}
39
+
40
+ {%- if not reasoning_effort is defined %}
41
+ {%- set reasoning_effort = 'no_think' %}
42
+ {%- elif reasoning_effort not in ['high', 'low', 'no_think'] %}
43
+ {%- if reasoning_effort is none %}
44
+ {{- raise_exception('reasoning_effort error : None, should be no_think/low/high') }}
45
+ {%- else %}
46
+ {{- raise_exception('reasoning_effort error : ' + reasoning_effort + ', should be no_think/low/high') }}
47
+ {%- endif %}
48
+ {%- endif %}
49
+
50
+ {%- if fallback_strategy is defined and fallback_strategy == 'reasoning_toolcall_retry' %}
51
+ {%- set reasoning_effort = 'high' %}
52
+ {%- set add_generation_prompt = false %}
53
+ {%- endif %}
54
+ {%- if not raw_last_assistant is defined %}
55
+ {%- set raw_last_assistant = false %}
56
+ {%- endif %}
57
+
58
+ {%- macro visible_text(content) -%}
59
+ {%- if content is string -%}
60
+ {{- content }}
61
+ {%- elif content is iterable and content is not mapping -%}
62
+ {%- for item in content -%}
63
+ {%- if item is mapping and item.type == 'text' -%}
64
+ {{- item.text }}
65
+ {%- elif item is string -%}
66
+ {{- item }}
67
+ {%- endif -%}
68
+ {%- endfor -%}
69
+ {%- elif content is none -%}
70
+ {{- '' }}
71
+ {%- else -%}
72
+ {{- content }}
73
+ {%- endif -%}
74
+ {%- endmacro -%}
75
+
76
+ {%- set ns = namespace(last_user_index=-1) %}
77
+ {%- set sp_ns = namespace(system_prompt='', is_first_sp=true) %}
78
+ {%- for message in messages %}
79
+ {%- if message['role'] == 'system' %}
80
+ {%- set sp_ns.system_prompt = sp_ns.system_prompt + visible_text(message['content']) %}
81
+ {%- endif %}
82
+ {%- if message['role'] == 'user' %}
83
+ {%- set ns.last_user_index = loop.index0 %}
84
+ {%- endif %}
85
+ {%- endfor %}
86
+ {%- if reasoning_effort is defined and reasoning_effort is string and reasoning_effort != '' and not tools %}
87
+ {%- set sp_ns.system_prompt = sp_ns.system_prompt + reasoning_mode_token + 'reasoning_effort:' + reasoning_effort %}
88
+ {%- endif %}
89
+ {{- bos_token }}
90
+ {{- sp_ns.system_prompt }}
91
+ {%- if tools %}
92
+ {%- if sp_ns.system_prompt != '' %}
93
+ {{- '\n\n# Tools\n\nYou may call one or more functions to assist with the user query.' }}
94
+ {%- else %}
95
+ {{- '# Tools\n\nYou may call one or more functions to assist with the user query.' }}
96
+ {%- endif %}
97
+ {{- '\n\nYou are provided with function signatures within <tools></tools> XML tags:' }}
98
+ {{- '\n<tools>\n' }}
99
+ {%- for tool in tools %}
100
+ {%- if loop.index0 > 0 %}
101
+ {{- '\n' }}
102
+ {%- endif %}
103
+ {{- tool | tojson }}
104
+ {%- endfor %}
105
+ {{- '\n</tools>\n\n' }}
106
+ {{- 'For function call returns, you should first print ' + toolcalls_begin_token + '\n' }}
107
+ {{- 'For each function call, you should return object like:\n' }}
108
+ {{- toolcall_begin_token + '{function-name}' + toolsep_token + '\n' }}
109
+ {{- argkey_begin_token + '{arg-key-1}' + argkey_end_token + '\n' }}
110
+ {{- argvalue_begin_token + '{arg-value-1}' + argvalue_end_token + '\n' }}
111
+ {{- argkey_begin_token + '{arg-key-2}' + argkey_end_token + '\n' }}
112
+ {{- argvalue_begin_token + '{arg-value-2}' + argvalue_end_token + '\n' }}
113
+ {{- '...\n' }}
114
+ {{- toolcall_end_token + '\n' }}
115
+ {%- if reasoning_effort is defined and reasoning_effort is string and reasoning_effort != '' %}
116
+ {{- 'At the end of function call returns, you should print ' + toolcalls_end_token + reasoning_mode_token + 'reasoning_effort:' + reasoning_effort }}
117
+ {%- else %}
118
+ {{- 'At the end of function call returns, you should print ' + toolcalls_end_token }}
119
+ {%- endif %}
120
+ {%- endif %}
121
+
122
+ {%- set prev_ns = namespace(is_tool=false, is_tool_first=true) %}
123
+ {%- set last_ns = namespace(last_is_assistant=false) %}
124
+ {%- for message in messages %}
125
+ {%- if message['role'] == 'user' %}
126
+ {%- if prev_ns.is_tool %}
127
+ {{- toolresponses_end_token }}
128
+ {%- endif %}
129
+ {{- user_token + visible_text(message['content']) }}
130
+ {%- set prev_ns.is_tool = false %}
131
+ {%- endif %}
132
+ {%- if message['role'] == 'assistant' %}
133
+ {%- if is_training %}
134
+ {%- if 'reasoning_content' in message and message['reasoning_content'] is string %}
135
+ {%- set content = think_begin_token + message['reasoning_content'] + think_end_token + visible_text(message['content']) %}
136
+ {%- else %}
137
+ {%- set content = think_begin_token + think_end_token + visible_text(message['content']) %}
138
+ {%- endif %}
139
+ {%- else %}
140
+ {%- if ((preserved_thinking is defined and preserved_thinking) or loop.index0 > ns.last_user_index) and 'reasoning_content' in message and message['reasoning_content'] is string %}
141
+ {%- set content = think_begin_token + message['reasoning_content'] + think_end_token + visible_text(message['content']) %}
142
+ {%- else %}
143
+ {%- set content = think_begin_token + think_end_token + visible_text(message['content']) %}
144
+ {%- endif %}
145
+ {%- endif %}
146
+ {%- if prev_ns.is_tool %}
147
+ {{- toolresponses_end_token }}
148
+ {%- endif %}
149
+ {{- assistant_token }}
150
+ {%- if message['tool_calls'] is defined and message['tool_calls'] %}
151
+ {%- set prev_ns.is_tool_first = true %}
152
+ {{- content }}
153
+ {{- toolcalls_begin_token + '\n' }}
154
+ {%- for tool in message['tool_calls'] %}
155
+ {%- set arguments = tool['function']['arguments'] %}
156
+ {{- toolcall_begin_token + tool['function']['name'] + toolsep_token + '\n' }}
157
+ {%- for key, value in arguments.items() %}
158
+ {{- argkey_begin_token + key + argkey_end_token + '\n' }}
159
+ {%- if value is not string %}
160
+ {%- set value = value | tojson(ensure_ascii=False) %}
161
+ {%- endif %}
162
+ {{- argvalue_begin_token + value + argvalue_end_token + '\n' }}
163
+ {%- endfor %}
164
+ {{- toolcall_end_token + '\n' }}
165
+ {%- endfor %}
166
+ {{- toolcalls_end_token + eos_token }}
167
+ {%- else %}
168
+ {%- if loop.last and raw_last_assistant %}
169
+ {{- visible_text(message['content']) }}
170
+ {%- elif not loop.last or is_training %}
171
+ {{- content + eos_token }}
172
+ {%- else %}
173
+ {{- content }}
174
+ {%- endif %}
175
+ {%- endif %}
176
+ {%- set prev_ns.is_tool = false %}
177
+ {%- endif %}
178
+ {%- if message['role'] == 'tool' %}
179
+ {%- set prev_ns.is_tool = true %}
180
+ {%- if prev_ns.is_tool_first %}
181
+ {{- toolresponses_begin_token + '\n' }}
182
+ {%- set prev_ns.is_tool_first = false %}
183
+ {%- endif %}
184
+ {{- toolresponse_begin_token + '\n' + visible_text(message['content']) + '\n' + toolresponse_end_token + '\n' }}
185
+ {%- endif %}
186
+ {%- if loop.last and message['role'] == 'assistant' %}
187
+ {%- set last_ns.last_is_assistant = true %}
188
+ {%- endif %}
189
+
190
+ {%- endfor %}
191
+ {%- if prev_ns.is_tool %}
192
+ {{- toolresponses_end_token }}
193
+ {%- endif %}
194
+ {%- if add_generation_prompt %}
195
+ {%- if not last_ns.last_is_assistant %}
196
+ {%- if reasoning_effort is defined and reasoning_effort in ['low', 'high'] %}
197
+ {{- assistant_token + think_begin_token }}
198
+ {%- elif reasoning_effort is defined and reasoning_effort == 'no_think' %}
199
+ {{- assistant_token + think_begin_token + think_end_token }}
200
+ {%- else %}
201
+ {{- assistant_token }}
202
+ {%- endif %}
203
+ {%- endif %}
204
+ {%- 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
+ }
configuration.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"framework": "pytorch", "task": "text-generation", "allow_remote": true}
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
+ }
model-00000-of-00099.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3d8d0dc1596bc0b3117b33dc3e4779adac821d8bab78b1a53f8b51f29eacb648
3
+ size 7247829008
model-00003-of-00099.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f90aa606bd11a43a3770ec5f5fb2c468297a0227ff49120de4344b19ddd091bd
3
+ size 7247829008
model-00004-of-00099.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4651f1aad3bcf71334bdcd08ce05b5a6fba59e04b2892d8ff7e5f8e89ba15d59
3
+ size 7247829584
model-00006-of-00099.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:defa05d3e71df4dc72ef46b67004afd3983adf2373a947c8d65e31d08c6dd8a3
3
+ size 7247829008