Focus-Red / tokenizer_config.json
Jaidchen's picture
Publish Focus-Red
85f197c unverified
Raw
History Blame Contribute Delete
15 kB
{"add_prefix_space":false,"added_tokens_decoder":{"248044":{"content":"<|endoftext|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248045":{"content":"<|im_start|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248046":{"content":"<|im_end|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248047":{"content":"<|object_ref_start|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248048":{"content":"<|object_ref_end|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248049":{"content":"<|box_start|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248050":{"content":"<|box_end|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248051":{"content":"<|quad_start|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248052":{"content":"<|quad_end|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248053":{"content":"<|vision_start|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248054":{"content":"<|vision_end|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248055":{"content":"<|vision_pad|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248056":{"content":"<|image_pad|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248057":{"content":"<|video_pad|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248058":{"content":"<tool_call>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248059":{"content":"</tool_call>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248060":{"content":"<|fim_prefix|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248061":{"content":"<|fim_middle|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248062":{"content":"<|fim_suffix|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248063":{"content":"<|fim_pad|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248064":{"content":"<|repo_name|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248065":{"content":"<|file_sep|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248066":{"content":"<tool_response>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248067":{"content":"</tool_response>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248068":{"content":"<think>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248069":{"content":"</think>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":false},"248070":{"content":"<|audio_start|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248071":{"content":"<|audio_end|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248072":{"content":"<tts_pad>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248073":{"content":"<tts_text_bos>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248074":{"content":"<tts_text_eod>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248075":{"content":"<tts_text_bos_single>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true},"248076":{"content":"<|audio_pad|>","lstrip":false,"normalized":false,"rstrip":false,"single_word":false,"special":true}},"additional_special_tokens":["<|im_start|>","<|im_end|>","<|object_ref_start|>","<|object_ref_end|>","<|box_start|>","<|box_end|>","<|quad_start|>","<|quad_end|>","<|vision_start|>","<|vision_end|>","<|vision_pad|>","<|image_pad|>","<|video_pad|>"],"bos_token":null,"chat_template":"{%- macro render_content(content) %}\n {%- if content is string %}\n {{- content }}\n {%- elif content is iterable and content is not mapping %}\n {%- for item in content %}\n {%- if item is mapping %}\n {%- if ('type' in item and (item.type == 'image' or item.type == 'image_url')) or 'image' in item or 'image_url' in item %}\n {{- '[image]' }}\n {%- elif ('type' in item and item.type == 'video') or 'video' in item %}\n {{- '[video]' }}\n {%- elif 'text' in item %}\n {{- item.text }}\n {%- else %}\n {{- raise_exception('Unexpected item type in content.') }}\n {%- endif %}\n {%- else %}\n {{- item | string }}\n {%- endif %}\n {%- endfor %}\n {%- elif content is none or content is undefined %}\n {{- '' }}\n {%- else %}\n {{- raise_exception('Unexpected content type.') }}\n {%- endif %}\n{%- endmacro %}\n{%- if not messages %}\n {{- raise_exception('No messages provided.') }}\n{%- endif %}\n{%- set reasoning_instructions = '' %}\n{%- if enable_thinking is undefined or enable_thinking is true %}\n {%- set resolved_reasoning_effort = reasoning_effort|default('xhigh') %}\n {%- if resolved_reasoning_effort not in ('xhigh', 'medium', 'low') %}\n {{- raise_exception('Unexpected reasoning effort ' ~ reasoning_effort ~ '. Supported types are xhigh (default), medium, and low.') }}\n {%- endif %}\n {%- if resolved_reasoning_effort == 'xhigh' %}\n {%- set reasoning_instructions = 'Reasoning effort is set to xhigh. Please think carefully through the task, validate key assumptions, consider plausible alternatives, and prioritize correctness, consistency, and clarity in the final answer.' %}\n {%- elif resolved_reasoning_effort == 'low' %}\n {%- set reasoning_instructions = 'Reasoning effort is set to low. Keep your thinking brief and focused, moving directly to the conclusion without unnecessary elaboration.' %}\n {%- endif %}\n{%- endif %}\n{%- set _preserve_thinking = preserve_thinking if preserve_thinking is defined else true %}\n{%- set leading = namespace(active=true, count=0, content='') %}\n{%- for message in messages %}\n {%- if leading.active and (message.role == 'system' or message.role == 'developer') %}\n {%- set rendered = render_content(message.content) | trim %}\n {%- if rendered %}\n {%- if leading.content %}\n {%- set leading.content = leading.content + '\\n' + rendered %}\n {%- else %}\n {%- set leading.content = rendered %}\n {%- endif %}\n {%- endif %}\n {%- set leading.count = leading.count + 1 %}\n {%- else %}\n {%- set leading.active = false %}\n {%- endif %}\n{%- endfor %}\n{%- set _has_tools = tools is defined and tools and tools is iterable and tools is not mapping %}\n{%- if _has_tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if reasoning_instructions %}\n {{- reasoning_instructions + '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou have access to the following functions:\\n\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\" }}\n {{- '\\n\\nIf you choose to call a function ONLY reply in the following format with NO suffix:\\n\\n<tool_call>\\n<function=example_function_name>\\n<parameter=example_parameter_1>\\nvalue_1\\n</parameter>\\n<parameter=example_parameter_2>\\nThis is the value for the second parameter\\nthat can span\\nmultiple lines\\n</parameter>\\n</function>\\n</tool_call>\\n\\n<IMPORTANT>\\nReminder:\\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\\n- Required parameters MUST be specified\\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\\n</IMPORTANT>' }}\n {%- if leading.content %}\n {{- '\\n\\n' + leading.content }}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n{%- else %}\n {%- if leading.content %}\n {{- '<|im_start|>system\\n' + (reasoning_instructions + '\\n\\n' if reasoning_instructions else '') + leading.content + '<|im_end|>\\n' }}\n {%- elif reasoning_instructions %}\n {{- '<|im_start|>system\\n' + reasoning_instructions + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" %}\n {%- set content = render_content(message.content)|trim %}\n {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- set content = render_content(message.content) | trim %}\n {%- if loop.index0 < leading.count %}\n {%- elif message.role == 'system' or message.role == 'developer' %}\n {{- '<|im_start|>system\\n' + content + '<|im_end|>\\n' }}\n {%- elif message.role == 'user' %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is defined and message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- elif message.thinking is defined and message.thinking is string %}\n {%- set reasoning_content = message.thinking %}\n {%- elif content.startswith('</think>') %}\n {%- set content = (content.split('</think>')[1:] | join('</think>')).lstrip('\\n') %}\n {%- elif '\\n</think>' in content %}\n {%- set reasoning_content = content.split('\\n</think>')[0] %}\n {%- if reasoning_content.startswith('<think>\\n') %}\n {%- set reasoning_content = reasoning_content[8:] %}\n {%- elif reasoning_content.startswith('<think>') %}\n {%- set reasoning_content = reasoning_content[7:].lstrip('\\n') %}\n {%- endif %}\n {%- set content = (content.split('\\n</think>')[1:] | join('\\n</think>')).lstrip('\\n') %}\n {%- endif %}\n {%- set reasoning_content = reasoning_content | trim %}\n {%- if reasoning_content and (_preserve_thinking or loop.index0 > ns.last_query_index) %}\n {{- '<|im_start|>assistant\\n<think>\\n' + reasoning_content + '\\n</think>\\n\\n' + content }}\n {%- else %}\n {{- '<|im_start|>assistant\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls is defined and message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}\n {%- for tool_call in message.tool_calls %}\n {%- set call = tool_call.function if tool_call.function is defined and tool_call.function is not none else tool_call %}\n {%- if loop.first %}\n {%- if content | trim %}\n {{- '\\n\\n<tool_call>\\n<function=' + call.name + '>\\n' }}\n {%- else %}\n {{- '<tool_call>\\n<function=' + call.name + '>\\n' }}\n {%- endif %}\n {%- else %}\n {{- '\\n<tool_call>\\n<function=' + call.name + '>\\n' }}\n {%- endif %}\n {%- if call.arguments is defined and call.arguments is mapping %}\n {%- for args_name in call.arguments %}\n {%- set args_value = call.arguments[args_name] %}\n {{- '<parameter=' + args_name + '>\\n' }}\n {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}\n {{- args_value }}\n {{- '\\n</parameter>\\n' }}\n {%- endfor %}\n {%- elif call.arguments is defined and call.arguments is string and call.arguments %}\n {{- call.arguments }}\n {{- '\\n' }}\n {%- endif %}\n {{- '</function>\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {%- if not (loop.last and continue_final_message is defined and continue_final_message) %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- elif message.role == 'tool' %}\n {%- set previous_role = messages[loop.index0 - 1].role if loop.index0 > 0 else '' %}\n {%- if previous_role != 'tool' %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' + content + '\\n</tool_response>' }}\n {%- set next_role = messages[loop.index0 + 1].role if not loop.last else '' %}\n {%- if loop.last or next_role != 'tool' %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- else %}\n {{- raise_exception('Unexpected message role: ' + message.role) }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if enable_thinking is defined and enable_thinking is false %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- else %}\n {{- '<think>\\n' }}\n {%- endif %}\n{%- endif %}","clean_up_tokenization_spaces":false,"eos_token":"<|im_end|>","errors":"replace","model_max_length":262144,"pad_token":"<|endoftext|>","split_special_tokens":false,"tokenizer_class":"Qwen2Tokenizer","unk_token":null,"add_bos_token":false,"pretokenize_regex":"(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+","extra_special_tokens":{"audio_bos_token":"<|audio_start|>","audio_eos_token":"<|audio_end|>","audio_token":"<|audio_pad|>","image_token":"<|image_pad|>","video_token":"<|video_pad|>","vision_bos_token":"<|vision_start|>","vision_eos_token":"<|vision_end|>"}}