Upload chat_template.jinja with huggingface_hub
Browse files- chat_template.jinja +16 -0
chat_template.jinja
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 message.get('functions', none) is not none %}{{ ' <functions>' + message['functions'] + '</functions><|im_end|>
|
| 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'] + '
|
| 8 |
+
' + '<functions>' + message['functions'] + '</functions><|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>' }}{% endif %}{% if not loop.last %}{{ '<|im_end|>' + '
|
| 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 %}
|