Upload 7 files
Browse files- chat_template.jinja +88 -46
- config.json +17 -17
- model.safetensors +2 -2
- processor_config.json +7 -11
- tokenizer_config.json +47 -0
chat_template.jinja
CHANGED
|
@@ -1,9 +1,15 @@
|
|
| 1 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
{%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%}
|
| 3 |
{%- set ns = namespace(found_first=false) -%}
|
| 4 |
{%- for key, value in properties | dictsort -%}
|
| 5 |
{%- set add_comma = false -%}
|
| 6 |
-
{%- if key not in standard_keys -%}
|
| 7 |
{%- if ns.found_first %},{% endif -%}
|
| 8 |
{%- set ns.found_first = true -%}
|
| 9 |
{{ key }}:{
|
|
@@ -65,7 +71,7 @@
|
|
| 65 |
{%- elif value is mapping -%}
|
| 66 |
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 67 |
properties:{
|
| 68 |
-
{{- format_parameters(value, value['required'] | default([])) -}}
|
| 69 |
}
|
| 70 |
{%- endif -%}
|
| 71 |
{%- if value['required'] -%}
|
|
@@ -116,7 +122,9 @@
|
|
| 116 |
}
|
| 117 |
{%- endmacro -%}
|
| 118 |
{%- macro format_argument(argument, escape_keys=True) -%}
|
| 119 |
-
{%- if argument is
|
|
|
|
|
|
|
| 120 |
{{- '<|"|>' + argument + '<|"|>' -}}
|
| 121 |
{%- elif argument is boolean -%}
|
| 122 |
{{- 'true' if argument else 'false' -}}
|
|
@@ -172,24 +180,30 @@
|
|
| 172 |
{{- '<tool_response|>' -}}
|
| 173 |
{%- endmacro -%}
|
| 174 |
|
| 175 |
-
{
|
|
|
|
| 176 |
{%- set loop_messages = messages -%}
|
|
|
|
|
|
|
| 177 |
{{- bos_token -}}
|
| 178 |
{#- Handle System/Tool Definitions Block -#}
|
| 179 |
-
{%- if
|
| 180 |
{{- '<|turn>system\n' -}}
|
| 181 |
-
|
| 182 |
{#- Inject Thinking token at the very top of the FIRST system turn -#}
|
| 183 |
-
{%- if enable_thinking
|
| 184 |
{{- '<|think|>\n' -}}
|
| 185 |
{%- set ns.prev_message_type = 'think' -%}
|
| 186 |
{%- endif -%}
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
{%- set loop_messages = messages[1:] -%}
|
| 191 |
{%- endif -%}
|
| 192 |
-
|
| 193 |
{%- if tools -%}
|
| 194 |
{%- for tool in tools %}
|
| 195 |
{{- '<|tool>' -}}
|
|
@@ -198,7 +212,6 @@
|
|
| 198 |
{%- endfor %}
|
| 199 |
{%- set ns.prev_message_type = 'tool' -%}
|
| 200 |
{%- endif -%}
|
| 201 |
-
|
| 202 |
{{- '<turn|>\n' -}}
|
| 203 |
{%- endif %}
|
| 204 |
|
|
@@ -215,31 +228,21 @@
|
|
| 215 |
{%- if message['role'] != 'tool' -%}
|
| 216 |
{%- set ns.prev_message_type = None -%}
|
| 217 |
{%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%}
|
| 218 |
-
{#- Detect continuation
|
| 219 |
-
{%- set
|
| 220 |
-
{%- if loop.index0 > 0 -%}
|
| 221 |
-
{%- for j in range(loop.index0 - 1, -1, -1) -%}
|
| 222 |
-
{%- if not prev_nt.found -%}
|
| 223 |
-
{%- if loop_messages[j]['role'] != 'tool' -%}
|
| 224 |
-
{%- set prev_nt.role = loop_messages[j]['role'] -%}
|
| 225 |
-
{%- set prev_nt.found = true -%}
|
| 226 |
-
{%- endif -%}
|
| 227 |
-
{%- endif -%}
|
| 228 |
-
{%- endfor -%}
|
| 229 |
-
{%- endif -%}
|
| 230 |
-
{%- set continue_same_model_turn = (role == 'model' and prev_nt.role == 'assistant') -%}
|
| 231 |
{%- if not continue_same_model_turn -%}
|
| 232 |
{{- '<|turn>' + role + '\n' }}
|
| 233 |
{%- endif -%}
|
| 234 |
|
| 235 |
{#- Render reasoning/reasoning_content as thinking channel -#}
|
| 236 |
{%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%}
|
| 237 |
-
{%-
|
|
|
|
| 238 |
{{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}}
|
| 239 |
{%- endif -%}
|
| 240 |
|
| 241 |
-
{%- if message
|
| 242 |
-
{%- for tool_call in message
|
| 243 |
{%- set function = tool_call['function'] -%}
|
| 244 |
{{- '<|tool_call>call:' + function['name'] + '{' -}}
|
| 245 |
{%- if function['arguments'] is mapping -%}
|
|
@@ -249,8 +252,13 @@
|
|
| 249 |
{%- set ns_args.found_first = true -%}
|
| 250 |
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 251 |
{%- endfor -%}
|
| 252 |
-
{%- elif function['arguments'] is
|
| 253 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
{%- endif -%}
|
| 255 |
{{- '}<tool_call|>' -}}
|
| 256 |
{%- endfor -%}
|
|
@@ -260,8 +268,8 @@
|
|
| 260 |
{%- set ns_tr_out = namespace(flag=false) -%}
|
| 261 |
{%- if message.get('tool_responses') -%}
|
| 262 |
{#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#}
|
| 263 |
-
{%- for tool_response in message
|
| 264 |
-
{{- format_tool_response_block(tool_response['name'] | default('unknown'), tool_response['response']) -}}
|
| 265 |
{%- set ns_tr_out.flag = true -%}
|
| 266 |
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 267 |
{%- endfor -%}
|
|
@@ -275,8 +283,8 @@
|
|
| 275 |
{%- else -%}
|
| 276 |
{%- set follow = loop_messages[k] -%}
|
| 277 |
{#- Resolve tool_call_id to function name -#}
|
| 278 |
-
{%- set ns_tname = namespace(name=follow.get('name')
|
| 279 |
-
{%- for tc in message
|
| 280 |
{%- if tc.get('id') == follow.get('tool_call_id') -%}
|
| 281 |
{%- set ns_tname.name = tc['function']['name'] -%}
|
| 282 |
{%- endif -%}
|
|
@@ -293,6 +301,15 @@
|
|
| 293 |
{%- endif -%}
|
| 294 |
{%- endfor -%}
|
| 295 |
{{- format_tool_response_block(ns_tname.name, ns_txt.s) -}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
{%- else -%}
|
| 297 |
{{- format_tool_response_block(ns_tname.name, tool_body) -}}
|
| 298 |
{%- endif -%}
|
|
@@ -302,43 +319,68 @@
|
|
| 302 |
{%- endfor -%}
|
| 303 |
{%- endif -%}
|
| 304 |
|
| 305 |
-
{%-
|
|
|
|
| 306 |
{%- if role == 'model' -%}
|
| 307 |
{{- strip_thinking(message['content']) -}}
|
| 308 |
{%- else -%}
|
| 309 |
{{- message['content'] | trim -}}
|
| 310 |
{%- endif -%}
|
| 311 |
-
{%- elif message
|
| 312 |
{%- for item in message['content'] -%}
|
| 313 |
-
{%- if item
|
| 314 |
{%- if role == 'model' -%}
|
| 315 |
{{- strip_thinking(item['text']) -}}
|
| 316 |
{%- else -%}
|
| 317 |
{{- item['text'] | trim -}}
|
| 318 |
{%- endif -%}
|
| 319 |
-
{%- elif item
|
| 320 |
{{- '<|image|>' -}}
|
| 321 |
-
|
| 322 |
-
{%- elif item['type'] == 'audio' -%}
|
| 323 |
{{- '<|audio|>' -}}
|
| 324 |
-
|
| 325 |
-
{%- elif item['type'] == 'video' -%}
|
| 326 |
{{- '<|video|>' -}}
|
| 327 |
-
{%- set ns.prev_message_type = 'video' -%}
|
| 328 |
{%- endif -%}
|
| 329 |
{%- endfor -%}
|
| 330 |
{%- endif -%}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 331 |
|
| 332 |
{%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%}
|
| 333 |
{{- '<|tool_response>' -}}
|
| 334 |
-
{%- elif
|
|
|
|
| 335 |
{{- '<turn|>\n' -}}
|
| 336 |
{%- endif -%}
|
|
|
|
|
|
|
|
|
|
| 337 |
{%- endif -%}
|
| 338 |
{%- endfor -%}
|
| 339 |
|
| 340 |
{%- if add_generation_prompt -%}
|
| 341 |
{%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%}
|
| 342 |
{{- '<|turn>model\n' -}}
|
|
|
|
|
|
|
| 343 |
{%- endif -%}
|
| 344 |
-
{%- endif -%}
|
|
|
|
| 1 |
+
{#
|
| 2 |
+
Template: Google Gemma 4 Canonical Chat Template
|
| 3 |
+
Author: Google Gemma Engineering Team
|
| 4 |
+
Published: 2026-07-09
|
| 5 |
+
Context: Fixed tool-calling loops, turn closures, and thinking content-ordering.
|
| 6 |
+
#}
|
| 7 |
+
{%- macro format_parameters(properties, required, filter_keys=false) -%}
|
| 8 |
{%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%}
|
| 9 |
{%- set ns = namespace(found_first=false) -%}
|
| 10 |
{%- for key, value in properties | dictsort -%}
|
| 11 |
{%- set add_comma = false -%}
|
| 12 |
+
{%- if not filter_keys or key not in standard_keys -%}
|
| 13 |
{%- if ns.found_first %},{% endif -%}
|
| 14 |
{%- set ns.found_first = true -%}
|
| 15 |
{{ key }}:{
|
|
|
|
| 71 |
{%- elif value is mapping -%}
|
| 72 |
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 73 |
properties:{
|
| 74 |
+
{{- format_parameters(value, value['required'] | default([]), filter_keys=true) -}}
|
| 75 |
}
|
| 76 |
{%- endif -%}
|
| 77 |
{%- if value['required'] -%}
|
|
|
|
| 122 |
}
|
| 123 |
{%- endmacro -%}
|
| 124 |
{%- macro format_argument(argument, escape_keys=True) -%}
|
| 125 |
+
{%- if argument is none -%}
|
| 126 |
+
{{- 'null' -}}
|
| 127 |
+
{%- elif argument is string -%}
|
| 128 |
{{- '<|"|>' + argument + '<|"|>' -}}
|
| 129 |
{%- elif argument is boolean -%}
|
| 130 |
{{- 'true' if argument else 'false' -}}
|
|
|
|
| 180 |
{{- '<tool_response|>' -}}
|
| 181 |
{%- endmacro -%}
|
| 182 |
|
| 183 |
+
{#- ===== SETUP ===== -#}
|
| 184 |
+
{%- set ns = namespace(prev_message_type=None, prev_non_tool_role=None) -%}
|
| 185 |
{%- set loop_messages = messages -%}
|
| 186 |
+
{%- set enable_thinking = enable_thinking | default(false) -%}
|
| 187 |
+
{%- set preserve_thinking = preserve_thinking | default(false) -%}
|
| 188 |
{{- bos_token -}}
|
| 189 |
{#- Handle System/Tool Definitions Block -#}
|
| 190 |
+
{%- if enable_thinking or tools or (messages and messages[0]['role'] in ['system', 'developer']) -%}
|
| 191 |
{{- '<|turn>system\n' -}}
|
|
|
|
| 192 |
{#- Inject Thinking token at the very top of the FIRST system turn -#}
|
| 193 |
+
{%- if enable_thinking -%}
|
| 194 |
{{- '<|think|>\n' -}}
|
| 195 |
{%- set ns.prev_message_type = 'think' -%}
|
| 196 |
{%- endif -%}
|
| 197 |
+
{%- if messages and messages[0]['role'] in ['system', 'developer'] -%}
|
| 198 |
+
{%- if messages[0]['content'] is string -%}
|
| 199 |
+
{{- messages[0]['content'] | trim -}}
|
| 200 |
+
{%- elif messages[0]['content'] is sequence -%}
|
| 201 |
+
{%- for item in messages[0]['content'] -%}
|
| 202 |
+
{{- item['text'] | trim + ' '-}}
|
| 203 |
+
{%- endfor -%}
|
| 204 |
+
{%- endif -%}
|
| 205 |
{%- set loop_messages = messages[1:] -%}
|
| 206 |
{%- endif -%}
|
|
|
|
| 207 |
{%- if tools -%}
|
| 208 |
{%- for tool in tools %}
|
| 209 |
{{- '<|tool>' -}}
|
|
|
|
| 212 |
{%- endfor %}
|
| 213 |
{%- set ns.prev_message_type = 'tool' -%}
|
| 214 |
{%- endif -%}
|
|
|
|
| 215 |
{{- '<turn|>\n' -}}
|
| 216 |
{%- endif %}
|
| 217 |
|
|
|
|
| 228 |
{%- if message['role'] != 'tool' -%}
|
| 229 |
{%- set ns.prev_message_type = None -%}
|
| 230 |
{%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%}
|
| 231 |
+
{#- Detect continuation using tracked state — O(1) instead of O(n) backward scan -#}
|
| 232 |
+
{%- set continue_same_model_turn = (role == 'model' and ns.prev_non_tool_role == 'assistant') -%}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
{%- if not continue_same_model_turn -%}
|
| 234 |
{{- '<|turn>' + role + '\n' }}
|
| 235 |
{%- endif -%}
|
| 236 |
|
| 237 |
{#- Render reasoning/reasoning_content as thinking channel -#}
|
| 238 |
{%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%}
|
| 239 |
+
{%- set thinking_gate = (loop.index0 > ns_turn.last_user_idx) or (preserve_thinking and message.get('tool_calls')) -%}
|
| 240 |
+
{%- if thinking_text and thinking_gate -%}
|
| 241 |
{{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}}
|
| 242 |
{%- endif -%}
|
| 243 |
|
| 244 |
+
{%- if message.get('tool_calls') -%}
|
| 245 |
+
{%- for tool_call in message.get('tool_calls') -%}
|
| 246 |
{%- set function = tool_call['function'] -%}
|
| 247 |
{{- '<|tool_call>call:' + function['name'] + '{' -}}
|
| 248 |
{%- if function['arguments'] is mapping -%}
|
|
|
|
| 252 |
{%- set ns_args.found_first = true -%}
|
| 253 |
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 254 |
{%- endfor -%}
|
| 255 |
+
{%- elif function['arguments'] is none -%}
|
| 256 |
+
{%- else -%}
|
| 257 |
+
{{- raise_exception(
|
| 258 |
+
"chat_template: tool_calls[].function.arguments must be a "
|
| 259 |
+
"JSON object (mapping), not a string. Deserialize arguments "
|
| 260 |
+
"before passing to the template."
|
| 261 |
+
) -}}
|
| 262 |
{%- endif -%}
|
| 263 |
{{- '}<tool_call|>' -}}
|
| 264 |
{%- endfor -%}
|
|
|
|
| 268 |
{%- set ns_tr_out = namespace(flag=false) -%}
|
| 269 |
{%- if message.get('tool_responses') -%}
|
| 270 |
{#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#}
|
| 271 |
+
{%- for tool_response in message.get('tool_responses') -%}
|
| 272 |
+
{{- format_tool_response_block(tool_response['name'] | default('unknown', true), tool_response['response']) -}}
|
| 273 |
{%- set ns_tr_out.flag = true -%}
|
| 274 |
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 275 |
{%- endfor -%}
|
|
|
|
| 283 |
{%- else -%}
|
| 284 |
{%- set follow = loop_messages[k] -%}
|
| 285 |
{#- Resolve tool_call_id to function name -#}
|
| 286 |
+
{%- set ns_tname = namespace(name=follow.get('name') or 'unknown') -%}
|
| 287 |
+
{%- for tc in message.get('tool_calls') -%}
|
| 288 |
{%- if tc.get('id') == follow.get('tool_call_id') -%}
|
| 289 |
{%- set ns_tname.name = tc['function']['name'] -%}
|
| 290 |
{%- endif -%}
|
|
|
|
| 301 |
{%- endif -%}
|
| 302 |
{%- endfor -%}
|
| 303 |
{{- format_tool_response_block(ns_tname.name, ns_txt.s) -}}
|
| 304 |
+
{%- for part in tool_body -%}
|
| 305 |
+
{%- if part.get('type') in ['image', 'image_url'] -%}
|
| 306 |
+
{{- '<|image|>' -}}
|
| 307 |
+
{%- elif part.get('type') in ['audio', 'input_audio'] -%}
|
| 308 |
+
{{- '<|audio|>' -}}
|
| 309 |
+
{%- elif part.get('type') == 'video' -%}
|
| 310 |
+
{{- '<|video|>' -}}
|
| 311 |
+
{%- endif -%}
|
| 312 |
+
{%- endfor -%}
|
| 313 |
{%- else -%}
|
| 314 |
{{- format_tool_response_block(ns_tname.name, tool_body) -}}
|
| 315 |
{%- endif -%}
|
|
|
|
| 319 |
{%- endfor -%}
|
| 320 |
{%- endif -%}
|
| 321 |
|
| 322 |
+
{%- set captured_content -%}
|
| 323 |
+
{%- if message.get('content') is string -%}
|
| 324 |
{%- if role == 'model' -%}
|
| 325 |
{{- strip_thinking(message['content']) -}}
|
| 326 |
{%- else -%}
|
| 327 |
{{- message['content'] | trim -}}
|
| 328 |
{%- endif -%}
|
| 329 |
+
{%- elif message.get('content') is sequence -%}
|
| 330 |
{%- for item in message['content'] -%}
|
| 331 |
+
{%- if item.get('type') == 'text' -%}
|
| 332 |
{%- if role == 'model' -%}
|
| 333 |
{{- strip_thinking(item['text']) -}}
|
| 334 |
{%- else -%}
|
| 335 |
{{- item['text'] | trim -}}
|
| 336 |
{%- endif -%}
|
| 337 |
+
{%- elif item.get('type') in ['image', 'image_url'] -%}
|
| 338 |
{{- '<|image|>' -}}
|
| 339 |
+
{%- elif item.get('type') in ['audio', 'input_audio'] -%}
|
|
|
|
| 340 |
{{- '<|audio|>' -}}
|
| 341 |
+
{%- elif item.get('type') == 'video' -%}
|
|
|
|
| 342 |
{{- '<|video|>' -}}
|
|
|
|
| 343 |
{%- endif -%}
|
| 344 |
{%- endfor -%}
|
| 345 |
{%- endif -%}
|
| 346 |
+
{%- endset -%}
|
| 347 |
+
|
| 348 |
+
{{- captured_content -}}
|
| 349 |
+
{%- set has_content = captured_content | trim | length > 0 -%}
|
| 350 |
+
|
| 351 |
+
{#- Forward-scan: find next non-tool message role for continuation detection -#}
|
| 352 |
+
{%- set next_nt = namespace(role=None, found=false) -%}
|
| 353 |
+
{%- for j in range(loop.index0 + 1, loop_messages | length) -%}
|
| 354 |
+
{%- if not next_nt.found -%}
|
| 355 |
+
{%- if loop_messages[j]['role'] != 'tool' -%}
|
| 356 |
+
{%- set next_nt.role = loop_messages[j]['role'] -%}
|
| 357 |
+
{%- set next_nt.found = true -%}
|
| 358 |
+
{%- endif -%}
|
| 359 |
+
{%- endif -%}
|
| 360 |
+
{%- endfor -%}
|
| 361 |
+
|
| 362 |
+
{%- set continues_into_next = (
|
| 363 |
+
role == 'model'
|
| 364 |
+
and next_nt.role == 'assistant'
|
| 365 |
+
and (not message.get('tool_calls') or ns_tr_out.flag)
|
| 366 |
+
) -%}
|
| 367 |
|
| 368 |
{%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%}
|
| 369 |
{{- '<|tool_response>' -}}
|
| 370 |
+
{%- elif continues_into_next -%}
|
| 371 |
+
{%- elif not (ns_tr_out.flag and not has_content and not next_nt.found) -%}
|
| 372 |
{{- '<turn|>\n' -}}
|
| 373 |
{%- endif -%}
|
| 374 |
+
|
| 375 |
+
{#- Track previous non-tool role for next iteration (avoids O(n) backward scan) -#}
|
| 376 |
+
{%- set ns.prev_non_tool_role = message['role'] -%}
|
| 377 |
{%- endif -%}
|
| 378 |
{%- endfor -%}
|
| 379 |
|
| 380 |
{%- if add_generation_prompt -%}
|
| 381 |
{%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%}
|
| 382 |
{{- '<|turn>model\n' -}}
|
| 383 |
+
{%- elif ns.prev_message_type == 'tool_response' and enable_thinking -%}
|
| 384 |
+
{{- '<|channel>thought\n' -}}
|
| 385 |
{%- endif -%}
|
| 386 |
+
{%- endif -%}
|
config.json
CHANGED
|
@@ -12,10 +12,10 @@
|
|
| 12 |
"attention_logit_cap": 50.0,
|
| 13 |
"chunk_size_feed_forward": 0,
|
| 14 |
"conv_kernel_size": 5,
|
| 15 |
-
"dtype": "
|
| 16 |
"gradient_clipping": 10000000000.0,
|
| 17 |
"hidden_act": "silu",
|
| 18 |
-
"hidden_size":
|
| 19 |
"id2label": {
|
| 20 |
"0": "LABEL_0",
|
| 21 |
"1": "LABEL_1"
|
|
@@ -27,11 +27,11 @@
|
|
| 27 |
"LABEL_1": 1
|
| 28 |
},
|
| 29 |
"model_type": "gemma4_audio",
|
| 30 |
-
"num_attention_heads":
|
| 31 |
"num_hidden_layers": 1,
|
| 32 |
"output_attentions": false,
|
| 33 |
"output_hidden_states": false,
|
| 34 |
-
"output_proj_dims":
|
| 35 |
"problem_type": null,
|
| 36 |
"residual_weight": 0.5,
|
| 37 |
"return_dict": true,
|
|
@@ -66,13 +66,13 @@
|
|
| 66 |
"eos_token_id": 1,
|
| 67 |
"expert_intermediate_size": null,
|
| 68 |
"final_logit_softcapping": 30.0,
|
| 69 |
-
"global_head_dim":
|
| 70 |
-
"head_dim":
|
| 71 |
"hidden_activation": "gelu_pytorch_tanh",
|
| 72 |
-
"hidden_size":
|
| 73 |
"hidden_size_per_layer_input": 1,
|
| 74 |
"initializer_range": 0.02,
|
| 75 |
-
"intermediate_size":
|
| 76 |
"layer_types": [
|
| 77 |
"sliding_attention",
|
| 78 |
"full_attention",
|
|
@@ -81,11 +81,11 @@
|
|
| 81 |
"max_position_embeddings": 131072,
|
| 82 |
"model_type": "gemma4_text",
|
| 83 |
"moe_intermediate_size": null,
|
| 84 |
-
"num_attention_heads":
|
| 85 |
"num_experts": null,
|
| 86 |
"num_global_key_value_heads": null,
|
| 87 |
"num_hidden_layers": 3,
|
| 88 |
-
"num_key_value_heads":
|
| 89 |
"num_kv_shared_layers": 1,
|
| 90 |
"pad_token_id": 0,
|
| 91 |
"rms_norm_eps": 1e-06,
|
|
@@ -119,17 +119,17 @@
|
|
| 119 |
"attention_dropout": 0.0,
|
| 120 |
"chunk_size_feed_forward": 0,
|
| 121 |
"default_output_length": 70,
|
| 122 |
-
"dtype": "
|
| 123 |
"global_head_dim": 64,
|
| 124 |
-
"head_dim":
|
| 125 |
"hidden_activation": "gelu_pytorch_tanh",
|
| 126 |
-
"hidden_size":
|
| 127 |
"id2label": {
|
| 128 |
"0": "LABEL_0",
|
| 129 |
"1": "LABEL_1"
|
| 130 |
},
|
| 131 |
"initializer_range": 0.02,
|
| 132 |
-
"intermediate_size":
|
| 133 |
"is_encoder_decoder": false,
|
| 134 |
"label2id": {
|
| 135 |
"LABEL_0": 0,
|
|
@@ -137,12 +137,12 @@
|
|
| 137 |
},
|
| 138 |
"max_position_embeddings": 131072,
|
| 139 |
"model_type": "gemma4_vision",
|
| 140 |
-
"num_attention_heads":
|
| 141 |
"num_hidden_layers": 1,
|
| 142 |
-
"num_key_value_heads":
|
| 143 |
"output_attentions": false,
|
| 144 |
"output_hidden_states": false,
|
| 145 |
-
"patch_size":
|
| 146 |
"pooling_kernel_size": 3,
|
| 147 |
"position_embedding_size": 10240,
|
| 148 |
"problem_type": null,
|
|
|
|
| 12 |
"attention_logit_cap": 50.0,
|
| 13 |
"chunk_size_feed_forward": 0,
|
| 14 |
"conv_kernel_size": 5,
|
| 15 |
+
"dtype": "float32",
|
| 16 |
"gradient_clipping": 10000000000.0,
|
| 17 |
"hidden_act": "silu",
|
| 18 |
+
"hidden_size": 32,
|
| 19 |
"id2label": {
|
| 20 |
"0": "LABEL_0",
|
| 21 |
"1": "LABEL_1"
|
|
|
|
| 27 |
"LABEL_1": 1
|
| 28 |
},
|
| 29 |
"model_type": "gemma4_audio",
|
| 30 |
+
"num_attention_heads": 4,
|
| 31 |
"num_hidden_layers": 1,
|
| 32 |
"output_attentions": false,
|
| 33 |
"output_hidden_states": false,
|
| 34 |
+
"output_proj_dims": 32,
|
| 35 |
"problem_type": null,
|
| 36 |
"residual_weight": 0.5,
|
| 37 |
"return_dict": true,
|
|
|
|
| 66 |
"eos_token_id": 1,
|
| 67 |
"expert_intermediate_size": null,
|
| 68 |
"final_logit_softcapping": 30.0,
|
| 69 |
+
"global_head_dim": 8,
|
| 70 |
+
"head_dim": 8,
|
| 71 |
"hidden_activation": "gelu_pytorch_tanh",
|
| 72 |
+
"hidden_size": 32,
|
| 73 |
"hidden_size_per_layer_input": 1,
|
| 74 |
"initializer_range": 0.02,
|
| 75 |
+
"intermediate_size": 64,
|
| 76 |
"layer_types": [
|
| 77 |
"sliding_attention",
|
| 78 |
"full_attention",
|
|
|
|
| 81 |
"max_position_embeddings": 131072,
|
| 82 |
"model_type": "gemma4_text",
|
| 83 |
"moe_intermediate_size": null,
|
| 84 |
+
"num_attention_heads": 4,
|
| 85 |
"num_experts": null,
|
| 86 |
"num_global_key_value_heads": null,
|
| 87 |
"num_hidden_layers": 3,
|
| 88 |
+
"num_key_value_heads": 2,
|
| 89 |
"num_kv_shared_layers": 1,
|
| 90 |
"pad_token_id": 0,
|
| 91 |
"rms_norm_eps": 1e-06,
|
|
|
|
| 119 |
"attention_dropout": 0.0,
|
| 120 |
"chunk_size_feed_forward": 0,
|
| 121 |
"default_output_length": 70,
|
| 122 |
+
"dtype": "float32",
|
| 123 |
"global_head_dim": 64,
|
| 124 |
+
"head_dim": 8,
|
| 125 |
"hidden_activation": "gelu_pytorch_tanh",
|
| 126 |
+
"hidden_size": 32,
|
| 127 |
"id2label": {
|
| 128 |
"0": "LABEL_0",
|
| 129 |
"1": "LABEL_1"
|
| 130 |
},
|
| 131 |
"initializer_range": 0.02,
|
| 132 |
+
"intermediate_size": 64,
|
| 133 |
"is_encoder_decoder": false,
|
| 134 |
"label2id": {
|
| 135 |
"LABEL_0": 0,
|
|
|
|
| 137 |
},
|
| 138 |
"max_position_embeddings": 131072,
|
| 139 |
"model_type": "gemma4_vision",
|
| 140 |
+
"num_attention_heads": 4,
|
| 141 |
"num_hidden_layers": 1,
|
| 142 |
+
"num_key_value_heads": 4,
|
| 143 |
"output_attentions": false,
|
| 144 |
"output_hidden_states": false,
|
| 145 |
+
"patch_size": 16,
|
| 146 |
"pooling_kernel_size": 3,
|
| 147 |
"position_embedding_size": 10240,
|
| 148 |
"problem_type": null,
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c2645ac53c3989c11a75141407c3016e1c732a38eb306ea75fb9b53d7b64b191
|
| 3 |
+
size 40017352
|
processor_config.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
| 13 |
"max_frequency": 8000.0,
|
| 14 |
"mel_floor": 0.001,
|
| 15 |
"min_frequency": 0.0,
|
| 16 |
-
"padding_side": "
|
| 17 |
"padding_value": 0.0,
|
| 18 |
"per_bin_mean": null,
|
| 19 |
"per_bin_stddev": null,
|
|
@@ -33,23 +33,19 @@
|
|
| 33 |
0.0
|
| 34 |
],
|
| 35 |
"image_processor_type": "Gemma4ImageProcessor",
|
| 36 |
-
"image_seq_length":
|
| 37 |
"image_std": [
|
| 38 |
1.0,
|
| 39 |
1.0,
|
| 40 |
1.0
|
| 41 |
],
|
| 42 |
-
"max_soft_tokens":
|
| 43 |
-
"patch_size":
|
| 44 |
"pooling_kernel_size": 3,
|
| 45 |
"resample": 3,
|
| 46 |
-
"rescale_factor": 0.00392156862745098
|
| 47 |
-
"size": {
|
| 48 |
-
"height": 32,
|
| 49 |
-
"width": 32
|
| 50 |
-
}
|
| 51 |
},
|
| 52 |
-
"image_seq_length":
|
| 53 |
"processor_class": "Gemma4Processor",
|
| 54 |
"video_processor": {
|
| 55 |
"do_convert_rgb": true,
|
|
@@ -69,7 +65,7 @@
|
|
| 69 |
],
|
| 70 |
"max_soft_tokens": 70,
|
| 71 |
"num_frames": 32,
|
| 72 |
-
"patch_size":
|
| 73 |
"pooling_kernel_size": 3,
|
| 74 |
"resample": 3,
|
| 75 |
"rescale_factor": 0.00392156862745098,
|
|
|
|
| 13 |
"max_frequency": 8000.0,
|
| 14 |
"mel_floor": 0.001,
|
| 15 |
"min_frequency": 0.0,
|
| 16 |
+
"padding_side": "left",
|
| 17 |
"padding_value": 0.0,
|
| 18 |
"per_bin_mean": null,
|
| 19 |
"per_bin_stddev": null,
|
|
|
|
| 33 |
0.0
|
| 34 |
],
|
| 35 |
"image_processor_type": "Gemma4ImageProcessor",
|
| 36 |
+
"image_seq_length": 280,
|
| 37 |
"image_std": [
|
| 38 |
1.0,
|
| 39 |
1.0,
|
| 40 |
1.0
|
| 41 |
],
|
| 42 |
+
"max_soft_tokens": 280,
|
| 43 |
+
"patch_size": 16,
|
| 44 |
"pooling_kernel_size": 3,
|
| 45 |
"resample": 3,
|
| 46 |
+
"rescale_factor": 0.00392156862745098
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
},
|
| 48 |
+
"image_seq_length": 280,
|
| 49 |
"processor_class": "Gemma4Processor",
|
| 50 |
"video_processor": {
|
| 51 |
"do_convert_rgb": true,
|
|
|
|
| 65 |
],
|
| 66 |
"max_soft_tokens": 70,
|
| 67 |
"num_frames": 32,
|
| 68 |
+
"patch_size": 16,
|
| 69 |
"pooling_kernel_size": 3,
|
| 70 |
"resample": 3,
|
| 71 |
"rescale_factor": 0.00392156862745098,
|
tokenizer_config.json
CHANGED
|
@@ -84,6 +84,52 @@
|
|
| 84 |
"type": "object",
|
| 85 |
"x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?"
|
| 86 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
"soc_token": "<|channel>",
|
| 88 |
"sot_token": "<|turn>",
|
| 89 |
"stc_token": "<|tool_call>",
|
|
@@ -91,5 +137,6 @@
|
|
| 91 |
"str_token": "<|tool_response>",
|
| 92 |
"think_token": "<|think|>",
|
| 93 |
"tokenizer_class": "GemmaTokenizer",
|
|
|
|
| 94 |
"unk_token": "<unk>"
|
| 95 |
}
|
|
|
|
| 84 |
"type": "object",
|
| 85 |
"x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?"
|
| 86 |
},
|
| 87 |
+
"response_template": {
|
| 88 |
+
"defaults": {
|
| 89 |
+
"role": "assistant"
|
| 90 |
+
},
|
| 91 |
+
"fields": {
|
| 92 |
+
"content": {
|
| 93 |
+
"close": [
|
| 94 |
+
"<turn|>",
|
| 95 |
+
"<|tool_response>",
|
| 96 |
+
"<eos>"
|
| 97 |
+
],
|
| 98 |
+
"content": "text"
|
| 99 |
+
},
|
| 100 |
+
"thinking": {
|
| 101 |
+
"close": "<channel|>",
|
| 102 |
+
"content": "text",
|
| 103 |
+
"open": "<|channel>thought\n"
|
| 104 |
+
},
|
| 105 |
+
"tool_calls": {
|
| 106 |
+
"close": "<tool_call|>",
|
| 107 |
+
"content": "json",
|
| 108 |
+
"content_args": {
|
| 109 |
+
"string_delims": [
|
| 110 |
+
[
|
| 111 |
+
"<|\"|>",
|
| 112 |
+
"<|\"|>"
|
| 113 |
+
]
|
| 114 |
+
],
|
| 115 |
+
"unquoted_keys": true
|
| 116 |
+
},
|
| 117 |
+
"open_pattern": "<\\|tool_call>call:(?P<name>\\w+)",
|
| 118 |
+
"repeats": true,
|
| 119 |
+
"transform": {
|
| 120 |
+
"function": {
|
| 121 |
+
"arguments": "{content}",
|
| 122 |
+
"name": "{name}"
|
| 123 |
+
},
|
| 124 |
+
"type": "function"
|
| 125 |
+
}
|
| 126 |
+
}
|
| 127 |
+
},
|
| 128 |
+
"start_anchor": [
|
| 129 |
+
"<|turn>model\n",
|
| 130 |
+
"<tool_response|>"
|
| 131 |
+
]
|
| 132 |
+
},
|
| 133 |
"soc_token": "<|channel>",
|
| 134 |
"sot_token": "<|turn>",
|
| 135 |
"stc_token": "<|tool_call>",
|
|
|
|
| 137 |
"str_token": "<|tool_response>",
|
| 138 |
"think_token": "<|think|>",
|
| 139 |
"tokenizer_class": "GemmaTokenizer",
|
| 140 |
+
"truncation_side": "left",
|
| 141 |
"unk_token": "<unk>"
|
| 142 |
}
|