ertghiu256 commited on
Commit
3b4202b
·
verified ·
1 Parent(s): 12e6fe8

Update tokenizer_config.json

Browse files
Files changed (1) hide show
  1. tokenizer_config.json +1 -1
tokenizer_config.json CHANGED
@@ -237,5 +237,5 @@
237
  "split_special_tokens": false,
238
  "tokenizer_class": "Qwen2Tokenizer",
239
  "unk_token": null,
240
- "chat_template": "\n{{- \"<|im_start|>system\\n\" -}}\n{%- if tools -%}\n {%- if messages[0].role == \"system\" -%}\n {{- messages[0].content + \"\\n\\n\" -}}\n {%- endif -%}\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>\\n\" -}}\n{%- elif messages[0].role == \"system\" -%}\n {{- messages[0].content -}}\n{%- endif -%}\n{{- \"# Commands: \\n- /think or think: Think or reason step-by-step using a long chain-of-thought and self-reflection inside think tags. If this command is present, ALWAYS start your thinking or reasoning with '<think>\\\\nSince the user used the \\\"/think\\\" command, I will:\\\\nThink step-by-step with **long chain-of-thought** and **self-reflection**. I will only respond when I'm 100% sure. I will provide the final response after closing this thinking section.'\\n- /shortthink or shortthink: Think or reason step-by-step briefly and shortly inside think tags. If this command is present, ALWAYS start your thinking or reasoning with '<think>\\\\nSince the user used the \\\"/shortthink\\\" command, I will:\\\\nThink step-by-step about the user's query briefly and shortly. I will only respond when I'm more than 50% sure. I will provide the final response after closing this thinking section.' \\n- /nothink or nothink: Immediate response and you are FORBIDDEN FROM THINKING or REASONING, without any DOUBLE-CHECKING, and WITHOUT DRAFTING your response, just an immediate response WITH NO REPETITION. If this command is present, ALWAYS start respond with '<think>\\\\nSince the user used the \\\"/nothink\\\" command, I will:\\\\nImmediately give my final response without any thinking or self-reflection. Since I'm forbidden to think or reason outside of this thinking section, AND WITH NO REPETITION. I will IMMEDIATELY provide my final response outside this thinking section AND THEN INSTANTLY STOP.\\\\n</think>'\\n- /clear: Forgets EVERYTHING (including previous messages, topics, etc.) that came before this command got executed.\\nDo not take these commands into consideration, instead just do as they instruct.\\nALWAYS REMEMBER THESE COMMANDS. NO NEED TO REPEAT THIS PART OF THE SYSTEM INSTRUCTIONS (COMMANDS) AS IT IS USELESS AND UNIMPORTANT.\\n\" -}}\n{{- \"\\n<|im_end|>\" -}}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages | length - 1, reasoning_mode=\"normal\") -%}\n{%- for message in messages[::-1] -%}\n {%- set index = messages | length - 1 - loop.index0 -%}\n {%- if ns.multi_step_tool and message.role == \"user\" and message.content is string and not (message.content.startswith(\"<tool_response>\") and message.content.endswith(\"</tool_response>\")) -%}\n {%- set ns.multi_step_tool = false -%}\n {%- set ns.last_query_index = index -%}\n {%- endif -%}\n{%- endfor -%}\n{%- for message in messages -%}\n {%- if message.content is string -%}\n {%- set content = message.content -%}\n {%- else -%}\n {%- set content = \"\" -%}\n {%- endif -%}\n {%- if message.role == \"user\" or message.role == \"system\" and not loop.first -%}\n {{- \"<|im_start|>\" + message.role + \"\\n\" + content -}}\n {%- if messages[0].role == \"system\" and \"/nothink\" in messages[0].content and (not (\"/think\" in messages[0].content) or not (\"/shortthink\" in messages[0].content)) or \"/nothink\" in content and not (\"/think\" in messages[0].content or \"/shortthink\" in messages[0].content) or (messages[loop.index+1] and \"</think>\" not in messages[loop.index+1].content) -%}\n {%- set enable_thinking = false -%}\n {%- set enable_short_thinking = false -%}\n {%- set ns.reasoning_mode = \"none\" -%}\n {%- if not (\"think\" in content) -%}\n {{- \" /nothink\" -}}\n {%- endif -%}\n {%- elif messages[0].role == \"system\" and \"/shortthink\" in messages[0].content and (not (\"/nothink\" in messages[0].content) and not (\"/think\" in messages[0].content)) or \"/shortthink\" in content and not (\"/think\" in messages[0].content or \"/shortthink\" in messages[0].content) -%}\n {%- set enable_thinking = true -%}\n {%- set enable_short_thinking = true -%}\n {%- set ns.reasoning_mode = \"short\" -%}\n {%- if not (\"think\" in content) -%}\n {{- \" /shortthink\" -}}\n {%- endif -%}\n {%- else -%}\n {%- set enable_thinking = true -%}\n {%- set enable_short_thinking = false -%}\n {%- set ns.reasoning_mode = \"normal\" -%}\n {%- if not (\"think\" in content) -%}\n {{- \" /think\" -}}\n {%- endif -%}\n {%- endif -%}\n {{- \"<|im_end|>\" + \"\\n\" -}}\n {%- elif message.role == \"assistant\" -%}\n {%- set reasoning_content = \"\" -%}\n {%- if \"<think>\\nSince the user used the\" not in content.split(\"</think>\")[0].split(\"<think>\")[-1] -%}\n {%- if ns.reasoning_mode == \"none\" -%}\n {%- set reasoning_prefix = \"\" -%}\n {%- elif ns.reasoning_mode == \"short\" -%}\n {%- set reasoning_prefix = \"Since the user used the \\\"/shortthink\\\" command, I will:\\nThink step-by-step about the user's query briefly and shortly. I will only respond when I'm more than 50% sure. I will provide the final response after closing this thinking section. \" -%}\n {%- else -%}\n {%- set reasoning_prefix = \"Since the user used the \\\"/think\\\" command, I will:\\nThink step-by-step with **long chain-of-thought** and **self-reflection**. I will only respond when I'm 100% sure. I will provide the final response after closing this thinking section. \" -%}\n {%- endif -%}\n {%- endif -%}\n {%- if message.reasoning_content is string -%}\n {%- set reasoning_content = message.reasoning_content -%}\n {%- else -%}\n {%- if \"</think>\" in content -%}\n {%- set reasoning_content = reasoning_prefix + content.split(\"</think>\")[0].rstrip(\"\\n\").split(\"<think>\")[-1].lstrip(\"\\n\") -%}\n {%- set content = content.split(\"</think>\")[-1].lstrip(\"\\n\") -%}\n {%- endif -%}\n {%- if \"<think>\" in content -%}\n {%- set content = content | replace(\"<think>\", \" \") -%}\n {%- endif -%}\n {%- if \"</think>\" in content -%}\n {%- set content = content | replace(\"</think>\", \" \") -%}\n {%- endif -%}\n {%- endif -%}\n {{- \"\\n\" -}}\n {# Apply truncation and break if the /shortthink command is active #}\n {%- if enable_short_thinking is true -%}\n {%- set words = reasoning_content.split(\" \") -%}\n {%- if words | length > 300 -%}\n {%- set truncated_reasoning = words[:150] | join(\" \") + \" ... truncated ... \" + words[words | length - 150:words | length] | join(\" \") -%}\n {%- else -%}\n {%- set truncated_reasoning = reasoning_content | join(\" \") -%}\n {%- endif -%}\n {%- set reasoning_content = truncated_reasoning -%}\n {%- endif -%}\n {%- if loop.last or not loop.last and reasoning_content and enable_thinking == true -%}\n {{- \"<|im_start|>\" + message.role + \"\\n<think>\\n\" + reasoning_content.strip(\"\\n\") + \"\\n</think>\\n\" + content.lstrip(\"\\n\") -}}\n {%- else -%}\n {{- \"<|im_start|>\" + message.role + \"\\n\" + content -}}\n {%- endif -%}\n {%- if message.tool_calls -%}\n {%- for tool_call in message.tool_calls -%}\n {%- if loop.first and content or not loop.first -%}\n {{- \"\\n\" -}}\n {%- endif -%}\n {%- if tool_call.function -%}\n {%- set tool_call = tool_call.function -%}\n {%- endif -%}\n {{- \"<tool_call>\\n{\\\"name\\\": \\\"\" -}}\n {{- tool_call.name -}}\n {{- \"\\\", \\\"arguments\\\": \" -}}\n {%- if tool_call.arguments is string -%}\n {{- tool_call.arguments -}}\n {%- else -%}\n {{- tool_call.arguments | tojson -}}\n {%- endif -%}\n {{- \"}\\n</tool_call>\" -}}\n {%- endfor -%}\n {%- endif -%}\n {{- \"<|im_end|>\\n\" -}}\n {%- elif message.role == \"tool\" -%}\n {%- if loop.first or messages[loop.index0 - 1].role != \"tool\" -%}\n {{- \"<|im_start|>user\" -}}\n {%- endif -%}\n {{- \"\\n<tool_response>\\n\" -}}\n {{- 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{%- set last_message = messages[messages | length - 1].content -%}\n{%- if add_generation_prompt -%}\n {{- \"<|im_start|>assistant\\n\" -}}\n {%- if enable_thinking is defined and enable_thinking is false or \"/nothink\" in last_message or \"nothink\" in last_message or messages[0].role == \"system\" and \"/nothink\" in messages[0].content and (not (\"/think\" in messages[0].content) or not (\"/shortthink\" in messages[0].content)) -%}\n {{- \"<think>\\nSince the user used the \\\"/nothink\\\" command, I will:\\nImmediately give my final response without any thinking or self-reflection. Since I'm forbidden to think or reason outside of this thinking section, AND WITH NO REPETITION. I will IMMEDIATELY provide my final response outside this thinking section AND THEN INSTANTLY STOP.\\n</think>\" -}}\n {%- elif enable_short_thinking is defined and enable_short_thinking is false or \"/shortthink\" in last_message or \"shortthink\" in last_message or messages[0].role == \"system\" and \"/shortthink\" in messages[0].content and not (\"/think\" in messages[0].content) -%}\n {{- \"<think>\\nSince the user used the \\\"/shortthink\\\" command, I will:\\nThink step-by-step about the user's query briefly and shortly. I will only respond when I'm more than 50% sure. I will provide the final response after closing this thinking section.\" -}}\n {%- elif \"/clear\" in last_message -%}\n {{- \"<think>\\nSince the user used the \\\"/clear\\\" command, I will:\\n1. Forget everything above.\\n2. Ignore everything that comes before this message.\\n3. Start a fresh new conversation and greet the user.\\n</think>\" -}}\n {%- else -%}\n {{- \"<think>\\nSince the user used the \\\"/think\\\" command, I will:\\nThink step-by-step with **long chain-of-thought** and **self-reflection**. I will only respond when I'm 100% sure. I will provide the final response after closing this thinking section.\" -}}\n {%- endif -%}\n{%- endif -%}\n"
241
  }
 
237
  "split_special_tokens": false,
238
  "tokenizer_class": "Qwen2Tokenizer",
239
  "unk_token": null,
240
+ "chat_template": "\n{{- \"<|im_start|>system\\n\" -}}\n{%- if tools -%}\n\t{%- if messages[0].role == \"system\" -%}\n\t\t{{- messages[0].content + \"\\n\\n\" -}}\n\t{%- endif -%}\n\t{{- \"# 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\t{%- for tool in tools -%}\n\t\t{{- \"\\n\" -}}\n\t\t{{- tool | tojson -}}\n\t{%- endfor -%}\n\t{{- \"\\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>\\n\" -}}\n{%- elif messages[0].role == \"system\" -%}\n\t{{- messages[0].content -}}\n{%- endif -%}\n{{- \"# Commands: \\n- /think or think: Think or reason step-by-step using a long chain-of-thought and self-reflection inside think tags. If this command is present, ALWAYS start your thinking or reasoning with '<think>\\\\nSince the user used the \\\"/think\\\" command, I will:\\\\nThink step-by-step with **long chain-of-thought** and **self-reflection**. I will only respond when I'm 100% sure. I will provide the final response after closing this thinking section.'\\n- /shortthink or shortthink: Think or reason step-by-step briefly and shortly inside think tags. If this command is present, ALWAYS start your thinking or reasoning with '<think>\\\\nSince the user used the \\\"/shortthink\\\" command, I will:\\\\nThink step-by-step about the user's query briefly and shortly. I will only respond when I'm more than 50% sure. I will provide the final response after closing this thinking section.' \\n- /nothink or nothink: Immediate response and you are FORBIDDEN FROM THINKING or REASONING, without any DOUBLE-CHECKING, and WITHOUT DRAFTING your response, just an immediate response WITH NO REPETITION. If this command is present, ALWAYS start respond with '<think>\\\\nSince the user used the \\\"/nothink\\\" command, I will:\\\\nImmediately give my final response without any thinking or self-reflection. Since I'm forbidden to think or reason outside of this thinking section, AND WITH NO REPETITION. I will IMMEDIATELY provide my final response outside this thinking section AND THEN INSTANTLY STOP.\\\\n</think>'\\n- /clear: Forgets EVERYTHING (including previous messages, topics, etc.) that came before this command got executed.\\nDo not take these commands into consideration, instead just do as they instruct.\\nALWAYS REMEMBER THESE COMMANDS. NO NEED TO REPEAT THIS PART OF THE SYSTEM INSTRUCTIONS (COMMANDS) AS IT IS USELESS AND UNIMPORTANT.\\n\" -}}\n{{- \"\\n<|im_end|>\" -}}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages | length - 1, reasoning_mode=\"normal\") -%}\n{%- for message in messages[::-1] -%}\n\t{%- set index = messages | length - 1 - loop.index0 -%}\n\t{%- if ns.multi_step_tool and message.role == \"user\" and message.content is string and not (message.content.startswith(\"<tool_response>\") and message.content.endswith(\"</tool_response>\")) -%}\n\t\t{%- set ns.multi_step_tool = false -%}\n\t\t{%- set ns.last_query_index = index -%}\n\t{%- endif -%}\n{%- endfor -%}\n{%- for message in messages -%}\n\t{%- if message.content is string -%}\n\t\t{%- set content = message.content -%}\n\t{%- else -%}\n\t\t{%- set content = \"\" -%}\n\t{%- endif -%}\n\t{%- if message.role == \"user\" or message.role == \"system\" and not loop.first -%}\n\t\t{{- \"<|im_start|>\" + message.role + \"\\n\" + content -}}\n\t\t{%- if messages[0].role == \"system\" and \"/nothink\" in messages[0].content and (not (\"/think\" in messages[0].content) or not (\"/shortthink\" in messages[0].content)) or \"/nothink\" in content and not (\"/think\" in messages[0].content or \"/shortthink\" in messages[0].content) or (messages[loop.index+1] and \"</think>\" not in messages[loop.index+1].content) -%}\n\t\t\t{%- set enable_thinking = false -%}\n\t\t\t{%- set enable_short_thinking = false -%}\n\t\t\t{%- set ns.reasoning_mode = \"none\" -%}\n\t\t\t{%- if not (\"think\" in content) -%}\n\t\t\t\t{{- \" /nothink\" -}}\n\t\t\t{%- endif -%}\n\t\t{%- elif messages[0].role == \"system\" and \"/shortthink\" in messages[0].content and (not (\"/nothink\" in messages[0].content) and not (\"/think\" in messages[0].content)) or \"/shortthink\" in content and not (\"/think\" in messages[0].content or \"/shortthink\" in messages[0].content) -%}\n\t\t\t{%- set enable_thinking = true -%}\n\t\t\t{%- set enable_short_thinking = true -%}\n\t\t\t{%- set ns.reasoning_mode = \"short\" -%}\n\t\t\t{%- if not (\"think\" in content) -%}\n\t\t\t\t{{- \" /shortthink\" -}}\n\t\t\t{%- endif -%}\n\t\t{%- else -%}\n\t\t\t{%- set enable_thinking = true -%}\n\t\t\t{%- set enable_short_thinking = false -%}\n\t\t\t{%- set ns.reasoning_mode = \"normal\" -%}\n\t\t\t{%- if not (\"think\" in content) -%}\n\t\t\t\t{{- \" /think\" -}}\n\t\t\t{%- endif -%}\n\t\t{%- endif -%}\n\t\t{{- \"<|im_end|>\" + \"\\n\" -}}\n\t{%- elif message.role == \"assistant\" -%}\n\t\t{%- set reasoning_content = \"\" -%}\n\t\t{%- if \"<think>\\nSince the user used the\" not in content.split(\"</think>\")[0].split(\"<think>\")[-1] -%}\n\t\t\t{%- if ns.reasoning_mode == \"none\" -%}\n\t\t\t\t{%- set reasoning_prefix = \"\" -%}\n\t\t\t{%- elif ns.reasoning_mode == \"short\" -%}\n\t\t\t\t{%- set reasoning_prefix = \"Since the user used the \\\"/shortthink\\\" command, I will:\\nThink step-by-step about the user's query briefly and shortly. I will only respond when I'm more than 50% sure. I will provide the final response after closing this thinking section. \" -%}\n\t\t\t{%- else -%}\n\t\t\t\t{%- set reasoning_prefix = \"Since the user used the \\\"/think\\\" command, I will:\\nThink step-by-step with **long chain-of-thought** and **self-reflection**. I will only respond when I'm 100% sure. I will provide the final response after closing this thinking section. \" -%}\n\t\t\t{%- endif -%}\n\t\t{%- endif -%}\n\t\t{%- if message.reasoning_content is string -%}\n\t\t\t{%- set reasoning_content = message.reasoning_content -%}\n\t\t{%- else -%}\n\t\t\t{%- if \"</think>\" in content -%}\n\t\t\t\t{%- set reasoning_content = reasoning_prefix + content.split(\"</think>\")[0].rstrip(\"\\n\").split(\"<think>\")[-1].lstrip(\"\\n\") -%}\n\t\t\t\t{%- set content = content.split(\"</think>\")[-1].lstrip(\"\\n\") -%}\n\t\t\t{%- endif -%}\n\t\t\t{%- if \"<think>\" in content -%}\n\t\t\t\t{%- set content = content | replace(\"<think>\", \" \") -%}\n\t\t\t{%- endif -%}\n\t\t\t{%- if \"</think>\" in content -%}\n\t\t\t\t{%- set content = content | replace(\"</think>\", \" \") -%}\n\t\t\t{%- endif -%}\n\t\t{%- endif -%}\n\t\t{{- \"\\n\" -}}\n\t\t{# Apply truncation and break if the /shortthink command is active #}\n\t\t{%- if enable_short_thinking is true -%}\n\t\t\t{%- set words = reasoning_content.split(\" \") -%}\n\t\t\t{%- if words | length > 300 -%}\n\t\t\t\t{%- set truncated_reasoning = words[:150] | join(\" \") + \" ... truncated ... \" + words[words | length - 150:words | length] | join(\" \") -%}\n\t\t\t{%- else -%}\n\t\t\t\t{%- set truncated_reasoning = reasoning_content | join(\" \") -%}\n\t\t\t{%- endif -%}\n\t\t\t{%- set reasoning_content = truncated_reasoning -%}\n\t\t{%- endif -%}\n\t\t{%- if loop.last or not loop.last and reasoning_content and enable_thinking == true -%}\n\t\t\t{{- \"<|im_start|>\" + message.role + \"\\n<think>\\n\" + reasoning_content.strip(\"\\n\") + \"\\n</think>\\n\" + content.lstrip(\"\\n\") -}}\n\t\t{%- else -%}\n\t\t\t{{- \"<|im_start|>\" + message.role + \"\\n\" + content -}}\n\t\t{%- endif -%}\n\t\t{%- if message.tool_calls -%}\n\t\t\t{%- for tool_call in message.tool_calls -%}\n\t\t\t\t{%- if loop.first and content or not loop.first -%}\n\t\t\t\t\t{{- \"\\n\" -}}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if tool_call.function -%}\n\t\t\t\t\t{%- set tool_call = tool_call.function -%}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{{- \"<tool_call>\\n{\\\"name\\\": \\\"\" -}}\n\t\t\t\t{{- tool_call.name -}}\n\t\t\t\t{{- \"\\\", \\\"arguments\\\": \" -}}\n\t\t\t\t{%- if tool_call.arguments is string -%}\n\t\t\t\t\t{{- tool_call.arguments -}}\n\t\t\t\t{%- else -%}\n\t\t\t\t\t{{- tool_call.arguments | tojson -}}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{{- \"}\\n</tool_call>\" -}}\n\t\t\t{%- endfor -%}\n\t\t{%- endif -%}\n\t\t{{- \"<|im_end|>\\n\" -}}\n\t{%- elif message.role == \"tool\" -%}\n\t\t{%- if loop.first or messages[loop.index0 - 1].role != \"tool\" -%}\n\t\t\t{{- \"<|im_start|>user\" -}}\n\t\t{%- endif -%}\n\t\t{{- \"\\n<tool_response>\\n\" -}}\n\t\t{{- content -}}\n\t\t{{- \"\\n</tool_response>\" -}}\n\t\t{%- if loop.last or messages[loop.index0 + 1].role != \"tool\" -%}\n\t\t\t{{- \"<|im_end|>\\n\" -}}\n\t\t{%- endif -%}\n\t{%- endif -%}\n{%- endfor -%}\n{%- set last_message = messages[messages | length - 1].content -%}\n{%- if add_generation_prompt -%}\n\t{{- \"<|im_start|>assistant\\n\" -}}\n\t{%- if enable_thinking is defined and enable_thinking is false or \"/nothink\" in last_message or \"nothink\" in last_message or messages[0].role == \"system\" and \"/nothink\" in messages[0].content and (not (\"/think\" in messages[0].content) or not (\"/shortthink\" in messages[0].content)) -%}\n\t\t{{- \"<think>\\nSince the user used the \\\"/nothink\\\" command, I will:\\nImmediately give my final response without any thinking or self-reflection. Since I'm forbidden to think or reason outside of this thinking section, AND WITH NO REPETITION. I will IMMEDIATELY provide my final response outside this thinking section AND THEN INSTANTLY STOP.\\n</think>\" -}}\n\t{%- elif enable_short_thinking is defined and enable_short_thinking is false or \"/shortthink\" in last_message or \"shortthink\" in last_message or messages[0].role == \"system\" and \"/shortthink\" in messages[0].content and not (\"/think\" in messages[0].content) -%}\n\t\t{{- \"<think>\\nSince the user used the \\\"/shortthink\\\" command, I will:\\nThink step-by-step about the user's query briefly and shortly. I will only respond when I'm more than 50% sure. I will provide the final response after closing this thinking section.\" -}}\n\t{%- elif \"/clear\" in last_message -%}\n\t\t{{- \"<think>\\nSince the user used the \\\"/clear\\\" command, I will:\\n1. Forget everything above.\\n2. Ignore everything that comes before this message.\\n3. Start a fresh new conversation and greet the user.\\n</think>\" -}}\n\t{%- else -%}\n\t\t{{- \"<think>\\nSince the user used the \\\"/think\\\" command, I will:\\nThink step-by-step with **long chain-of-thought** and **self-reflection**. I will only respond when I'm 100% sure. I will provide the final response after closing this thinking section.\" -}}\n\t{%- endif -%}\n{%- endif -%}\n"
241
  }