websterbei
commited on
Commit
•
1269db0
1
Parent(s):
f55ff52
Upload tokenizer
Browse files- tokenizer_config.json +1 -1
tokenizer_config.json
CHANGED
@@ -45,7 +45,7 @@
|
|
45 |
},
|
46 |
"additional_special_tokens": [],
|
47 |
"bos_token": "<s>",
|
48 |
-
"chat_template": "
|
49 |
"clean_up_tokenization_spaces": false,
|
50 |
"eos_token": "</s>",
|
51 |
"legacy": false,
|
|
|
45 |
},
|
46 |
"additional_special_tokens": [],
|
47 |
"bos_token": "<s>",
|
48 |
+
"chat_template": "{%- set message_roles = ['SYSTEM', 'FUNCTIONS', 'USER', 'ASSISTANT', 'TOOL'] -%}\n{%- set ns = namespace(seen_non_system=false, messages=messages, content='', functions=[]) -%}\n{{ bos_token }}\n{#- Basic consistency checks -#}\n{%- if not ns.messages -%}\n {{ raise_exception('No messages') }}\n{%- endif -%}\n{%- if ns.messages[0]['role'] | upper != 'SYSTEM' -%}\n {%- set ns.messages = [{'role': 'SYSTEM', 'content': 'You are a helpful assistant with access to functions. Use them if required.'}] + ns.messages -%}\n{%- endif -%}\n{%- if ns.messages | length < 2 or ns.messages[0]['role'] | upper != 'SYSTEM' or ns.messages[1]['role'] | upper != 'FUNCTIONS' -%}\n {{ raise_exception('Expected either \"functions\" or [\"system\", \"functions\"] as the first messages') }}\n{%- endif -%}\n{%- for message in ns.messages -%}\n {%- set role = message['role'] | upper -%}\n {#- Validation -#}\n {%- if role not in message_roles -%}\n {{ raise_exception('Invalid role ' + message['role'] + '. Only ' + message_roles + ' are supported.') }}\n {%- endif -%}\n {%- set ns.content = message['content'] if message.get('content') else '' -%}\n {#- Move tool calls inside the content -#}\n {%- if 'tool_calls' in message -%}\n {%- for call in message['tool_calls'] -%}\n {%- set ns.content = ns.content + '<functioncall>{\"name\": \"' + call['function']['name'] + '\", \"arguments\": ' + call['function']['arguments'] + '}' -%}\n {%- endfor -%}\n {%- endif -%}\n {%- if role == 'ASSISTANT' and '<functioncall>' not in ns.content -%}\n {%- set ns.content = '<plain>' + ns.content -%}\n {%- endif -%}\n {%- if role == 'ASSISTANT' -%}\n {%- set ns.content = ns.content + eos_token -%}\n {%- endif -%}\n {{ role }}: {{ ns.content }}{{ '\\n\\n' }}\n{%- endfor -%}\nASSISTANT:{{ ' ' }}\n",
|
49 |
"clean_up_tokenization_spaces": false,
|
50 |
"eos_token": "</s>",
|
51 |
"legacy": false,
|