Text Generation
Transformers
Safetensors
English
doge
pt
conversational
JingzeShi commited on
Commit
96732b0
·
verified ·
1 Parent(s): f62f006

Upload tokenizer

Browse files
chat_template.jinja ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- bos_token }}
2
+ {%- if custom_tools is defined %}
3
+ {%- set tools = custom_tools %}
4
+ {%- endif %}
5
+ {%- if not documents_in_user_message is defined %}
6
+ {%- set documents_in_user_message = true %}
7
+ {%- endif %}
8
+ {%- if not tools_in_user_message is defined %}
9
+ {%- set tools_in_user_message = true %}
10
+ {%- endif %}
11
+ {%- if not documents is defined %}
12
+ {%- set documents = none %}
13
+ {%- endif %}
14
+ {%- if not tools is defined %}
15
+ {%- set tools = none %}
16
+ {%- endif %}
17
+ {%- if not date_string is defined %}
18
+ {%- set date_string = "December 2025" %}
19
+ {%- endif %}
20
+
21
+
22
+ {#- This block extracts the system message, so we can slot it into the right place. #}
23
+ {%- if messages[0]['role'] == 'system' %}
24
+ {%- set system_message = messages[0]['content']|trim %}
25
+ {%- set messages = messages[1:] %}
26
+ {%- else %}
27
+ {%- set system_message = "" %}
28
+ {%- endif %}
29
+
30
+
31
+ {#- System message + documents + builtin tools + date #}
32
+ {{- "<|start_header_id|>system<|end_header_id|>\n" }}
33
+ {%- if documents is not none and not documents_in_user_message %}
34
+ {{- "You have access to the following documents. Please use them to answer the user's question." }}
35
+ {%- for doc in documents %}
36
+ {%- if doc.title is defined %}
37
+ {{- "Title: " + doc.title + "\n" }}
38
+ {%- endif %}
39
+ {{- "Content: " + doc.text + "\n\n" }}
40
+ {%- endfor %}
41
+ {{- "If the documents don't contain relevant information, rely on your general knowledge but acknowledge when you're doing so.\n\n" }}
42
+ {%- endif %}
43
+ {%- if builtin_tools is defined or tools is not none %}
44
+ {{- "Environment: ipython\n" }}
45
+ {%- endif %}
46
+ {%- if builtin_tools is defined %}
47
+ {{- "Tools: " + builtin_tools | reject('equalto', 'code_interpreter') | join(", ") + "\n\n"}}
48
+ {%- endif %}
49
+ {{- "Cutting Knowledge Date: December 2024\n" }}
50
+ {{- "Today Date: " + date_string + "\n" }}
51
+ {%- if tools is not none and not tools_in_user_message %}
52
+ {{- "You have access to the following functions. To call a function, please respond with JSON for a function call." }}
53
+ {%- for t in tools %}
54
+ {{- t | tojson(indent=4) }}
55
+ {{- "\n\n" }}
56
+ {%- endfor %}
57
+ {{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}. '}}
58
+ {{- "Do not use variables.\n\n" }}
59
+ {%- endif %}
60
+
61
+ {{- system_message }}
62
+ {{- "<|end_of_text|>\n\n" }}
63
+
64
+
65
+ {#- Custom tools and documents are passed in a user message with some extra guidance #}
66
+ {%- if (documents_in_user_message and not documents is none) or (tools_in_user_message and not tools is none) %}
67
+ {#- Extract the first user message so we can plug it in here #}
68
+ {%- if messages | length != 0 %}
69
+ {%- set first_user_message = messages[0]['content']|trim %}
70
+ {%- set messages = messages[1:] %}
71
+ {%- else %}
72
+ {{- raise_exception("Cannot put tools or documents in the first user message when there's no first user message!") }}
73
+ {%- endif %}
74
+
75
+ {{- '<|start_header_id|>user<|end_header_id|>\n' -}}
76
+
77
+ {#- Add documents to the user message if they are defined #}
78
+ {%- if documents_in_user_message and not documents is none %}
79
+ {{- "Given the following documents, please use them to answer the user's question.\n\n" }}
80
+ {%- for doc in documents %}
81
+ {%- if doc.title is defined %}
82
+ {{- "Title: " + doc.title + "\n" }}
83
+ {%- endif %}
84
+ {{- "Content: " + doc.text + "\n\n" }}
85
+ {%- endfor %}
86
+ {{- "If the documents don't contain relevant information, rely on your general knowledge but acknowledge when you're doing so.\n\n" }}
87
+ {%- endif %}
88
+
89
+ {#- Add tools to the user message if they are defined #}
90
+ {%- if tools_in_user_message and not tools is none %}
91
+ {{- "Given the following functions, please respond with a JSON for a function call with its proper arguments that best answers the given prompt.\n\n" }}
92
+ {%- for t in tools %}
93
+ {{- t | tojson(indent=4) }}
94
+ {{- "\n\n" }}
95
+ {%- endfor %}
96
+ {{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}. '}}
97
+ {{- "Do not use variables.\n\n" }}
98
+ {%- endif %}
99
+
100
+ {#- Add the first user message to the user message #}
101
+ {{- first_user_message + "<|end_of_text|>\n\n"}}
102
+ {%- endif %}
103
+
104
+ {%- for message in messages %}
105
+ {%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}
106
+ {{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n'+ message['content'] | trim + '<|end_of_text|>\n\n' }}
107
+ {%- elif 'tool_calls' in message %}
108
+ {%- if not message.tool_calls|length == 1 %}
109
+ {{- raise_exception("This model only supports single tool-calls at once!") }}
110
+ {%- endif %}
111
+ {%- set tool_call = message.tool_calls[0].function %}
112
+ {%- if builtin_tools is defined and tool_call.name in builtin_tools %}
113
+ {{- '<|start_header_id|>assistant<|end_header_id|>\n' -}}
114
+ {{- "<|python_tag|>" + tool_call.name + ".call(" }}
115
+ {%- for arg_name, arg_val in tool_call.arguments | items %}
116
+ {{- arg_name + '="' + arg_val + '"' }}
117
+ {%- if not loop.last %}
118
+ {{- ", " }}
119
+ {%- endif %}
120
+ {%- endfor %}
121
+ {{- ")" }}
122
+ {%- else %}
123
+ {{- '<|start_header_id|>assistant<|end_header_id|>\n' -}}
124
+ {{- '{"name": "' + tool_call.name + '", ' }}
125
+ {{- '"parameters": ' }}
126
+ {{- tool_call.arguments | tojson }}
127
+ {{- "}" }}
128
+ {%- endif %}
129
+ {%- if builtin_tools is defined %}
130
+ {#- This means we're in ipython mode #}
131
+ {{- "<|end_of_text|>\n\n" }}
132
+ {%- else %}
133
+ {{- "<|end_of_text|>\n\n" }}
134
+ {%- endif %}
135
+ {%- elif message.role == "tool" or message.role == "ipython" %}
136
+ {{- "<|start_header_id|>ipython<|end_header_id|>\n" }}
137
+ {%- if message.content is mapping or message.content is iterable %}
138
+ {{- message.content | tojson }}
139
+ {%- else %}
140
+ {{- message.content }}
141
+ {%- endif %}
142
+ {{- "<|end_of_text|>\n\n" }}
143
+ {%- endif %}
144
+ {%- endfor %}
145
+ {%- if add_generation_prompt %}
146
+ {{- '<|start_header_id|>assistant<|end_header_id|>\n' }}
147
+ {%- endif %}
special_tokens_map.json CHANGED
@@ -1,23 +1,23 @@
1
- {
2
- "bos_token": {
3
- "content": "<|begin_of_text|>",
4
- "lstrip": false,
5
- "normalized": false,
6
- "rstrip": false,
7
- "single_word": false
8
- },
9
- "eos_token": {
10
- "content": "<|end_of_text|>",
11
- "lstrip": false,
12
- "normalized": false,
13
- "rstrip": false,
14
- "single_word": false
15
- },
16
- "pad_token": {
17
- "content": "<|finetune_right_pad_id|>",
18
- "lstrip": false,
19
- "normalized": false,
20
- "rstrip": false,
21
- "single_word": false
22
- }
23
- }
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|begin_of_text|>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|end_of_text|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "<|finetune_right_pad_id|>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ }
23
+ }
tokenizer_config.json CHANGED
The diff for this file is too large to render. See raw diff