tomeras1 commited on
Commit
ed30336
1 Parent(s): 83cec42

Align tokenizer

Browse files
Files changed (4) hide show
  1. special_tokens_map.json +46 -4
  2. tokenizer.json +161 -16
  3. tokenizer.model +2 -2
  4. tokenizer_config.json +149 -1
special_tokens_map.json CHANGED
@@ -1,6 +1,48 @@
1
  {
2
- "bos_token": "<|startoftext|>",
3
- "eos_token": "<|endoftext|>",
4
- "pad_token": "<|pad|>",
5
- "unk_token": "<|unk|>"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  }
 
1
  {
2
+ "additional_special_tokens": [
3
+ "<|eom|>",
4
+ "<|bom|>",
5
+ "<|system|>",
6
+ "<|user|>",
7
+ "<|assistant|>",
8
+ "<|tool|>",
9
+ "<documents>",
10
+ "</documents>",
11
+ "<tool_definitions>",
12
+ "</tool_definitions>",
13
+ "<active_output_modes>",
14
+ "</active_output_modes>",
15
+ "<citations>",
16
+ "</citations>",
17
+ "<tool_calls>",
18
+ "</tool_calls>"
19
+ ],
20
+ "bos_token": {
21
+ "content": "<|startoftext|>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false
26
+ },
27
+ "eos_token": {
28
+ "content": "<|endoftext|>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false
33
+ },
34
+ "pad_token": {
35
+ "content": "<|pad|>",
36
+ "lstrip": false,
37
+ "normalized": false,
38
+ "rstrip": false,
39
+ "single_word": false
40
+ },
41
+ "unk_token": {
42
+ "content": "<|unk|>",
43
+ "lstrip": false,
44
+ "normalized": false,
45
+ "rstrip": false,
46
+ "single_word": false
47
+ }
48
  }
tokenizer.json CHANGED
@@ -38,6 +38,150 @@
38
  "rstrip": false,
39
  "normalized": false,
40
  "special": true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  }
42
  ],
43
  "normalizer": {
@@ -133,6 +277,7 @@
133
  "end_of_word_suffix": null,
134
  "fuse_unk": true,
135
  "byte_fallback": true,
 
136
  "vocab": {
137
  "<|pad|>": 0,
138
  "<|startoftext|>": 1,
@@ -652,22 +797,22 @@
652
  "<|mask_511|>": 515,
653
  "<|reserved_0|>": 516,
654
  "<|reserved_1|>": 517,
655
- "<|reserved_2|>": 518,
656
- "<|reserved_3|>": 519,
657
- "<|reserved_4|>": 520,
658
- "<|reserved_5|>": 521,
659
- "<|reserved_6|>": 522,
660
- "<|reserved_7|>": 523,
661
- "<|reserved_8|>": 524,
662
- "<|reserved_9|>": 525,
663
- "<|reserved_10|>": 526,
664
- "<|reserved_11|>": 527,
665
- "<|reserved_12|>": 528,
666
- "<|reserved_13|>": 529,
667
- "<|reserved_14|>": 530,
668
- "<|reserved_15|>": 531,
669
- "<|reserved_16|>": 532,
670
- "<|reserved_17|>": 533,
671
  "<|reserved_18|>": 534,
672
  "<|reserved_19|>": 535,
673
  "<|reserved_20|>": 536,
 
38
  "rstrip": false,
39
  "normalized": false,
40
  "special": true
41
+ },
42
+ {
43
+ "id": 518,
44
+ "content": "<|eom|>",
45
+ "single_word": false,
46
+ "lstrip": false,
47
+ "rstrip": false,
48
+ "normalized": false,
49
+ "special": true
50
+ },
51
+ {
52
+ "id": 519,
53
+ "content": "<|bom|>",
54
+ "single_word": false,
55
+ "lstrip": false,
56
+ "rstrip": false,
57
+ "normalized": false,
58
+ "special": true
59
+ },
60
+ {
61
+ "id": 520,
62
+ "content": "<|system|>",
63
+ "single_word": false,
64
+ "lstrip": false,
65
+ "rstrip": false,
66
+ "normalized": false,
67
+ "special": true
68
+ },
69
+ {
70
+ "id": 521,
71
+ "content": "<|user|>",
72
+ "single_word": false,
73
+ "lstrip": false,
74
+ "rstrip": false,
75
+ "normalized": false,
76
+ "special": true
77
+ },
78
+ {
79
+ "id": 522,
80
+ "content": "<|assistant|>",
81
+ "single_word": false,
82
+ "lstrip": false,
83
+ "rstrip": false,
84
+ "normalized": false,
85
+ "special": true
86
+ },
87
+ {
88
+ "id": 523,
89
+ "content": "<|tool|>",
90
+ "single_word": false,
91
+ "lstrip": false,
92
+ "rstrip": false,
93
+ "normalized": false,
94
+ "special": true
95
+ },
96
+ {
97
+ "id": 524,
98
+ "content": "<documents>",
99
+ "single_word": false,
100
+ "lstrip": false,
101
+ "rstrip": false,
102
+ "normalized": false,
103
+ "special": true
104
+ },
105
+ {
106
+ "id": 525,
107
+ "content": "</documents>",
108
+ "single_word": false,
109
+ "lstrip": false,
110
+ "rstrip": false,
111
+ "normalized": false,
112
+ "special": true
113
+ },
114
+ {
115
+ "id": 526,
116
+ "content": "<tool_definitions>",
117
+ "single_word": false,
118
+ "lstrip": false,
119
+ "rstrip": false,
120
+ "normalized": false,
121
+ "special": true
122
+ },
123
+ {
124
+ "id": 527,
125
+ "content": "</tool_definitions>",
126
+ "single_word": false,
127
+ "lstrip": false,
128
+ "rstrip": false,
129
+ "normalized": false,
130
+ "special": true
131
+ },
132
+ {
133
+ "id": 528,
134
+ "content": "<active_output_modes>",
135
+ "single_word": false,
136
+ "lstrip": false,
137
+ "rstrip": false,
138
+ "normalized": false,
139
+ "special": true
140
+ },
141
+ {
142
+ "id": 529,
143
+ "content": "</active_output_modes>",
144
+ "single_word": false,
145
+ "lstrip": false,
146
+ "rstrip": false,
147
+ "normalized": false,
148
+ "special": true
149
+ },
150
+ {
151
+ "id": 530,
152
+ "content": "<citations>",
153
+ "single_word": false,
154
+ "lstrip": false,
155
+ "rstrip": false,
156
+ "normalized": false,
157
+ "special": true
158
+ },
159
+ {
160
+ "id": 531,
161
+ "content": "</citations>",
162
+ "single_word": false,
163
+ "lstrip": false,
164
+ "rstrip": false,
165
+ "normalized": false,
166
+ "special": true
167
+ },
168
+ {
169
+ "id": 532,
170
+ "content": "<tool_calls>",
171
+ "single_word": false,
172
+ "lstrip": false,
173
+ "rstrip": false,
174
+ "normalized": false,
175
+ "special": true
176
+ },
177
+ {
178
+ "id": 533,
179
+ "content": "</tool_calls>",
180
+ "single_word": false,
181
+ "lstrip": false,
182
+ "rstrip": false,
183
+ "normalized": false,
184
+ "special": true
185
  }
186
  ],
187
  "normalizer": {
 
277
  "end_of_word_suffix": null,
278
  "fuse_unk": true,
279
  "byte_fallback": true,
280
+ "ignore_merges": false,
281
  "vocab": {
282
  "<|pad|>": 0,
283
  "<|startoftext|>": 1,
 
797
  "<|mask_511|>": 515,
798
  "<|reserved_0|>": 516,
799
  "<|reserved_1|>": 517,
800
+ "<|eom|>": 518,
801
+ "<|bom|>": 519,
802
+ "<|system|>": 520,
803
+ "<|user|>": 521,
804
+ "<|assistant|>": 522,
805
+ "<|tool|>": 523,
806
+ "<documents>": 524,
807
+ "</documents>": 525,
808
+ "<tool_definitions>": 526,
809
+ "</tool_definitions>": 527,
810
+ "<active_output_modes>": 528,
811
+ "</active_output_modes>": 529,
812
+ "<citations>": 530,
813
+ "</citations>": 531,
814
+ "<tool_calls>": 532,
815
+ "</tool_calls>": 533,
816
  "<|reserved_18|>": 534,
817
  "<|reserved_19|>": 535,
818
  "<|reserved_20|>": 536,
tokenizer.model CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:02fd6530b8ede0eedd8e509fcab32da7b1dd04c8119f8498c787100f13112713
3
- size 1124742
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8b0df4fb43262c452ef37061951a06df4c63ca191d02a60ea08f14428af24376
3
+ size 1124714
tokenizer_config.json CHANGED
@@ -1,6 +1,7 @@
1
  {
2
  "add_bos_token": true,
3
  "add_eos_token": false,
 
4
  "added_tokens_decoder": {
5
  "0": {
6
  "content": "<|pad|>",
@@ -33,12 +34,159 @@
33
  "rstrip": false,
34
  "single_word": false,
35
  "special": true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  }
37
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  "bos_token": "<|startoftext|>",
39
- "chat_template": "{% set bom_token='<|bom|>' %}{% set eom_token='<|eom|>' %}{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% else %}{% set loop_messages = messages %}{% set system_message = 'You are a task following system, respond to the user\\'s input precisely. Do not add any additional information.' %}{% endif %}{{ bom_token + 'System: ' + system_message + eom_token + '' }}{% for message in loop_messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% set content = message['content'] %}{% if message['role'] == 'user' %}{{ bom_token + 'User: ' + content.strip() + eom_token }}{% elif message['role'] == 'system' %}{{ bom_token + 'System: ' + content.strip() + eom_token }}{% elif message['role'] == 'assistant' %}{{ bom_token + 'Assistant: ' + content.strip() + eom_token }}{% endif %}{% if message['role'] == 'assistant' and loop.index0 == loop.length - 1 %}{{ 'User: ' }}{% elif message['role'] == 'user' and loop.index0 == loop.length - 1 %}{{ '' + bom_token + 'Assistant:' }}{% else %}{{ '' }}{% endif %}{% endfor %}",
40
  "clean_up_tokenization_spaces": false,
41
  "eos_token": "<|endoftext|>",
 
42
  "model_max_length": 1000000000000000019884624838656,
43
  "pad_token": "<|pad|>",
44
  "spaces_between_special_tokens": false,
 
1
  {
2
  "add_bos_token": true,
3
  "add_eos_token": false,
4
+ "add_prefix_space": null,
5
  "added_tokens_decoder": {
6
  "0": {
7
  "content": "<|pad|>",
 
34
  "rstrip": false,
35
  "single_word": false,
36
  "special": true
37
+ },
38
+ "518": {
39
+ "content": "<|eom|>",
40
+ "lstrip": false,
41
+ "normalized": false,
42
+ "rstrip": false,
43
+ "single_word": false,
44
+ "special": true
45
+ },
46
+ "519": {
47
+ "content": "<|bom|>",
48
+ "lstrip": false,
49
+ "normalized": false,
50
+ "rstrip": false,
51
+ "single_word": false,
52
+ "special": true
53
+ },
54
+ "520": {
55
+ "content": "<|system|>",
56
+ "lstrip": false,
57
+ "normalized": false,
58
+ "rstrip": false,
59
+ "single_word": false,
60
+ "special": true
61
+ },
62
+ "521": {
63
+ "content": "<|user|>",
64
+ "lstrip": false,
65
+ "normalized": false,
66
+ "rstrip": false,
67
+ "single_word": false,
68
+ "special": true
69
+ },
70
+ "522": {
71
+ "content": "<|assistant|>",
72
+ "lstrip": false,
73
+ "normalized": false,
74
+ "rstrip": false,
75
+ "single_word": false,
76
+ "special": true
77
+ },
78
+ "523": {
79
+ "content": "<|tool|>",
80
+ "lstrip": false,
81
+ "normalized": false,
82
+ "rstrip": false,
83
+ "single_word": false,
84
+ "special": true
85
+ },
86
+ "524": {
87
+ "content": "<documents>",
88
+ "lstrip": false,
89
+ "normalized": false,
90
+ "rstrip": false,
91
+ "single_word": false,
92
+ "special": true
93
+ },
94
+ "525": {
95
+ "content": "</documents>",
96
+ "lstrip": false,
97
+ "normalized": false,
98
+ "rstrip": false,
99
+ "single_word": false,
100
+ "special": true
101
+ },
102
+ "526": {
103
+ "content": "<tool_definitions>",
104
+ "lstrip": false,
105
+ "normalized": false,
106
+ "rstrip": false,
107
+ "single_word": false,
108
+ "special": true
109
+ },
110
+ "527": {
111
+ "content": "</tool_definitions>",
112
+ "lstrip": false,
113
+ "normalized": false,
114
+ "rstrip": false,
115
+ "single_word": false,
116
+ "special": true
117
+ },
118
+ "528": {
119
+ "content": "<active_output_modes>",
120
+ "lstrip": false,
121
+ "normalized": false,
122
+ "rstrip": false,
123
+ "single_word": false,
124
+ "special": true
125
+ },
126
+ "529": {
127
+ "content": "</active_output_modes>",
128
+ "lstrip": false,
129
+ "normalized": false,
130
+ "rstrip": false,
131
+ "single_word": false,
132
+ "special": true
133
+ },
134
+ "530": {
135
+ "content": "<citations>",
136
+ "lstrip": false,
137
+ "normalized": false,
138
+ "rstrip": false,
139
+ "single_word": false,
140
+ "special": true
141
+ },
142
+ "531": {
143
+ "content": "</citations>",
144
+ "lstrip": false,
145
+ "normalized": false,
146
+ "rstrip": false,
147
+ "single_word": false,
148
+ "special": true
149
+ },
150
+ "532": {
151
+ "content": "<tool_calls>",
152
+ "lstrip": false,
153
+ "normalized": false,
154
+ "rstrip": false,
155
+ "single_word": false,
156
+ "special": true
157
+ },
158
+ "533": {
159
+ "content": "</tool_calls>",
160
+ "lstrip": false,
161
+ "normalized": false,
162
+ "rstrip": false,
163
+ "single_word": false,
164
+ "special": true
165
  }
166
  },
167
+ "additional_special_tokens": [
168
+ "<|eom|>",
169
+ "<|bom|>",
170
+ "<|system|>",
171
+ "<|user|>",
172
+ "<|assistant|>",
173
+ "<|tool|>",
174
+ "<documents>",
175
+ "</documents>",
176
+ "<tool_definitions>",
177
+ "</tool_definitions>",
178
+ "<active_output_modes>",
179
+ "</active_output_modes>",
180
+ "<citations>",
181
+ "</citations>",
182
+ "<tool_calls>",
183
+ "</tool_calls>"
184
+ ],
185
  "bos_token": "<|startoftext|>",
186
+ "chat_template": "{# Variables #}\n{% set ns = namespace(message_count=0, is_last_checked_defined=False) %}\n{##}\n{% set bom_str = bom_str or \"<|bom|>\" %}\n{% set eom_str = eom_str or \"<|eom|>\" %}\n{% set default_system_message = \"\" %}\n{##}\n{% set documents_prefix = \"<documents>\" %}\n{% set documents_suffix = \"</documents>\" %}\n{% set tool_definitions_prefix = \"<tool_definitions>\" %}\n{% set tool_definitions_suffix = \"</tool_definitions>\" %}\n{% set active_modes_prefix = \"<active_output_modes>\" %}\n{% set active_modes_suffix = \"</active_output_modes>\" %}\n{##}\n{% set tool_calls_prefix = \"<tool_calls>\" %}\n{% set tool_calls_suffix = \"</tool_calls>\" %}\n{% set citations_prefix = \"<citations>\" %}\n{% set citations_suffix = \"</citations>\" %}\n{##}\n{% if add_generation_prompt is not defined %}\n {% set add_generation_prompt = True %}\n{% endif %}\n{% set role_to_predict = role_to_predict or \"assistant\" %}\n{% if messages|length > 0 and messages[0].role == \"system\" %}\n {% set system_message = messages[0].content %}\n {% set loop_messages = messages[1:] %}\n{% else %}\n {% set system_message = default_system_message %}\n {% set loop_messages = messages %}\n{% endif %}\n{##}\n{##}\n{# Macros #}\n{% macro handle_tool_definitions(tools) %}\n {{- tool_definitions_prefix -}}\n {{- \"\\n# Tools\" -}}\n {{- \"\\n\\n## Functions\" -}}\n {% for tool in tools %}\n {% set _ = is_param_set(tool, field=\"type\") %}\n {% set is_tool_type_set = ns.is_last_checked_defined %}\n {% if is_tool_type_set %}\n {% if tool.type == \"function\" %}\n {% set tool = tool.function %}\n {% else %}\n {{ raise_exception(\"Currently, the only supported tool type is `function`\") }}\n {% endif %}\n {% endif %}\n {{- \"\\n\\n\" + (tool|tojson(indent=2)) -}}\n {% endfor %}\n {{- \"\\n\" + tool_definitions_suffix -}}\n{% endmacro %}\n{##}\n{% macro handle_first_system_message(system_message, tools) %}\n {{- bom_str + handle_role(\"system\") -}}\n {% set _ = is_param_set(system_message) %}\n {% set is_system_message_set = ns.is_last_checked_defined %}\n {% if is_system_message_set %}\n {{- system_message -}}\n {% endif %}\n {% set _ = is_param_set(tools, is_list=True) %}\n {% set is_tools_set = ns.is_last_checked_defined %}\n {% if is_tools_set %}\n {% if system_message %}\n {{- \"\\n\\n\" -}}\n {% endif %}\n {{- handle_tool_definitions(tools) -}}\n {% endif %}\n {% set ns.message_count = ns.message_count + 1 %}\n{% endmacro %}\n{##}\n{% macro handle_tool_calls(tool_calls) %}\n {{- tool_calls_prefix + \"[\\n\" -}}\n {% for tool_call in tool_calls %}\n {% set _ = is_param_set(tool_call, field=\"function\") %}\n {% set is_tool_call_function_set = ns.is_last_checked_defined %}\n {% if is_tool_call_function_set %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {% set arguments = tool_call.arguments %}\n {% if arguments is not string %}\n {%- set arguments = arguments|tojson -%}\n {%- endif %}\n {{ \"{\\\"name\\\": \\\"\" + tool_call.name + \"\\\", \\\"arguments\\\": \" + arguments + \"}\" -}}\n {% if not loop.last %}\n {{- \",\" }}\n {% endif %}\n {% endfor %}\n {{- \"\\n]\" + tool_calls_suffix -}}\n{% endmacro %}\n{##}\n{% macro handle_documents(documents) %}\n {{- documents_prefix -}}\n {{- \"\\n# Documents\" -}}\n {{- \"\\n\\nYou can use the following documents for reference:\" -}}\n {% for doc in documents %}\n {{- \"\\n\\n## Document ID: \" + loop.index0|string -}}\n {% set _ = is_param_set(doc, field=\"title\") %}\n {% set is_doc_title_set = ns.is_last_checked_defined %}\n {% if is_doc_title_set %}\n {{- \"\\nTitle: \" + doc.title -}}\n {% endif %}\n {% for key, value in doc.items() %}\n {% if key not in [\"title\", \"text\"] %}\n {{- \"\\n\" + key|title + \": \" + value|string -}}\n {% endif %}\n {% endfor %}\n {{- \"\\nText: \" + doc.text -}}\n {% endfor %}\n {{- \"\\n\" + documents_suffix -}}\n{% endmacro %}\n{##}\n{% macro handle_knobs(knobs) %}\n {{- active_modes_prefix -}}\n {{- \"\\n# Active Modes\" -}}\n {{ \"\\n\\nThe following modes configure the format or style of your responses. You should adhere to all currently\" -}}\n {{ \" active modes simultaneously.\" -}}\n {% if knobs.citation_mode == \"fast\" %}\n {{- \"\\n\\n## Citation Mode\" -}}\n {{- \"\\n\\nProvide a list of references only for the documents you base your response on. Format your response\" -}}\n {{ \" with the original answer followed by a citation section. Use this template:\" -}}\n {{ \" `{answer}\" + citations_prefix + \"DOCUMENT_IDS\" + citations_suffix + \"`, where DOCUMENT_IDS are the relevant document numbers\" -}}\n {{ \" (e.g. [2, 5, 9]), or [] if the answer cannot be supported by the provided documents.\" -}}\n {% endif %}\n {% if knobs.response_format == \"json_object\" %}\n {{- \"\\n\\n## JSON Mode\" -}}\n {{ \"\\n\\nProvide your response in JSON format. Adhere strictly to any schema given by the user.\" -}}\n {{ \" If an appropriate JSON format exists, use it without modification.\" -}}\n {% endif %}\n {{- \"\\n\" + active_modes_suffix -}}\n{% endmacro %}\n{##}\n{% macro get_last_user_index(messages) %}\n {% set ns.last_user_index = 0 %}\n {% for message in messages %}\n {% if message.role == 'user' %}\n {% set ns.last_user_index = loop.index0 %}\n {% endif %}\n {% endfor %}\n {{- ns.last_user_index -}}\n{% endmacro %}\n{##}\n{% macro handle_last_system_message(documents, knobs, use_documents, use_knobs) %}\n {{- bom_str + handle_role(\"system\") -}}\n {% set macros_to_call = [] %}\n {% set params_for_macros = [] %}\n {% if use_documents %}\n {% set macros_to_call = macros_to_call + [handle_documents] %}\n {% set params_for_macros = params_for_macros + [[documents]] %}\n {% endif %}\n {% if use_knobs %}\n {% set macros_to_call = macros_to_call + [handle_knobs] %}\n {% set params_for_macros = params_for_macros + [[knobs]] %}\n {% endif %}\n {% for i in range(macros_to_call|length) %}\n {% if i > 0 %}\n {{- \"\\n\\n\" -}}\n {% endif %}\n {{- macros_to_call[i](*params_for_macros[i]) -}}\n {% endfor %}\n {% set ns.message_count = ns.message_count + 1 %}\n{% endmacro %}\n{##}\n{% macro handle_role(role, add_space=True) %}\n {{- \"<|\" + role + \"|>\" -}}\n {% if add_space %}\n {{- \" \" -}}\n {% endif %}\n{% endmacro %}\n{##}\n{% macro is_param_set(param, field=none, is_list=False) %}\n {% if field is not none %}\n {% if field in param %}\n {% set param = param[field] %}\n {% else %}\n {% set param = none %}\n {% endif %}\n {% endif %}\n {% set is_defined = param is defined and param is not none %}\n {% if is_list %}\n {% set ns.is_last_checked_defined = is_defined and param|length > 0 %}\n {% else %}\n {% set ns.is_last_checked_defined = is_defined %}\n {% endif %}\n{% endmacro %}\n{##}\n{##}\n{# Template #}\n{{- \"<|startoftext|>\" -}}\n{% set _ = is_param_set(system_message) %}\n{% set is_system_message_set = ns.is_last_checked_defined %}\n{% set _ = is_param_set(tools, is_list=True) %}\n{% set is_tools_set = ns.is_last_checked_defined %}\n{% set has_system_message = (is_system_message_set or is_tools_set) %}\n{% if has_system_message %}\n {{- handle_first_system_message(system_message, tools) -}}\n{% endif %}\n{% set last_user_index = get_last_user_index(loop_messages)|int %}\n{% for message in loop_messages %}\n {% if loop.index0 == last_user_index %}\n {% set _ = is_param_set(documents, is_list=True) %}\n {% set use_documents = ns.is_last_checked_defined %}\n {% set _ = is_param_set(knobs) %}\n {% set use_knobs = ns.is_last_checked_defined and knobs.is_set %}\n {% set add_last_system_message = use_documents or use_knobs %}\n {% if add_last_system_message %}\n {% if ns.message_count > 0 %}\n {{- eom_str -}}\n {% endif %}\n {{- handle_last_system_message(documents, knobs, use_documents, use_knobs) -}}\n {% endif %}\n {% endif %}\n {% set role = message.role %}\n {% set _ = is_param_set(message, field=\"name\") %}\n {% set is_message_name_set = ns.is_last_checked_defined %}\n {% if is_message_name_set %}\n {% set message_prefix = handle_role(role) + \"(\" + message.name + \")\" %}\n {% else %}\n {% set message_prefix = handle_role(role) %}\n {% endif %}\n {% set content = (message.content or \"\") %}\n {% if content is not string %}\n {% set content = content|tojson %}\n {% endif %}\n {% if ns.message_count > 0 %}\n {{- eom_str -}}\n {% endif %}\n {{- bom_str + message_prefix + content -}}\n {% set _ = is_param_set(message, field=\"tool_calls\", is_list=True) %}\n {% set is_tool_calls_set = ns.is_last_checked_defined %}\n {% if role == \"assistant\" and is_tool_calls_set %}\n {{- handle_tool_calls(message.tool_calls) -}}\n {% endif %}\n {% set _ = is_param_set(message, field=\"citations\", is_list=True) %}\n {% set is_citations_set = ns.is_last_checked_defined %}\n {% if role == \"assistant\" and is_citations_set %}\n {{- citations_prefix + message.citations|map(attribute=\"document_id\")|list|string + citations_suffix -}}\n {% endif %}\n {% set ns.message_count = ns.message_count + 1 %}\n{% endfor %}\n{% if add_generation_prompt %}\n {% if ns.message_count > 0 %}\n {{- eom_str -}}\n {% endif %}\n {{- bom_str + handle_role(role_to_predict, add_space=False) -}}\n {% set _ = is_param_set(generation_preamble) %}\n {% set is_generation_preamble_set = ns.is_last_checked_defined %}\n {% if is_generation_preamble_set and generation_preamble.strip() != \"\" %}\n {{- \" \" + generation_preamble -}}\n {% endif %}\n {% set ns.message_count = ns.message_count + 1 %}\n{% else %}\n {% if ns.message_count > 0 %}\n {{- eom_str -}}\n {% endif %}\n{% endif %}\n",
187
  "clean_up_tokenization_spaces": false,
188
  "eos_token": "<|endoftext|>",
189
+ "legacy": true,
190
  "model_max_length": 1000000000000000019884624838656,
191
  "pad_token": "<|pad|>",
192
  "spaces_between_special_tokens": false,