Upload tokenizer
Browse files- chat_template.jinja +45 -0
- tokenizer_config.json +0 -1
chat_template.jinja
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- if tools %}
|
| 2 |
+
{{- '<|system|>\n' }}
|
| 3 |
+
{%- if messages[0]['role'] == 'system' %}
|
| 4 |
+
{{- messages[0]['content'] }}
|
| 5 |
+
{%- set remaining_messages = messages[1:] %}
|
| 6 |
+
{%- else %}
|
| 7 |
+
{%- set remaining_messages = messages %}
|
| 8 |
+
{%- endif %}
|
| 9 |
+
{{- 'You are a Falcon assistant skilled in function calling. You are helpful, respectful, and concise.\n\n# Tools\n\nYou have access to the following functions. You MUST use them to answer questions when needed. For each function call, you MUST return a JSON object inside <tool_call></tool_call> tags.\n\n<tools>' + tools|tojson(indent=2) + '</tools>\n\n# Output Format\n\nYour response MUST follow this format when making function calls:\n<tool_call>\n[\n {"name": "function_name", "arguments": {"arg1": "value1", "arg2": "value2"}},\n {"name": "another_function", "arguments": {"arg": "value"}}\n]\n</tool_call>\nIf no function calls are needed, respond normally without the tool_call tags.\n' }}
|
| 10 |
+
{%- for message in remaining_messages %}
|
| 11 |
+
{%- if message['role'] == 'user' %}
|
| 12 |
+
{{- '<|user|>\n' + message['content'] + '\n' }}
|
| 13 |
+
{%- elif message['role'] == 'assistant' %}
|
| 14 |
+
{%- if message.content %}
|
| 15 |
+
{{- '<|assistant|>\n' + message['content'] }}
|
| 16 |
+
{%- endif %}
|
| 17 |
+
{%- if message.tool_calls %}
|
| 18 |
+
{{- '\n<tool_call>\n' }}
|
| 19 |
+
{{- message.tool_calls|tojson(indent=2) }}
|
| 20 |
+
{{- '\n</tool_call>' }}
|
| 21 |
+
{%- endif %}
|
| 22 |
+
{{- eos_token + '\n' }}
|
| 23 |
+
{%- elif message['role'] == 'tool' %}
|
| 24 |
+
{{- '<|assistant|>\n<tool_response>\n' + message['content'] + '\n</tool_response>\n' }}
|
| 25 |
+
{%- endif %}
|
| 26 |
+
{%- endfor %}
|
| 27 |
+
{{- '<|assistant|>\n' if add_generation_prompt }}
|
| 28 |
+
{%- else %}
|
| 29 |
+
{%- for message in messages %}
|
| 30 |
+
{%- if message['role'] == 'system' %}
|
| 31 |
+
{{- '<|system|>\n' + message['content'] + '\n' }}
|
| 32 |
+
{%- elif message['role'] == 'user' %}
|
| 33 |
+
{{- '<|user|>\n' + message['content'] + '\n' }}
|
| 34 |
+
{%- elif message['role'] == 'assistant' %}
|
| 35 |
+
{%- if not loop.last %}
|
| 36 |
+
{{- '<|assistant|>\n' + message['content'] + eos_token + '\n' }}
|
| 37 |
+
{%- else %}
|
| 38 |
+
{{- '<|assistant|>\n' + message['content'] + eos_token }}
|
| 39 |
+
{%- endif %}
|
| 40 |
+
{%- endif %}
|
| 41 |
+
{%- if loop.last and add_generation_prompt %}
|
| 42 |
+
{{- '<|assistant|>\n' }}
|
| 43 |
+
{%- endif %}
|
| 44 |
+
{%- endfor %}
|
| 45 |
+
{%- endif %}
|
tokenizer_config.json
CHANGED
|
@@ -16219,7 +16219,6 @@
|
|
| 16219 |
">>PASSWORD<<",
|
| 16220 |
">>KEY<<"
|
| 16221 |
],
|
| 16222 |
-
"chat_template": "{%- if tools %}\n{{- '<|system|>\\n' }}\n{%- if messages[0]['role'] == 'system' %}\n{{- messages[0]['content'] }}\n{%- set remaining_messages = messages[1:] %}\n{%- else %}\n{%- set remaining_messages = messages %}\n{%- endif %}\n{{- 'You are a Falcon assistant skilled in function calling. You are helpful, respectful, and concise.\\n\\n# Tools\\n\\nYou have access to the following functions. You MUST use them to answer questions when needed. For each function call, you MUST return a JSON object inside <tool_call></tool_call> tags.\\n\\n<tools>' + tools|tojson(indent=2) + '</tools>\\n\\n# Output Format\\n\\nYour response MUST follow this format when making function calls:\\n<tool_call>\\n[\\n {\"name\": \"function_name\", \"arguments\": {\"arg1\": \"value1\", \"arg2\": \"value2\"}},\\n {\"name\": \"another_function\", \"arguments\": {\"arg\": \"value\"}}\\n]\\n</tool_call>\\nIf no function calls are needed, respond normally without the tool_call tags.\\n' }}\n{%- for message in remaining_messages %}\n{%- if message['role'] == 'user' %}\n{{- '<|user|>\\n' + message['content'] + '\\n' }}\n{%- elif message['role'] == 'assistant' %}\n{%- if message.content %}\n{{- '<|assistant|>\\n' + message['content'] }}\n{%- endif %}\n{%- if message.tool_calls %}\n{{- '\\n<tool_call>\\n' }}\n{{- message.tool_calls|tojson(indent=2) }}\n{{- '\\n</tool_call>' }}\n{%- endif %}\n{{- eos_token + '\\n' }}\n{%- elif message['role'] == 'tool' %}\n{{- '<|assistant|>\\n<tool_response>\\n' + message['content'] + '\\n</tool_response>\\n' }}\n{%- endif %}\n{%- endfor %}\n{{- '<|assistant|>\\n' if add_generation_prompt }}\n{%- else %}\n{%- for message in messages %}\n{%- if message['role'] == 'system' %}\n{{- '<|system|>\\n' + message['content'] + '\\n' }}\n{%- elif message['role'] == 'user' %}\n{{- '<|user|>\\n' + message['content'] + '\\n' }}\n{%- elif message['role'] == 'assistant' %}\n{%- if not loop.last %}\n{{- '<|assistant|>\\n' + message['content'] + eos_token + '\\n' }}\n{%- else %}\n{{- '<|assistant|>\\n' + message['content'] + eos_token }}\n{%- endif %}\n{%- endif %}\n{%- if loop.last and add_generation_prompt %}\n{{- '<|assistant|>\\n' }}\n{%- endif %}\n{%- endfor %}\n{%- endif %}",
|
| 16223 |
"clean_up_tokenization_spaces": true,
|
| 16224 |
"eos_token": "<|endoftext|>",
|
| 16225 |
"extra_special_tokens": {},
|
|
|
|
| 16219 |
">>PASSWORD<<",
|
| 16220 |
">>KEY<<"
|
| 16221 |
],
|
|
|
|
| 16222 |
"clean_up_tokenization_spaces": true,
|
| 16223 |
"eos_token": "<|endoftext|>",
|
| 16224 |
"extra_special_tokens": {},
|