deanngkl commited on
Commit
e6fc0c7
·
verified ·
1 Parent(s): bfd3c0f

Upload tokenizer

Browse files
added_tokens.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "<pad10>": 32010,
3
+ "<pad11>": 32011,
4
+ "<pad12>": 32012,
5
+ "<pad13>": 32013,
6
+ "<pad14>": 32014,
7
+ "<pad15>": 32015,
8
+ "<pad16>": 32016,
9
+ "<pad17>": 32017,
10
+ "<pad18>": 32018,
11
+ "<pad19>": 32019,
12
+ "<pad20>": 32020,
13
+ "<pad21>": 32021,
14
+ "<pad22>": 32022,
15
+ "<pad23>": 32023,
16
+ "<pad24>": 32024,
17
+ "<pad25>": 32025,
18
+ "<pad26>": 32026,
19
+ "<pad27>": 32027,
20
+ "<pad28>": 32028,
21
+ "<pad29>": 32029,
22
+ "<pad2>": 32002,
23
+ "<pad30>": 32030,
24
+ "<pad31>": 32031,
25
+ "<pad3>": 32003,
26
+ "<pad4>": 32004,
27
+ "<pad5>": 32005,
28
+ "<pad6>": 32006,
29
+ "<pad7>": 32007,
30
+ "<pad8>": 32008,
31
+ "<pad9>": 32009,
32
+ "<|im_end|>": 32000,
33
+ "<|im_start|>": 32001
34
+ }
additional_chat_templates/tool_use.jinja ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- macro json_to_python_type(json_spec) %}
2
+ {%- set basic_type_map = {
3
+ "string": "str",
4
+ "number": "float",
5
+ "integer": "int",
6
+ "boolean": "bool"
7
+ } %}
8
+
9
+ {%- if basic_type_map[json_spec.type] is defined %}
10
+ {{- basic_type_map[json_spec.type] }}
11
+ {%- elif json_spec.type == "array" %}
12
+ {{- "list[" + json_to_python_type(json_spec|items) + "]"}}
13
+ {%- elif json_spec.type == "object" %}
14
+ {%- if json_spec.additionalProperties is defined %}
15
+ {{- "dict[str, " + json_to_python_type(json_spec.additionalProperties) + ']'}}
16
+ {%- else %}
17
+ {{- "dict" }}
18
+ {%- endif %}
19
+ {%- elif json_spec.type is iterable %}
20
+ {{- "Union[" }}
21
+ {%- for t in json_spec.type %}
22
+ {{- json_to_python_type({"type": t}) }}
23
+ {%- if not loop.last %}
24
+ {{- "," }}
25
+ {%- endif %}
26
+ {%- endfor %}
27
+ {{- "]" }}
28
+ {%- else %}
29
+ {{- "Any" }}
30
+ {%- endif %}
31
+ {%- endmacro %}
32
+
33
+
34
+ {{- bos_token }}
35
+ {{- '<|im_start|>system
36
+ ' }}
37
+ {{- "You are a function calling AI model. You are provided with function signatures within <tools></tools> XML tags. You may call one or more functions to assist with the user query. Don't make assumptions about what values to plug into functions. Here are the available tools: <tools> " }}
38
+ {%- for tool in tools %}
39
+ {%- if tool.function is defined %}
40
+ {%- set tool = tool.function %}
41
+ {%- endif %}
42
+ {{- '{"type": "function", "function": ' }}
43
+ {{- '{"name": "' + tool.name + '", ' }}
44
+ {{- '"description": "' + tool.name + '(' }}
45
+ {%- for param_name, param_fields in tool.parameters.properties|items %}
46
+ {{- param_name + ": " + json_to_python_type(param_fields) }}
47
+ {%- if not loop.last %}
48
+ {{- ", " }}
49
+ {%- endif %}
50
+ {%- endfor %}
51
+ {{- ")" }}
52
+ {%- if tool.return is defined %}
53
+ {{- " -> " + json_to_python_type(tool.return) }}
54
+ {%- endif %}
55
+ {{- " - " + tool.description + "
56
+
57
+ " }}
58
+ {%- for param_name, param_fields in tool.parameters.properties|items %}
59
+ {%- if loop.first %}
60
+ {{- " Args:
61
+ " }}
62
+ {%- endif %}
63
+ {{- " " + param_name + "(" + json_to_python_type(param_fields) + "): " + param_fields.description|trim }}
64
+ {%- endfor %}
65
+ {%- if tool.return is defined and tool.return.description is defined %}
66
+ {{- "
67
+ Returns:
68
+ " + tool.return.description }}
69
+ {%- endif %}
70
+ {{- '"' }}
71
+ {{- ', "parameters": ' }}
72
+ {%- if tool.parameters.properties | length == 0 %}
73
+ {{- "{}" }}
74
+ {%- else %}
75
+ {{- tool.parameters|tojson }}
76
+ {%- endif %}
77
+ {{- "}" }}
78
+ {%- if not loop.last %}
79
+ {{- "
80
+ " }}
81
+ {%- endif %}
82
+ {%- endfor %}
83
+ {{- " </tools>" }}
84
+ {{- 'Use the following pydantic model json schema for each tool call you will make: {"properties": {"name": {"title": "Name", "type": "string"}, "arguments": {"title": "Arguments", "type": "object"}}, "required": ["name", "arguments"], "title": "FunctionCall", "type": "object"}}
85
+ ' }}
86
+ {{- "For each function call return a json object with function name and arguments within <tool_call></tool_call> XML tags as follows:
87
+ " }}
88
+ {{- "<tool_call>
89
+ " }}
90
+ {{- '{"name": <function-name>, "arguments": <args-dict>}
91
+ ' }}
92
+ {{- '</tool_call><|im_end|>
93
+ ' }}
94
+ {%- for message in messages %}
95
+ {%- if message.role == "user" or message.role == "system" or (message.role == "assistant" and message.tool_calls is not defined) %}
96
+ {{- '<|im_start|>' + message.role + '
97
+ ' + message.content + '<|im_end|>' + '
98
+ ' }}
99
+ {%- elif message.role == "assistant" %}
100
+ {{- '<|im_start|>' + message.role }}
101
+ {%- for tool_call in message.tool_calls %}
102
+ {{- '
103
+ <tool_call>
104
+ ' }} {%- if tool_call.function is defined %}
105
+ {%- set tool_call = tool_call.function %}
106
+ {%- endif %}
107
+ {{- '{' }}
108
+ {{- '"name": "' }}
109
+ {{- tool_call.name }}
110
+ {{- '"' }}
111
+ {{- ', '}}
112
+ {%- if tool_call.arguments is defined %}
113
+ {{- '"arguments": ' }}
114
+ {%- if tool_call.arguments is string %}
115
+ {{- tool_call.arguments }}
116
+ {%- else %}
117
+ {{- tool_call.arguments|tojson }}
118
+ {%- endif %}
119
+ {%- endif %}
120
+ {{- '}' }}
121
+ {{- '
122
+ </tool_call>' }}
123
+ {%- endfor %}
124
+ {{- '<|im_end|>
125
+ ' }}
126
+ {%- elif message.role == "tool" %}
127
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
128
+ {{- '<|im_start|>tool
129
+ ' }}
130
+ {%- endif %}
131
+ {{- '<tool_response>
132
+ ' }}
133
+ {{- message.content }}
134
+ {%- if not loop.last %}
135
+ {{- '
136
+ </tool_response>
137
+ ' }}
138
+ {%- else %}
139
+ {{- '
140
+ </tool_response>' }}
141
+ {%- endif %}
142
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
143
+ {{- '<|im_end|>' }}
144
+ {%- elif loop.last %}
145
+ {{- '<|im_end|>' }}
146
+ {%- endif %}
147
+ {%- endif %}
148
+ {%- endfor %}
149
+ {%- if add_generation_prompt %}
150
+ {{- '<|im_start|>assistant
151
+ ' }}
152
+ {%- endif %}
chat_template.jinja ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {{bos_token}}{% for message in messages %}{{'<|im_start|>' + message['role'] + '
2
+ ' + message['content'] + '<|im_end|>' + '
3
+ '}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant
4
+ ' }}{% endif %}
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": "<|im_end|>",
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.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dadfd56d766715c61d2ef780a525ab43b8e6da4de6865bda3d95fdef5e134055
3
+ size 493443
tokenizer_config.json ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "add_prefix_space": true,
5
+ "added_tokens_decoder": {
6
+ "0": {
7
+ "content": "<unk>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "1": {
15
+ "content": "<s>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": true
21
+ },
22
+ "2": {
23
+ "content": "</s>",
24
+ "lstrip": false,
25
+ "normalized": false,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": true
29
+ },
30
+ "32000": {
31
+ "content": "<|im_end|>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false,
36
+ "special": true
37
+ },
38
+ "32001": {
39
+ "content": "<|im_start|>",
40
+ "lstrip": false,
41
+ "normalized": false,
42
+ "rstrip": false,
43
+ "single_word": false,
44
+ "special": false
45
+ },
46
+ "32002": {
47
+ "content": "<pad2>",
48
+ "lstrip": false,
49
+ "normalized": false,
50
+ "rstrip": false,
51
+ "single_word": false,
52
+ "special": false
53
+ },
54
+ "32003": {
55
+ "content": "<pad3>",
56
+ "lstrip": false,
57
+ "normalized": false,
58
+ "rstrip": false,
59
+ "single_word": false,
60
+ "special": false
61
+ },
62
+ "32004": {
63
+ "content": "<pad4>",
64
+ "lstrip": false,
65
+ "normalized": false,
66
+ "rstrip": false,
67
+ "single_word": false,
68
+ "special": false
69
+ },
70
+ "32005": {
71
+ "content": "<pad5>",
72
+ "lstrip": false,
73
+ "normalized": false,
74
+ "rstrip": false,
75
+ "single_word": false,
76
+ "special": false
77
+ },
78
+ "32006": {
79
+ "content": "<pad6>",
80
+ "lstrip": false,
81
+ "normalized": false,
82
+ "rstrip": false,
83
+ "single_word": false,
84
+ "special": false
85
+ },
86
+ "32007": {
87
+ "content": "<pad7>",
88
+ "lstrip": false,
89
+ "normalized": false,
90
+ "rstrip": false,
91
+ "single_word": false,
92
+ "special": false
93
+ },
94
+ "32008": {
95
+ "content": "<pad8>",
96
+ "lstrip": false,
97
+ "normalized": false,
98
+ "rstrip": false,
99
+ "single_word": false,
100
+ "special": false
101
+ },
102
+ "32009": {
103
+ "content": "<pad9>",
104
+ "lstrip": false,
105
+ "normalized": false,
106
+ "rstrip": false,
107
+ "single_word": false,
108
+ "special": false
109
+ },
110
+ "32010": {
111
+ "content": "<pad10>",
112
+ "lstrip": false,
113
+ "normalized": false,
114
+ "rstrip": false,
115
+ "single_word": false,
116
+ "special": false
117
+ },
118
+ "32011": {
119
+ "content": "<pad11>",
120
+ "lstrip": false,
121
+ "normalized": false,
122
+ "rstrip": false,
123
+ "single_word": false,
124
+ "special": false
125
+ },
126
+ "32012": {
127
+ "content": "<pad12>",
128
+ "lstrip": false,
129
+ "normalized": false,
130
+ "rstrip": false,
131
+ "single_word": false,
132
+ "special": false
133
+ },
134
+ "32013": {
135
+ "content": "<pad13>",
136
+ "lstrip": false,
137
+ "normalized": false,
138
+ "rstrip": false,
139
+ "single_word": false,
140
+ "special": false
141
+ },
142
+ "32014": {
143
+ "content": "<pad14>",
144
+ "lstrip": false,
145
+ "normalized": false,
146
+ "rstrip": false,
147
+ "single_word": false,
148
+ "special": false
149
+ },
150
+ "32015": {
151
+ "content": "<pad15>",
152
+ "lstrip": false,
153
+ "normalized": false,
154
+ "rstrip": false,
155
+ "single_word": false,
156
+ "special": false
157
+ },
158
+ "32016": {
159
+ "content": "<pad16>",
160
+ "lstrip": false,
161
+ "normalized": false,
162
+ "rstrip": false,
163
+ "single_word": false,
164
+ "special": false
165
+ },
166
+ "32017": {
167
+ "content": "<pad17>",
168
+ "lstrip": false,
169
+ "normalized": false,
170
+ "rstrip": false,
171
+ "single_word": false,
172
+ "special": false
173
+ },
174
+ "32018": {
175
+ "content": "<pad18>",
176
+ "lstrip": false,
177
+ "normalized": false,
178
+ "rstrip": false,
179
+ "single_word": false,
180
+ "special": false
181
+ },
182
+ "32019": {
183
+ "content": "<pad19>",
184
+ "lstrip": false,
185
+ "normalized": false,
186
+ "rstrip": false,
187
+ "single_word": false,
188
+ "special": false
189
+ },
190
+ "32020": {
191
+ "content": "<pad20>",
192
+ "lstrip": false,
193
+ "normalized": false,
194
+ "rstrip": false,
195
+ "single_word": false,
196
+ "special": false
197
+ },
198
+ "32021": {
199
+ "content": "<pad21>",
200
+ "lstrip": false,
201
+ "normalized": false,
202
+ "rstrip": false,
203
+ "single_word": false,
204
+ "special": false
205
+ },
206
+ "32022": {
207
+ "content": "<pad22>",
208
+ "lstrip": false,
209
+ "normalized": false,
210
+ "rstrip": false,
211
+ "single_word": false,
212
+ "special": false
213
+ },
214
+ "32023": {
215
+ "content": "<pad23>",
216
+ "lstrip": false,
217
+ "normalized": false,
218
+ "rstrip": false,
219
+ "single_word": false,
220
+ "special": false
221
+ },
222
+ "32024": {
223
+ "content": "<pad24>",
224
+ "lstrip": false,
225
+ "normalized": false,
226
+ "rstrip": false,
227
+ "single_word": false,
228
+ "special": false
229
+ },
230
+ "32025": {
231
+ "content": "<pad25>",
232
+ "lstrip": false,
233
+ "normalized": false,
234
+ "rstrip": false,
235
+ "single_word": false,
236
+ "special": false
237
+ },
238
+ "32026": {
239
+ "content": "<pad26>",
240
+ "lstrip": false,
241
+ "normalized": false,
242
+ "rstrip": false,
243
+ "single_word": false,
244
+ "special": false
245
+ },
246
+ "32027": {
247
+ "content": "<pad27>",
248
+ "lstrip": false,
249
+ "normalized": false,
250
+ "rstrip": false,
251
+ "single_word": false,
252
+ "special": false
253
+ },
254
+ "32028": {
255
+ "content": "<pad28>",
256
+ "lstrip": false,
257
+ "normalized": false,
258
+ "rstrip": false,
259
+ "single_word": false,
260
+ "special": false
261
+ },
262
+ "32029": {
263
+ "content": "<pad29>",
264
+ "lstrip": false,
265
+ "normalized": false,
266
+ "rstrip": false,
267
+ "single_word": false,
268
+ "special": false
269
+ },
270
+ "32030": {
271
+ "content": "<pad30>",
272
+ "lstrip": false,
273
+ "normalized": false,
274
+ "rstrip": false,
275
+ "single_word": false,
276
+ "special": false
277
+ },
278
+ "32031": {
279
+ "content": "<pad31>",
280
+ "lstrip": false,
281
+ "normalized": false,
282
+ "rstrip": false,
283
+ "single_word": false,
284
+ "special": false
285
+ }
286
+ },
287
+ "additional_special_tokens": [],
288
+ "bos_token": "<s>",
289
+ "clean_up_tokenization_spaces": true,
290
+ "eos_token": "<|im_end|>",
291
+ "extra_special_tokens": {},
292
+ "legacy": true,
293
+ "model_max_length": 1000000000000000019884624838656,
294
+ "pad_token": "</s>",
295
+ "sp_model_kwargs": {},
296
+ "spaces_between_special_tokens": false,
297
+ "tokenizer_class": "LlamaTokenizer",
298
+ "unk_token": "<unk>",
299
+ "use_default_system_prompt": false,
300
+ "use_fast": true
301
+ }