root
commited on
Commit
·
583e1ce
1
Parent(s):
c029167
update
Browse filesSigned-off-by: root <root@rack-ge107-ya-20250517193228.idczw.hb1.kwaidc.com>
- chat_template.jinja +88 -0
- search_results_think_in.txt +0 -10
- special_tokens_map.json +8 -0
- tokenizer_config.json +0 -1
chat_template.jinja
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- if tools %}
|
| 2 |
+
{{- '<|im_start|>system\n' }}
|
| 3 |
+
{%- if messages[0]['role'] == 'system' %}
|
| 4 |
+
{{- messages[0]['content'] }}
|
| 5 |
+
{%- else %}
|
| 6 |
+
{{- '' }}
|
| 7 |
+
{%- endif %}
|
| 8 |
+
{{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
| 9 |
+
{%- for tool in tools %}
|
| 10 |
+
{{- "\n" }}
|
| 11 |
+
{{- tool | tojson }}
|
| 12 |
+
{%- endfor %}
|
| 13 |
+
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
| 14 |
+
{%- else %}
|
| 15 |
+
{%- if messages[0]['role'] == 'system' %}
|
| 16 |
+
{{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
|
| 17 |
+
{%- else %}
|
| 18 |
+
{{- '<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n' }}
|
| 19 |
+
{%- endif %}
|
| 20 |
+
{%- endif %}
|
| 21 |
+
{%- for message in messages %}
|
| 22 |
+
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
| 23 |
+
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
| 24 |
+
{%- elif message.role == "assistant" and not message.tool_calls %}
|
| 25 |
+
{%- set content = message.content %}
|
| 26 |
+
{%- if not loop.last %}
|
| 27 |
+
{%- set answer_blocks = message.content.split('<answer>\n') %}
|
| 28 |
+
{%- if answer_blocks|length > 1 %}
|
| 29 |
+
{%- set last_answer_block = answer_blocks[-1] %}
|
| 30 |
+
{%- if '\n</answer>' in last_answer_block %}
|
| 31 |
+
{%- set content = last_answer_block.split('\n</answer>')[0] %}
|
| 32 |
+
{%- else %}
|
| 33 |
+
{%- set content = message.content.split('<think_off>')[-1].lstrip('\n') %}
|
| 34 |
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 35 |
+
{%- endif %}
|
| 36 |
+
{%- else %}
|
| 37 |
+
{%- set content = message.content.split('<think_off>')[-1].lstrip('\n') %}
|
| 38 |
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 39 |
+
{%- endif %}
|
| 40 |
+
{%- endif %}
|
| 41 |
+
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 42 |
+
{%- elif message.role == "assistant" %}
|
| 43 |
+
{%- set content = message.content %}
|
| 44 |
+
{%- if not loop.last %}
|
| 45 |
+
{%- set answer_blocks = message.content.split('<answer>\n') %}
|
| 46 |
+
{%- if answer_blocks|length > 1 %}
|
| 47 |
+
{%- set last_answer_block = answer_blocks[-1] %}
|
| 48 |
+
{%- if '\n</answer>' in last_answer_block %}
|
| 49 |
+
{%- set content = last_answer_block.split('\n</answer>')[0] %}
|
| 50 |
+
{%- else %}
|
| 51 |
+
{%- set content = message.content.split('<think_off>')[-1].lstrip('\n') %}
|
| 52 |
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 53 |
+
{%- endif %}
|
| 54 |
+
{%- else %}
|
| 55 |
+
{%- set content = message.content.split('<think_off>')[-1].lstrip('\n') %}
|
| 56 |
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 57 |
+
{%- endif %}
|
| 58 |
+
{%- endif %}
|
| 59 |
+
{{- '<|im_start|>' + message.role }}
|
| 60 |
+
{%- if message.content %}
|
| 61 |
+
{{- '\n' + content }}
|
| 62 |
+
{%- endif %}
|
| 63 |
+
{%- for tool_call in message.tool_calls %}
|
| 64 |
+
{%- if tool_call.function is defined %}
|
| 65 |
+
{%- set tool_call = tool_call.function %}
|
| 66 |
+
{%- endif %}
|
| 67 |
+
{{- '\n<tool_call>\n{\"name\": \"' }}
|
| 68 |
+
{{- tool_call.name }}
|
| 69 |
+
{{- '\", \"arguments\": ' }}
|
| 70 |
+
{{- tool_call.arguments | tojson }}
|
| 71 |
+
{{- '}\n</tool_call>' }}
|
| 72 |
+
{%- endfor %}
|
| 73 |
+
{{- '<|im_end|>\n' }}
|
| 74 |
+
{%- elif message.role == "tool" %}
|
| 75 |
+
{%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
|
| 76 |
+
{{- '<|im_start|>user' }}
|
| 77 |
+
{%- endif %}
|
| 78 |
+
{{- '\n<tool_response>\n' }}
|
| 79 |
+
{{- message.content }}
|
| 80 |
+
{{- '\n</tool_response>' }}
|
| 81 |
+
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
| 82 |
+
{{- '<|im_end|>\n' }}
|
| 83 |
+
{%- endif %}
|
| 84 |
+
{%- endif %}
|
| 85 |
+
{%- endfor %}
|
| 86 |
+
{%- if add_generation_prompt %}
|
| 87 |
+
{{- '<|im_start|>assistant\n<judge>\n' }}
|
| 88 |
+
{%- endif %}
|
search_results_think_in.txt
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
搜索字符串: 'think_in'
|
| 2 |
-
搜索目录: /share/xiangwen/model_new/qwen_1_7b_cpt_autothink/stage_qwen_1_7b_cpt_global_step_1600
|
| 3 |
-
搜索时间: 2025-10-31 05:09:51.341993
|
| 4 |
-
找到 5 个匹配文件:
|
| 5 |
-
|
| 6 |
-
output/LCBv4v5plus/20251006_193241/predictions/stage_qwen_1_7b_cpt_global_step_1600/lcb_code_generation_0.json
|
| 7 |
-
output/LCBv4v5plus/20251006_193241/predictions/stage_qwen_1_7b_cpt_global_step_1600/lcb_code_generation_1.json
|
| 8 |
-
output/humaneval/20251006_193251/predictions/stage_qwen_1_7b_cpt_global_step_1600/openai_humaneval_1.json
|
| 9 |
-
output/mbpp/20251006_193241/predictions/stage_qwen_1_7b_cpt_global_step_1600/mbpp_passk_0.json
|
| 10 |
-
output/mbpp/20251006_193241/predictions/stage_qwen_1_7b_cpt_global_step_1600/mbpp_passk_1.json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
special_tokens_map.json
CHANGED
|
@@ -1,4 +1,12 @@
|
|
| 1 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
"eos_token": {
|
| 3 |
"content": "<|im_end|>",
|
| 4 |
"lstrip": false,
|
|
|
|
| 1 |
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
"<judge>",
|
| 4 |
+
"</judge>",
|
| 5 |
+
"<answer>",
|
| 6 |
+
"</answer>",
|
| 7 |
+
"<think_on>",
|
| 8 |
+
"<think_off>"
|
| 9 |
+
],
|
| 10 |
"eos_token": {
|
| 11 |
"content": "<|im_end|>",
|
| 12 |
"lstrip": false,
|
tokenizer_config.json
CHANGED
|
@@ -260,7 +260,6 @@
|
|
| 260 |
}
|
| 261 |
},
|
| 262 |
"bos_token": null,
|
| 263 |
-
"chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- '' }}\n {%- endif %}\n {{- \"\\n\\n# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0]['content'] + '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>system\\nYou are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" and not message.tool_calls %}\n {%- set content = message.content %}\n {%- if not loop.last %}\n {%- set answer_blocks = message.content.split('<answer>\\n') %}\n {%- if answer_blocks|length > 1 %}\n {%- set last_answer_block = answer_blocks[-1] %}\n {%- if '\\n</answer>' in last_answer_block %}\n {%- set content = last_answer_block.split('\\n</answer>')[0] %}\n {%- else %}\n {%- set content = message.content.split('<think_off>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- else %}\n {%- set content = message.content.split('<think_off>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set content = message.content %}\n {%- if not loop.last %}\n {%- set answer_blocks = message.content.split('<answer>\\n') %}\n {%- if answer_blocks|length > 1 %}\n {%- set last_answer_block = answer_blocks[-1] %}\n {%- if '\\n</answer>' in last_answer_block %}\n {%- set content = last_answer_block.split('\\n</answer>')[0] %}\n {%- else %}\n {%- set content = message.content.split('<think_off>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- else %}\n {%- set content = message.content.split('<think_off>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + 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 {{- '\\n<tool_call>\\n{\\\"name\\\": \\\"' }}\n {{- tool_call.name }}\n {{- '\\\", \\\"arguments\\\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n<judge>\\n' }}\n{%- endif %}",
|
| 264 |
"clean_up_tokenization_spaces": false,
|
| 265 |
"eos_token": "<|im_end|>",
|
| 266 |
"errors": "replace",
|
|
|
|
| 260 |
}
|
| 261 |
},
|
| 262 |
"bos_token": null,
|
|
|
|
| 263 |
"clean_up_tokenization_spaces": false,
|
| 264 |
"eos_token": "<|im_end|>",
|
| 265 |
"errors": "replace",
|