isbondarev commited on
Commit
e801859
·
verified ·
1 Parent(s): 8adc4df

Upload tokenizer

Browse files
Files changed (2) hide show
  1. chat_template.jinja +55 -0
  2. tokenizer_config.json +0 -1
chat_template.jinja ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {%- if messages[0]['role'] == 'system' %}
3
+ {{-'<_system>'+messages[0]['content'] }}
4
+ {%- else %}
5
+ {{- '<_system>'+'你是中国电信星辰语义大模型,英文名是TeleChat,你是由中电信人工智能科技有限公司和中国电信人工智能研究院(TeleAI)研发的人工智能助手。' }}
6
+ {%- endif %}
7
+ {{- '\n\n# 可用工具\n你可以调用<tools></tools>标签中包含的一个或多个工具来辅助你回答问题,以下是可用工具详情:\n<tools>\n' }}
8
+ {%- for tool in tools %}
9
+ {{- tool | tojson }}
10
+ {{-'\n'}}
11
+ {%- endfor %}
12
+ {{- '</tools>\n\n# 调用方法\n你需要遵循工具的要求,使用json格式返回工具名称及参数,并用<tool_call></tool_call>包含。下方是一个调用模板:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call>\n\n' }}
13
+ {%- else %}
14
+ {%- if messages[0]['role'] == 'system' %}
15
+ {{- '<_system>' + messages[0]['content'] + '\n' }}
16
+ {%- else %}
17
+ {{- '<_system>'+'你是中国电信星辰语义大模型,英文名是TeleChat,你是由中电信人工智能科技有限公司和中国电信人工智能研究院(TeleAI)研发的人工智能助手。\n' }}
18
+ {%- endif %}
19
+ {%- endif %}
20
+ {%- for message in messages %}
21
+ {%- if (message.role == 'user') %}
22
+ {{- '<_user>' + message.content }}
23
+ {%- elif message.role == 'bot' or message.role == 'assistant' %}
24
+ {{- '<_bot>' }}
25
+ {%- if message.content %}
26
+ {{- message.content }}
27
+ {%- endif %}
28
+ {%- for tool_call in message.tool_calls %}
29
+ {%- if tool_call.function is defined %}
30
+ {%- set tool_call = tool_call.function %}
31
+ {%- endif %}
32
+ {%- if loop.index0 == 0 %}
33
+ {{-'<tool_call>'}}
34
+ {%- else %}
35
+ {{-'\n<tool_call>'}}
36
+ {%- endif %}
37
+ {{- '\n{"name": "' }}{{ tool_call.name }}
38
+ {{- '", "arguments": ' }}
39
+ {{- tool_call.arguments | tojson }}
40
+ {{- '}\n</tool_call>' }}
41
+ {%- endfor %}
42
+ {{- '<_end>\n' }}
43
+ {%- elif message.role == 'tool' %}
44
+ {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != 'tool') %}
45
+ {{- '<_user>'+'<tool_response>\n' }}
46
+ {%- else %}
47
+ {{- '\n<tool_response>\n' }}
48
+ {%- endif %}
49
+ {{- message.content }}
50
+ {{- '\n</tool_response>' }}
51
+ {%- endif %}
52
+ {%- endfor %}
53
+ {%- if add_generation_prompt %}
54
+ {{- '<_bot>' }}
55
+ {%- endif %}
tokenizer_config.json CHANGED
@@ -102,7 +102,6 @@
102
  ]
103
  },
104
  "bos_token": "<_start>",
105
- "chat_template": "{%- if tools %}\n {%- if messages[0]['role'] == 'system' %}\n {{-'<_system>'+messages[0]['content'] }}\n {%- else %}\n {{- '<_system>'+'你是中国电信星辰语义大模型,英文名是TeleChat,你是由中电信人工智能科技有限公司和中国电信人工智能研究院(TeleAI)研发的人工智能助手。' }}\n {%- endif %}\n {{- '\\n\\n# 可用工具\\n你可以调用<tools></tools>标签中包含的一个或多个工具来辅助你回答问题,以下是可用工具详情:\\n<tools>\\n' }}\n {%- for tool in tools %}\n {{- tool | tojson }}\n {{-'\\n'}}\n {%- endfor %}\n {{- '</tools>\\n\\n# 调用方法\\n你需要遵循工具的要求,使用json格式返回工具名称及参数,并用<tool_call></tool_call>包含。下方是一个调用模板:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call>\\n\\n' }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<_system>' + messages[0]['content'] + '\\n' }}\n {%- else %}\n {{- '<_system>'+'你是中国电信星辰语义大模型,英文名是TeleChat,你是由中电信人工智能科技有限公司和中国电信人工智能研究院(TeleAI)研发的人工智能助手。\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == 'user') %}\n {{- '<_user>' + message.content }}\n {%- elif message.role == 'bot' or message.role == 'assistant' %}\n {{- '<_bot>' }}\n {%- if message.content %}\n {{- message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {%- if loop.index0 == 0 %}\n {{-'<tool_call>'}}\n {%- else %}\n {{-'\\n<tool_call>'}}\n {%- endif %}\n {{- '\\n{\"name\": \"' }}{{ tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<_end>\\n' }}\n {%- elif message.role == 'tool' %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != 'tool') %}\n {{- '<_user>'+'<tool_response>\\n' }}\n {%- else %}\n {{- '\\n<tool_response>\\n' }}\n {%- endif %}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<_bot>' }}\n{%- endif %}",
106
  "clean_up_tokenization_spaces": false,
107
  "eos_token": "<_end>",
108
  "extra_special_tokens": {},
 
102
  ]
103
  },
104
  "bos_token": "<_start>",
 
105
  "clean_up_tokenization_spaces": false,
106
  "eos_token": "<_end>",
107
  "extra_special_tokens": {},