BetterWright-4b / tokenizer_config.json
ProCreations's picture
BetterWright-4b: full-parameter SFT of Spark-X2.5-4B for BetterWright browser use
1f7258f verified
Raw
History Blame Contribute Delete
5.19 kB
{
"backend": "tokenizers",
"bos_token": "<|start▁of▁sentence|>",
"clean_up_tokenization_spaces": false,
"eos_token": "<|end▁of▁sentence|>",
"is_local": true,
"legacy": true,
"local_files_only": false,
"model_max_length": 262144,
"pad_token": "<|▁pad▁|>",
"sp_model_kwargs": {},
"tokenizer_class": "TokenizersBackend",
"unk_token": "<unk>",
"chat_template": "{#- 0826版本 -#}\n{%- if not messages %}\n {{- raise_exception('No messages provided.') }}\n{%- endif %}\n{%- set enable_thinking = enable_thinking | default(true) %}\n\n{#- Render a string or a list of text blocks. -#}\n{%- macro render_content(content, context_name) %}\n {%- if content is string %}\n {{- content }}\n {%- elif content is none or content is undefined %}\n {{- '' }}\n {%- elif content is iterable and content is not mapping %}\n {%- for block in content %}\n {%- if block.type == 'text' %}\n {{- block.text }}\n {%- else %}\n {{- raise_exception('Unsupported ' ~ context_name ~ ' content block type: ' ~ (block.type | string)) }}\n {%- endif %}\n {%- endfor %}\n {%- else %}\n {{- raise_exception(context_name ~ ' content must be a string or a list of text blocks') }}\n {%- endif %}\n{%- endmacro %}\n\n{#- Default system prompt -#}\n{%- set default_system = \"you are a helpful assistant.\" %}\n\n{#- The first message-level system is placed in the initial system block. -#}\n{%- set ns = namespace(initial_system='') %}\n{%- if messages[0].role == \"system\" %}\n {%- set ns.initial_system = render_content(messages[0].content, 'system') %}\n{%- endif %}\n\n{#- System block -#}\n{{- '<|start▁of▁sentence|><|System|>' + '\\n' + default_system }}\n{%- if tools %}\n {{- '## Tools' + '\\n' + 'You have access to the following functions:' + '\\n' + '<tools>' }}\n {%- for tool in tools %}\n {{- '\\n' + tool.function | tojson}}\n {%- endfor %}\n {{- '\\n' + '</tools>' }}\n{%- endif %}\n{%- if ns.initial_system %}\n {{- '\\n\\n' + ns.initial_system }}\n{%- endif %}\n{{- '<|end▁of▁sentence|>'}}\n\n{#- Conversation turns -#}\n{%- for message in messages %}\n {%- if message.role == \"system\" %}\n {#- The first system message was consumed by the initial block. -#}\n {%- if not loop.first %}\n {{- '<|start▁of▁sentence|><|System|>\\n' + render_content(message.content, 'system') + '<|end▁of▁sentence|>' }}\n {%- endif %}\n {%- elif message.role == \"user\" %}\n {{- '<|start▁of▁sentence|><|User|>' + render_content(message.content, 'user') + '<|end▁of▁sentence|>' }}\n {%- elif message.role == \"assistant\" %}\n {%- set assistant_content = render_content(message.content, 'assistant') %}\n {%- if message.reasoning_content is defined and message.reasoning_content %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- set reasoning_content = '' %}\n {%- endif %}\n {{- '<|start▁of▁sentence|><|Bot|>'}}\n {%- if reasoning_content %}\n {{- '<think>' + reasoning_content + '</think>'}}\n {%- else %}\n {{- '</think>' }}\n {%- endif %}\n {%- if assistant_content %}\n {{- assistant_content }}\n {%- endif %}\n {%- if message.tool_calls is defined and message.tool_calls is not none %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function.arguments is not mapping %}\n {{- raise_exception('tool_call.function.arguments must be a dictionary; normalize JSON strings before apply_chat_template') }}\n {%- endif %}\n {%- set args = tool_call.function.arguments %}\n {{- '<tool_call>' + tool_call.function.name }}\n {%- for k, v in args.items() %}\n {{- '<arg_key>' ~ k ~ '</arg_key><arg_value>' ~ (v if v is string else v | tojson) ~ '</arg_value>' }}\n {%- endfor %}\n {{- '</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|end▁of▁sentence|>' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.previtem is undefined or loop.previtem.role != \"tool\" %}\n {{- '<|start▁of▁sentence|><|Tool|>' }}\n {%- endif %}\n {{- '<tool_response>' ~ message.content ~ '</tool_response>' }}\n {%- if loop.nextitem is undefined or loop.nextitem.role != \"tool\" %}\n {{- '<|end▁of▁sentence|>' }}\n {%- endif %}\n {%- else %}\n {{- raise_exception('Unsupported message role: ' ~ message.role) }}\n {%- endif %}\n{%- endfor %}\n\n{#- Generation prompt -#}\n{%- if add_generation_prompt %}\n {{- '<|start▁of▁sentence|><|Bot|>' }}\n {%- if enable_thinking is defined and enable_thinking %}\n {{- '<think>' }}\n {%- endif %}\n {%- if enable_thinking is defined and not enable_thinking %}\n {{- '</think>' }}\n {%- endif %}\n{%- endif %}\n"
}