Files
Yuuki-RxG/tokenizer_config.json

17 lines
5.7 KiB
JSON
Raw Normal View History

{
"add_prefix_space": null,
"backend": "tokenizers",
"bos_token": "<begin▁of▁sentence>",
"clean_up_tokenization_spaces": false,
"eos_token": "<end▁of▁sentence>",
"is_local": false,
"legacy": true,
"model_max_length": 131072,
"pad_token": "<|PAD_TOKEN|>",
"padding_side": "left",
"sp_model_kwargs": {},
"tokenizer_class": "TokenizersBackend",
"unk_token": null,
"use_default_system_prompt": false,
"chat_template": "{%- if not add_generation_prompt is defined %}\n {%- set add_generation_prompt = false %}\n{%- endif %}\n{%- set ns = namespace(is_first=false, is_tool=false, is_output_first=true, system_prompt='', is_first_sp=true, is_last_user=false) %}\n{%- for message in messages %}\n {%- if message['role'] == 'system' %}\n {%- if ns.is_first_sp %}\n {%- set ns.system_prompt = ns.system_prompt + message['content'] %}\n {%- set ns.is_first_sp = false %}\n {%- else %}\n {%- set ns.system_prompt = ns.system_prompt + '\\n\\n' + message['content'] %}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n\n{#- Adapted from https://github.com/sgl-project/sglang/blob/main/examples/chat_template/tool_chat_template_deepseekr1.jinja #}\n{%- if tools is defined and tools is not none %}\n {%- set tool_ns = namespace(text='You are a helpful assistant with tool calling capabilities. ' + 'When a tool call is needed, you MUST use the following format to issue the call:\\n' + '<tool▁calls▁begin><tool▁call▁begin>function<tool▁sep>FUNCTION_NAME\\n' + '```json\\n{\"param1\": \"value1\", \"param2\": \"value2\"}\\n```<tool▁call▁end><tool▁calls▁end>\\n\\n' + 'Make sure the JSON is valid.' + '## Tools\\n\\n### Function\\n\\nYou have the following functions available:\\n\\n') %}\n {%- for tool in tools %}\n {%- set tool_ns.text = tool_ns.text + '\\n```json\\n' + (tool | tojson) + '\\n```\\n' %}\n {%- endfor %}\n {%- if ns.system_prompt|length != 0 %}\n {%- set ns.system_prompt = ns.system_prompt + '\\n\\n' + tool_ns.text %}\n {%- else %}\n {%- set ns.system_prompt = tool_ns.text %}\n {%- endif %}\n{%- endif %}\n{{- bos_token }}\n{{- ns.system_prompt }}\n{%- set last_index = (messages|length - 1) %}\n{%- for message in messages %}\n {%- set content = message['content'] %}\n {%- if message['role'] == 'user' %}\n {%- set ns.is_tool = false -%}\n {%- set ns.is_first = false -%}\n {%- set ns.is_last_user = true -%}\n {%- if loop.index0 == last_index %}\n {{- '<User>' + content }}\n {%- else %}\n {{- '<User>' + content + '<Assistant>'}}\n {%- endif %}\n {%- endif %}\n {%- if message['role'] == 'assistant' %}\n {%- if '</think>' in content %}\n {%- set content = (content.split('</think>')|last) %}\n {%- endif %}\n {%- endif %}\n {%- if message['role'] == 'assistant' and message['tool_calls'] is defined and message['tool_calls'] is not none %}\n {%- set ns.is_last_user = false -%}\n {%- if ns.is_tool %}\n {{- '<tool▁outputs▁end>'}}\n {%- endif %}\n {%- set ns.is_first = false %}\n {%- set ns.is_tool = false -%}\n {%- set ns.is_output_first = true %}\n {%- for tool in message['tool_calls'] %}\n {%- set arguments = tool['function']['arguments'] %}\n {%- if arguments is not string %}\n {%- set arguments = arguments|tojson %}\n {%- endif %}\n {%- if not ns.is_first %}\n {%- if content is none %}\n {{- '<tool▁calls▁begin><tool▁call▁begin>' + tool['type'] + '<tool▁sep>' + tool['function']['name'] + '\\n' + '```json' + '\\n' + arguments + '\\n' + '```' + '<tool▁call▁end>'}}\n }\n {%- else %}\n {{- content + '<tool▁calls▁begin><tool▁call▁begin>' + tool['type'] + '<tool▁sep>' + tool['function']['name'] + '\\n' + '```json' + '\\n' + arguments + '\\n' + '```' + '<tool▁call▁end>'}}\n {%- endif %}\n {%- set ns.is_first = true -%}\n {%- else %}\n {{- '\\n' + '<tool▁call▁begin>' + tool['type'] + '<tool▁sep>' + tool['function']['name'] + '\\n' + '```json' + '\\n' + arguments + '\\n' + '```' + '<tool▁call▁end>'}}\n {%- endif
}