Upload chat_template.jinja with huggingface_hub
Browse files- chat_template.jinja +41 -0
chat_template.jinja
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[gMASK]<sop>
|
| 2 |
+
{%- if tools -%}
|
| 3 |
+
<|system|>
|
| 4 |
+
# 可用工具
|
| 5 |
+
{% for tool in tools %}
|
| 6 |
+
{%- set function = tool.function if tool.get("function") else tool %}
|
| 7 |
+
|
| 8 |
+
## {{ function.name }}
|
| 9 |
+
|
| 10 |
+
{{ function | tojson(indent=4, ensure_ascii=False) }}
|
| 11 |
+
在调用上述函数时,请使用 Json 格式表示调用的参数。
|
| 12 |
+
{%- endfor %}
|
| 13 |
+
{%- endif -%}
|
| 14 |
+
|
| 15 |
+
{%- for msg in messages %}
|
| 16 |
+
{%- if msg.role == 'system' %}
|
| 17 |
+
<|system|>
|
| 18 |
+
{{ msg.content }}
|
| 19 |
+
{%- endif %}
|
| 20 |
+
{%- endfor %}
|
| 21 |
+
|
| 22 |
+
{%- for message in messages if message.role != 'system' %}
|
| 23 |
+
{%- set role = message['role'] %}
|
| 24 |
+
{%- set content = message['content'] %}
|
| 25 |
+
{%- set meta = message.get("metadata", "") %}
|
| 26 |
+
|
| 27 |
+
{%- if role == 'user' %}
|
| 28 |
+
<|user|>
|
| 29 |
+
{{ content }}
|
| 30 |
+
{%- elif role == 'assistant' and not meta %}
|
| 31 |
+
<|assistant|>
|
| 32 |
+
{{ content }}
|
| 33 |
+
{%- elif role == 'assistant' and meta %}
|
| 34 |
+
<|assistant|>{{ meta }}
|
| 35 |
+
{{ content }}
|
| 36 |
+
{%- elif role == 'observation' %}
|
| 37 |
+
<|observation|>
|
| 38 |
+
{{ content }}
|
| 39 |
+
{%- endif %}
|
| 40 |
+
{%- endfor %}
|
| 41 |
+
{% if add_generation_prompt %}<|assistant|>{% endif %}
|