kunato commited on
Commit
8967e59
·
verified ·
1 Parent(s): 338e4c1

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. tokenizer_config.json +1 -1
tokenizer_config.json CHANGED
@@ -51325,7 +51325,7 @@
51325
  },
51326
  "boi_token": "<start_of_image>",
51327
  "bos_token": "<bos>",
51328
- "chat_template": "{#- Begin-of-sequence token to start the model prompt -#}\n{{ bos_token }}\n{#- Extracts the system message. Gemma does not support system messages so it will be prepended to first user message. -#}\n{%- if messages[0]['role'] == 'system' -%}\n {%- if messages[0]['content'] is string -%}\n {%- set first_user_prefix = messages[0]['content'] -%}\n {%- else -%}\n {%- set first_user_prefix = messages[0]['content'][0]['text'] -%}\n {%- endif -%}\n {%- set loop_messages = messages[1:] -%}\n{%- else -%}\n {%- set first_user_prefix = \"You are a helpful assistant named Typhoon created by SCB 10X to be helpful, harmless, and honest.\" -%}\n {%- set loop_messages = messages -%}\n{%- endif -%}\n{%- if enable_thinking is defined and enable_thinking is true %}\n {%- set first_user_prefix = first_user_prefix + \" First, think through the reasoning internally, then present the reasoning within <think>...</think>. After thinking, clearly state a response that addresses the user's request and aligns with their preferences, not just providing a direct answer.\" -%}\n{%- endif %}\n{%- set first_user_prefix = first_user_prefix + '\\n\\n' -%}\n{#- Set tools to none if not defined for this ChatCompletion request (helps avoid errors later) -#}\n{%- if not tools is defined %}\n {%- set tools = none %}\n{%- endif %}\n{#- Validate alternating user/assistant messages (excluding 'tool' messages and ones with tool_calls) -#}\n{%- for message in loop_messages | rejectattr(\"role\", \"equalto\", \"tool\") | selectattr(\"tool_calls\", \"undefined\") -%}\n {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}\n {{ raise_exception(\"Conversation roles must alternate user/assistant/user/assistant/...\") }}\n {%- endif -%}\n{%- endfor -%}\n\n{#- Main loop over all messages in the conversation history -#}\n{%- for message in loop_messages -%}\n {#- Normalize roles for model prompt formatting -#}\n {%- if (message['role'] == 'assistant') -%}\n {%- set role = \"model\" -%}\n {%- elif (message['role'] == 'tool') -%}\n {%- set role = \"user\" -%}\n {%- else -%}\n {%- set role = message['role'] -%}\n {%- endif -%}\n {#- Mark the start of a message block with the appropriate role -#}\n {{ '<start_of_turn>' + role + '\\n' -}}\n\n {#- Insert system message content (if present) at the beginning of the first message. -#}\n {%- if loop.first -%}\n {{ first_user_prefix }}\n {#- Append system message with tool information if using tools in message request. -#}\n {%- if tools is not none -%}\n {{- \"Tools (functions) are available. If you decide to invoke one or more of the tools, you must respond with a python list of the function calls.\\n\" -}}\n {{- \"Example Format: [func_name1(params_name1=params_value1, params_name2=params_value2...), func_name2(params)] \\n\" -}}\n {{- \"Do not use variables. DO NOT USE MARKDOWN SYNTAX. You SHOULD NOT include any other text in the response if you call a function. If none of the functions can be used, point it out. If you lack the parameters required by the function, also point it out.\\n\" -}}\n {{- \"Here is a list of functions in JSON format that you can invoke.\\n\" -}}\n {{- tools | tojson(indent=4) -}}\n {{- \"\\n\\n\" -}}\n {%- endif -%}\n {%- endif -%}\n\n {#- Format model tool calls (turns where model indicates they want to call a tool) -#}\n {%- if 'tool_calls' in message -%}\n {#- Opening bracket for tool call list. -#}\n {{- '[' -}}\n {#- For each tool call -#}\n {%- for tool_call in message.tool_calls -%}\n {#- Function name & opening parenthesis. -#}\n {%- if tool_call.function is defined -%}\n {%- set tool_call = tool_call.function -%}\n {%- endif -%}\n {{- tool_call.name + '(' -}}\n\n {#-- Handle arguments as list (positional) or dict (named) --#}\n {#-- Named arguments (dict) --#}\n {%- if tool_call.arguments is iterable and tool_call.arguments is mapping -%}\n {%- set first = true -%}\n {%- for key, val in tool_call.arguments.items() -%}\n {%- if not first %}, {% endif -%}\n {{ key }}={{ val | tojson }}\n {%- set first = false -%}\n {%- endfor -%}\n {#-- Positional arguments (list) --#}\n {%- elif tool_call.arguments is iterable -%}\n {{- tool_call.arguments | map('tojson') | join(', ') -}}\n {#-- Fallback: single positional value --#}\n {%- else -%}\n {{- tool_call.arguments | tojson -}}\n {#-- Closing parenthesis. --#}\n {%- endif -%}\n {{- ')' -}}\n {#-- If more than one tool call, place comma and move to formatting next tool call --#}\n {%- if not loop.last -%}, {% endif -%}\n {%- endfor -%}\n {#- Closing bracket for tool call list. -#}\n {{- ']' -}}\n {%- endif -%}\n \n {#- Tool response start tag (for messages from a tool) -#}\n {%- if (message['role'] == 'tool') -%}\n {{ '<tool_response>\\n' -}}\n {%- endif -%}\n\n {#- Render the message content: handle plain string or multimodal content like image/text -#}\n {%- if message['content'] is string -%}\n {%- set content = message['content'] -%}\n {%- if '</think>' in content -%}\n {%- set content = content.split('</think>')[-1] -%}\n {%- endif -%}\n {{ content | trim }}\n {%- elif message['content'] is iterable -%}\n {%- for item in message['content'] -%}\n {%- if item['type'] == 'image' -%}\n {{ '<start_of_image>' }}\n {%- elif item['type'] == 'text' -%}\n {%- set content = item['text'] -%}\n {%- if '</think>' in content -%}\n {%- set content = content.split('</think>')[-1] -%}\n {%- endif -%}\n {{ content | trim }}\n {%- endif -%}\n {%- endfor -%}\n {%- else -%}\n {{ raise_exception(\"Invalid content type\") }}\n {%- endif -%}\n\n {#- Tool response end tag -#}\n {%- if (message['role'] == 'tool') -%}\n {{ '</tool_response>' -}}\n {%- endif -%}\n\n {#- Mark end of a single turn -#}\n {{ '<end_of_turn>\\n' }}\n{%- endfor -%}\n\n{#- If generation is to be triggered, add model prompt prefix -#}\n{%- if add_generation_prompt -%}\n {{'<start_of_turn>model\\n'}}\n {%- if enable_thinking is defined and enable_thinking is true -%}\n {{- '<think>' -}}\n {%- endif %}\n{%- endif -%}",
51329
  "clean_up_tokenization_spaces": false,
51330
  "eoi_token": "<end_of_image>",
51331
  "eos_token": "<end_of_turn>",
 
51325
  },
51326
  "boi_token": "<start_of_image>",
51327
  "bos_token": "<bos>",
51328
+ "chat_template": "{#- Begin-of-sequence token to start the model prompt -#}\n{{ bos_token }}\n{#- Extracts the system message. Gemma does not support system messages so it will be prepended to first user message. -#}\n{%- if messages[0]['role'] == 'system' -%}\n {%- if messages[0]['content'] is string -%}\n {%- set first_user_prefix = messages[0]['content'] -%}\n {%- else -%}\n {%- set first_user_prefix = messages[0]['content'][0]['text'] -%}\n {%- endif -%}\n {%- set loop_messages = messages[1:] -%}\n{%- else -%}\n {%- set first_user_prefix = \"You are a helpful assistant named Typhoon created by SCB 10X to be helpful, harmless, and honest.\" -%}\n {%- set loop_messages = messages -%}\n{%- endif -%}\n{%- if enable_thinking is defined and enable_thinking is true %}\n {%- set first_user_prefix = first_user_prefix + \" First, think through the reasoning internally, then present the reasoning within <think>...</think>. After thinking, clearly state a response that addresses the user's request and aligns with their preferences, not just providing a direct answer.\" -%}\n{%- endif %}\n{%- set first_user_prefix = first_user_prefix + '\\n\\n' -%}\n{#- Set tools to none if not defined for this ChatCompletion request (helps avoid errors later) -#}\n{%- if not tools is defined %}\n {%- set tools = none %}\n{%- endif %}\n\n{#- If given only system message -#}\n{%- if loop_messages|length == 0 -%}\n {{ '<start_of_turn>user\\n' -}}\n {{ first_user_prefix }}\n {#- Append system message with tool information if using tools in message request. -#}\n {%- if tools is not none -%}\n {{- \"Tools (functions) are available. If you decide to invoke one or more of the tools, you must respond with a python list of the function calls.\\n\" -}}\n {{- \"Example Format: [func_name1(params_name1=params_value1, params_name2=params_value2...), func_name2(params)] \\n\" -}}\n {{- \"Do not use variables. DO NOT USE MARKDOWN SYNTAX. You SHOULD NOT include any other text in the response if you call a function. If none of the functions can be used, point it out. If you lack the parameters required by the function, also point it out.\\n\" -}}\n {{- \"Here is a list of functions in JSON format that you can invoke.\\n\" -}}\n {{- tools | tojson(indent=4) -}}\n {{- \"\\n\\n\" -}}\n {%- endif -%}\n{%- endif %}\n\n{#- Main loop over all messages in the conversation history -#}\n{%- for message in loop_messages -%}\n {#- Normalize roles for model prompt formatting -#}\n {%- if (message['role'] == 'assistant') -%}\n {%- set role = \"model\" -%}\n {%- elif (message['role'] == 'tool') -%}\n {%- set role = \"user\" -%}\n {%- else -%}\n {%- set role = message['role'] -%}\n {%- endif -%}\n {#- Mark the start of a message block with the appropriate role -#}\n {{ '<start_of_turn>' + role + '\\n' -}}\n\n {#- Insert system message content (if present) at the beginning of the first message. -#}\n {%- if loop.first -%}\n {{ first_user_prefix }}\n {#- Append system message with tool information if using tools in message request. -#}\n {%- if tools is not none -%}\n {{- \"Tools (functions) are available. If you decide to invoke one or more of the tools, you must respond with a python list of the function calls.\\n\" -}}\n {{- \"Example Format: [func_name1(params_name1=params_value1, params_name2=params_value2...), func_name2(params)] \\n\" -}}\n {{- \"Do not use variables. DO NOT USE MARKDOWN SYNTAX. You SHOULD NOT include any other text in the response if you call a function. If none of the functions can be used, point it out. If you lack the parameters required by the function, also point it out.\\n\" -}}\n {{- \"Here is a list of functions in JSON format that you can invoke.\\n\" -}}\n {{- tools | tojson(indent=4) -}}\n {{- \"\\n\\n\" -}}\n {%- endif -%}\n {%- endif -%}\n\n {#- Format model tool calls (turns where model indicates they want to call a tool) -#}\n {%- if 'tool_calls' in message -%}\n {#- Opening bracket for tool call list. -#}\n {{- '[' -}}\n {#- For each tool call -#}\n {%- for tool_call in message.tool_calls -%}\n {#- Function name & opening parenthesis. -#}\n {%- if tool_call.function is defined -%}\n {%- set tool_call = tool_call.function -%}\n {%- endif -%}\n {{- tool_call.name + '(' -}}\n\n {#-- Handle arguments as list (positional) or dict (named) --#}\n {#-- Named arguments (dict) --#}\n {%- if tool_call.arguments is iterable and tool_call.arguments is mapping -%}\n {%- set first = true -%}\n {%- for key, val in tool_call.arguments.items() -%}\n {%- if not first %}, {% endif -%}\n {{ key }}={{ val | tojson }}\n {%- set first = false -%}\n {%- endfor -%}\n {#-- Positional arguments (list) --#}\n {%- elif tool_call.arguments is iterable -%}\n {{- tool_call.arguments | map('tojson') | join(', ') -}}\n {#-- Fallback: single positional value --#}\n {%- else -%}\n {{- tool_call.arguments | tojson -}}\n {#-- Closing parenthesis. --#}\n {%- endif -%}\n {{- ')' -}}\n {#-- If more than one tool call, place comma and move to formatting next tool call --#}\n {%- if not loop.last -%}, {% endif -%}\n {%- endfor -%}\n {#- Closing bracket for tool call list. -#}\n {{- ']' -}}\n {%- endif -%}\n \n {#- Tool response start tag (for messages from a tool) -#}\n {%- if (message['role'] == 'tool') -%}\n {{ '<tool_response>\\n' -}}\n {%- endif -%}\n\n {#- Render the message content: handle plain string or multimodal content like image/text -#}\n {%- if message['content'] is string -%}\n {%- set content = message['content'] -%}\n {%- if '</think>' in content -%}\n {%- set content = content.split('</think>')[-1] -%}\n {%- endif -%}\n {{ content | trim }}\n {%- elif message['content'] is iterable -%}\n {%- for item in message['content'] -%}\n {%- if item['type'] == 'image' -%}\n {{ '<start_of_image>' }}\n {%- elif item['type'] == 'text' -%}\n {%- set content = item['text'] -%}\n {%- if '</think>' in content -%}\n {%- set content = content.split('</think>')[-1] -%}\n {%- endif -%}\n {{ content | trim }}\n {%- endif -%}\n {%- endfor -%}\n {%- else -%}\n {{ raise_exception(\"Invalid content type\") }}\n {%- endif -%}\n\n {#- Tool response end tag -#}\n {%- if (message['role'] == 'tool') -%}\n {{ '</tool_response>' -}}\n {%- endif -%}\n\n {#- Mark end of a single turn -#}\n {{ '<end_of_turn>\\n' }}\n{%- endfor -%}\n\n{#- If generation is to be triggered, add model prompt prefix -#}\n{%- if add_generation_prompt -%}\n {{'<start_of_turn>model\\n'}}\n {%- if enable_thinking is defined and enable_thinking is true -%}\n {{- '<think>' -}}\n {%- endif %}\n{%- endif -%}",
51329
  "clean_up_tokenization_spaces": false,
51330
  "eoi_token": "<end_of_image>",
51331
  "eos_token": "<end_of_turn>",