Upload 2 files (#1)
Browse files- Upload 2 files (fd77c3853f6c79bec52ca3ef8744f7d0c1f6c9e0)
Co-authored-by: John Doe <mooaholic@users.noreply.huggingface.co>
- chat_template.jinja +6 -2
- tokenizer_config.json +4 -3
chat_template.jinja
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
{% set has_system = messages|selectattr('role', 'equalto', 'system')|list|length > 0 %}{% if not has_system %}{{ '<|im_start|>system
|
| 2 |
You are a helpful AI assistant.<|im_end|>
|
| 3 |
' }}{% endif %}{% for message in messages %}{% if message['role'] == 'system' %}{{ '<|im_start|>system
|
| 4 |
-
' + message['content'] }}{% if
|
|
|
|
| 5 |
' }}{% else %}{{ ' You do not currently have access to any functions. <functions></functions><|im_end|>
|
| 6 |
' }}{% endif %}{% elif message['role'] == 'user' %}{% if message.get('functions', none) is not none %}{{ '<|im_start|>user
|
| 7 |
' + message['content'] + '
|
|
@@ -9,8 +10,11 @@ You are a helpful AI assistant.<|im_end|>
|
|
| 9 |
' }}{% else %}{{ '<|im_start|>user
|
| 10 |
' + message['content'] + '<|im_end|>
|
| 11 |
' }}{% endif %}{% elif message['role'] == 'assistant' %}{{ '<|im_start|>assistant
|
| 12 |
-
' }}{% if message.get('content', none) is not none %}{{ message['content'] }}{% endif %}{% if message.get('function_calls', none) is not none %}{{ '<function_calls>' + message['function_calls'] + '</function_calls>' }}{%
|
|
|
|
| 13 |
' }}{% else %}{{ eos_token }}{% endif %}{% elif message['role'] == 'environment' %}{{ '<|im_start|>environment
|
| 14 |
' + message['content'] + '<|im_end|>
|
|
|
|
|
|
|
| 15 |
' }}{% endif %}{% if loop.last and add_generation_prompt %}{{ '<|im_start|>assistant
|
| 16 |
<think>' }}{% endif %}{% endfor %}
|
|
|
|
| 1 |
{% set has_system = messages|selectattr('role', 'equalto', 'system')|list|length > 0 %}{% if not has_system %}{{ '<|im_start|>system
|
| 2 |
You are a helpful AI assistant.<|im_end|>
|
| 3 |
' }}{% endif %}{% for message in messages %}{% if message['role'] == 'system' %}{{ '<|im_start|>system
|
| 4 |
+
' + message['content'] }}{% if tools is defined and tools %}{{ ' <functions>' }}{{ tools | tojson }}{{ '</functions><|im_end|>
|
| 5 |
+
' }}{% elif message.get('functions', none) is not none %}{{ ' <functions>' }}{{ message['functions'] }}{{ '</functions><|im_end|>
|
| 6 |
' }}{% else %}{{ ' You do not currently have access to any functions. <functions></functions><|im_end|>
|
| 7 |
' }}{% endif %}{% elif message['role'] == 'user' %}{% if message.get('functions', none) is not none %}{{ '<|im_start|>user
|
| 8 |
' + message['content'] + '
|
|
|
|
| 10 |
' }}{% else %}{{ '<|im_start|>user
|
| 11 |
' + message['content'] + '<|im_end|>
|
| 12 |
' }}{% endif %}{% elif message['role'] == 'assistant' %}{{ '<|im_start|>assistant
|
| 13 |
+
' }}{% if message.get('content', none) is not none %}{{ message['content'] }}{% endif %}{% if message.get('function_calls', none) is not none %}{{ '<function_calls>' + message['function_calls'] + '</function_calls>' }}{% elif message.get('tool_calls', none) is not none %}{{ '<function_calls>' }}{%- for tc in message['tool_calls'] %}{%- if tc is mapping and tc.get('function', none) is not none %}{%- set a = tc['function']['arguments'] %}{%- set ns = namespace(al=[]) %}{%- for k,v in a.items() %}{%- set ns.al = ns.al + [k ~ '=' ~ (v | tojson)] %}{%- endfor %}{{- tc['function']['name'] + '(' + (ns.al | join(', ')) + ')' }}{%- if not loop.last %}{{ '
|
| 14 |
+
' }}{%- endif %}{%- else %}{{ tc }}{%- endif %}{%- endfor %}{{ '</function_calls>' }}{% endif %}{% if not loop.last %}{{ '<|im_end|>' + '
|
| 15 |
' }}{% else %}{{ eos_token }}{% endif %}{% elif message['role'] == 'environment' %}{{ '<|im_start|>environment
|
| 16 |
' + message['content'] + '<|im_end|>
|
| 17 |
+
' }}{% elif message['role'] == 'tool' %}{{ '<|im_start|>environment
|
| 18 |
+
' + message['content'] + '<|im_end|>
|
| 19 |
' }}{% endif %}{% if loop.last and add_generation_prompt %}{{ '<|im_start|>assistant
|
| 20 |
<think>' }}{% endif %}{% endfor %}
|
tokenizer_config.json
CHANGED
|
@@ -4,10 +4,11 @@
|
|
| 4 |
"bos_token": "<|endoftext|>",
|
| 5 |
"clean_up_tokenization_spaces": false,
|
| 6 |
"eos_token": "<|endoftext|>",
|
| 7 |
-
"is_local":
|
| 8 |
"local_files_only": false,
|
| 9 |
"model_max_length": 65536,
|
| 10 |
"pad_token": "<|pad|>",
|
| 11 |
"tokenizer_class": "TokenizersBackend",
|
| 12 |
-
"unk_token": "<|endoftext|>"
|
| 13 |
-
}
|
|
|
|
|
|
| 4 |
"bos_token": "<|endoftext|>",
|
| 5 |
"clean_up_tokenization_spaces": false,
|
| 6 |
"eos_token": "<|endoftext|>",
|
| 7 |
+
"is_local": false,
|
| 8 |
"local_files_only": false,
|
| 9 |
"model_max_length": 65536,
|
| 10 |
"pad_token": "<|pad|>",
|
| 11 |
"tokenizer_class": "TokenizersBackend",
|
| 12 |
+
"unk_token": "<|endoftext|>",
|
| 13 |
+
"chat_template": "{% set has_system = messages|selectattr('role', 'equalto', 'system')|list|length > 0 %}{% if not has_system %}{{ '<|im_start|>system\nYou are a helpful AI assistant.<|im_end|>\n' }}{% endif %}{% for message in messages %}{% if message['role'] == 'system' %}{{ '<|im_start|>system\n' + message['content'] }}{% if tools is defined and tools %}{{ ' <functions>' }}{{ tools | tojson }}{{ '</functions><|im_end|>\n' }}{% elif message.get('functions', none) is not none %}{{ ' <functions>' }}{{ message['functions'] }}{{ '</functions><|im_end|>\n' }}{% else %}{{ ' You do not currently have access to any functions. <functions></functions><|im_end|>\n' }}{% endif %}{% elif message['role'] == 'user' %}{% if message.get('functions', none) is not none %}{{ '<|im_start|>user\n' + message['content'] + '\n' + '<functions>' + message['functions'] + '</functions><|im_end|>\n' }}{% else %}{{ '<|im_start|>user\n' + message['content'] + '<|im_end|>\n' }}{% endif %}{% elif message['role'] == 'assistant' %}{{ '<|im_start|>assistant\n' }}{% if message.get('content', none) is not none %}{{ message['content'] }}{% endif %}{% if message.get('function_calls', none) is not none %}{{ '<function_calls>' + message['function_calls'] + '</function_calls>' }}{% elif message.get('tool_calls', none) is not none %}{{ '<function_calls>' }}{%- for tc in message['tool_calls'] %}{%- if tc is mapping and tc.get('function', none) is not none %}{%- set a = tc['function']['arguments'] %}{%- set ns = namespace(al=[]) %}{%- for k,v in a.items() %}{%- set ns.al = ns.al + [k ~ '=' ~ (v | tojson)] %}{%- endfor %}{{- tc['function']['name'] + '(' + (ns.al | join(', ')) + ')' }}{%- if not loop.last %}{{ '\n' }}{%- endif %}{%- else %}{{ tc }}{%- endif %}{%- endfor %}{{ '</function_calls>' }}{% endif %}{% if not loop.last %}{{ '<|im_end|>' + '\n' }}{% else %}{{ eos_token }}{% endif %}{% elif message['role'] == 'environment' %}{{ '<|im_start|>environment\n' + message['content'] + '<|im_end|>\n' }}{% elif message['role'] == 'tool' %}{{ '<|im_start|>environment\n' + message['content'] + '<|im_end|>\n' }}{% endif %}{% if loop.last and add_generation_prompt %}{{ '<|im_start|>assistant\n<think>' }}{% endif %}{% endfor %}"
|
| 14 |
+
}
|