Ba2han commited on
Commit
bed9d78
·
verified ·
1 Parent(s): 9f16a98

Upload tokenizer

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. chat_template.jinja +105 -0
  3. tokenizer.json +3 -0
  4. tokenizer_config.json +18 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ 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
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
chat_template.jinja ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- bos_token }}
2
+ {%- if custom_tools is defined %}
3
+ {%- set tools = custom_tools %}
4
+ {%- endif %}
5
+ {%- if not tools_in_user_message is defined %}
6
+ {%- set tools_in_user_message = true %}
7
+ {%- endif %}
8
+ {%- if not date_string is defined %}
9
+ {%- set date_string = "30 Dec 2025" %}
10
+ {%- endif %}
11
+ {%- if not tools is defined %}
12
+ {%- set tools = none %}
13
+ {%- endif %}
14
+ {#- This block extracts the system message, so we can slot it into the right place. #}
15
+ {%- if messages[0]['role'] == 'system' %}
16
+ {%- set system_message = messages[0]['content']|trim %}
17
+ {%- set messages = messages[1:] %}
18
+ {%- else %}
19
+ {%- set system_message = "" %}
20
+ {%- endif %}
21
+ {#- System message + builtin tools #}
22
+ {{- "<|start_header_id|>system<|end_header_id|>\n\n" }}
23
+ {%- if builtin_tools is defined or tools is not none %}
24
+ {{- "Environment: ipython\n" }}
25
+ {%- endif %}
26
+ {%- if builtin_tools is defined %}
27
+ {{- "Tools: " + builtin_tools | reject('equalto', 'code_interpreter') | join(", ") + "\n\n"}}
28
+ {%- endif %}
29
+ {{- "Cutting Knowledge Date: December 2023\n" }}
30
+ {{- "Today Date: " + date_string + "\n\n" }}
31
+ {%- if tools is not none and not tools_in_user_message %}
32
+ {{- "You have access to the following functions. To call a function, please respond with JSON for a function call." }}
33
+ {{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
34
+ {{- "Do not use variables.\n\n" }}
35
+ {%- for t in tools %}
36
+ {{- t | tojson(indent=4) }}
37
+ {{- "\n\n" }}
38
+ {%- endfor %}
39
+ {%- endif %}
40
+ {{- system_message }}
41
+ {{- "<|eot_id|>" }}
42
+ {#- Custom tools are passed in a user message with some extra guidance #}
43
+ {%- if tools_in_user_message and not tools is none %}
44
+ {#- Extract the first user message so we can plug it in here #}
45
+ {%- if messages | length != 0 %}
46
+ {%- set first_user_message = messages[0]['content']|trim %}
47
+ {%- set messages = messages[1:] %}
48
+ {%- else %}
49
+ {{- raise_exception("Cannot put tools in the first user message when there's no first user message!") }}
50
+ {%- endif %}
51
+ {{- '<|start_header_id|>user<|end_header_id|>\n\n' -}}
52
+ {{- "Given the following functions, please respond with a JSON for a function call " }}
53
+ {{- "with its proper arguments that best answers the given prompt.\n\n" }}
54
+ {{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
55
+ {{- "Do not use variables.\n\n" }}
56
+ {%- for t in tools %}
57
+ {{- t | tojson(indent=4) }}
58
+ {{- "\n\n" }}
59
+ {%- endfor %}
60
+ {{- first_user_message + "<|eot_id|>"}}
61
+ {%- endif %}
62
+ {%- for message in messages %}
63
+ {%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}
64
+ {{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n'+ message['content'] | trim + '<|eot_id|>' }}
65
+ {%- elif 'tool_calls' in message %}
66
+ {%- if not message.tool_calls|length == 1 %}
67
+ {{- raise_exception("This model only supports single tool-calls at once!") }}
68
+ {%- endif %}
69
+ {%- set tool_call = message.tool_calls[0].function %}
70
+ {%- if builtin_tools is defined and tool_call.name in builtin_tools %}
71
+ {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}
72
+ {{- "<|python_tag|>" + tool_call.name + ".call(" }}
73
+ {%- for arg_name, arg_val in tool_call.arguments | items %}
74
+ {{- arg_name + '="' + arg_val + '"' }}
75
+ {%- if not loop.last %}
76
+ {{- ", " }}
77
+ {%- endif %}
78
+ {%- endfor %}
79
+ {{- ")" }}
80
+ {%- else %}
81
+ {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}
82
+ {{- '{"name": "' + tool_call.name + '", ' }}
83
+ {{- '"parameters": ' }}
84
+ {{- tool_call.arguments | tojson }}
85
+ {{- "}" }}
86
+ {%- endif %}
87
+ {%- if builtin_tools is defined %}
88
+ {#- This means we're in ipython mode #}
89
+ {{- "<|eom_id|>" }}
90
+ {%- else %}
91
+ {{- "<|eot_id|>" }}
92
+ {%- endif %}
93
+ {%- elif message.role == "tool" or message.role == "ipython" %}
94
+ {{- "<|start_header_id|>ipython<|end_header_id|>\n\n" }}
95
+ {%- if message.content is mapping or message.content is iterable %}
96
+ {{- message.content | tojson }}
97
+ {%- else %}
98
+ {{- message.content }}
99
+ {%- endif %}
100
+ {{- "<|eot_id|>" }}
101
+ {%- endif %}
102
+ {%- endfor %}
103
+ {%- if add_generation_prompt %}
104
+ {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }}
105
+ {%- endif %}
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3c5cf44023714fb39b05e71e425f8d7b92805ff73f7988b083b8c87f0bf87393
3
+ size 17209961
tokenizer_config.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": null,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|begin_of_text|>",
5
+ "clean_up_tokenization_spaces": true,
6
+ "eos_token": "<|eot_id|>",
7
+ "extra_special_tokens": [],
8
+ "is_local": true,
9
+ "model_input_names": [
10
+ "input_ids",
11
+ "attention_mask"
12
+ ],
13
+ "model_max_length": 131072,
14
+ "model_specific_special_tokens": {},
15
+ "pad_token": "<|eot_id|>",
16
+ "padding_side": "right",
17
+ "tokenizer_class": "TokenizersBackend"
18
+ }