Anserwise commited on
Commit
cb5e691
·
verified ·
1 Parent(s): 203396a

Add files using upload-large-folder tool

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: gemma
3
+ language:
4
+ - ko
5
+ - en
6
+ library_name: transformers
7
+ pipeline_tag: text-generation
8
+ tags:
9
+ - awaxis
10
+ - think
11
+ - gemma
12
+ - gemma-4
13
+ - reasoning
14
+ - distillation
15
+ - ko
16
+ - en
17
+ base_model:
18
+ - TeichAI/gemma-4-31B-it-Claude-Opus-Distill-v2
19
+ - google/gemma-4-31B-it
20
+ model-index:
21
+ - name: AWAXIS-Think-31B
22
+ results:
23
+ - task:
24
+ type: text-generation
25
+ name: GPQA Diamond (20Q greedy, max_new_tokens=4096)
26
+ dataset:
27
+ name: GPQA Diamond (subset n=20, seed=42)
28
+ type: Idavidrein/gpqa
29
+ config: gpqa_diamond
30
+ metrics:
31
+ - type: accuracy
32
+ value: 60.0
33
+ name: accuracy
34
+ - task:
35
+ type: text-generation
36
+ name: CLIcK (Korean cultural-linguistic, n=200, alpha grid best)
37
+ dataset:
38
+ name: CLIcK
39
+ type: EunsuKim/CLIcK
40
+ metrics:
41
+ - type: accuracy
42
+ value: 86.0
43
+ name: accuracy
44
+ ---
45
+
46
+ # AWAXIS-Think-31B
47
+
48
+ **AWAXIS-Think-31B** is a 31B-parameter Korean/English reasoning model built via the Darwin V8 FFN-crossbreed merge engine.
49
+
50
+ ## Build recipe (honest disclosure)
51
+
52
+ - **Mother (kept full)**: [TeichAI/gemma-4-31B-it-Claude-Opus-Distill-v2](https://huggingface.co/TeichAI/gemma-4-31B-it-Claude-Opus-Distill-v2) ??reasoning-distill base, retained 100% (incl. `<think>` chain-of-thought style)
53
+ - **Father (FFN donor)**: [google/gemma-4-31B-it](https://huggingface.co/google/gemma-4-31B-it) ??base Gemma-4 FFN tensors blended at **慣 = 0.1**
54
+ - **Method**: per-layer FFN blend `w = w_mother*(1-慣) + w_father*慣` on `mlp.{gate,up,down}_proj` + `pre/post_feedforward_layernorm` for all 60 language-model layers; grid search 慣??0.1, 0.2, 0.3, 0.4} on CLIcK-50 ??best 慣=0.1 (CLIcK-200 = 86.0%)
55
+ - **Architecture**: `Gemma4ForConditionalGeneration` (multimodal wrapper; text generation primary)
56
+ - **Tokenizer**: Gemma-4 (vocab 262,144)
57
+
58
+ ## Measured benchmarks
59
+
60
+ | Benchmark | Setting | Result |
61
+ |-----------|---------|--------|
62
+ | GPQA Diamond 20Q (seed 42) | greedy, max_new_tokens=**4096**, 2-way DP | **12/20 = 60.0%** (16/20 still hit token cap, 0 null) |
63
+ | GPQA Diamond 20Q (seed 42) | greedy, max_new_tokens=**2048** | 9/20 = 45.0% (16/20 truncated, 2 null) ??*truncation artifact, included for transparency* |
64
+ | CLIcK (Korean) 200Q | greedy 慣-grid winner | 86.0% |
65
+
66
+ ### Honest caveats
67
+ - GPQA 60% is from **n=20** (small sample). 16/20 still hit the 4096-token cap ??real ceiling may be higher with longer generation budget.
68
+ - Comparison to random baseline: GPQA random 25% ??+35pp clear learning signal.
69
+ - The full GPQA Diamond (198Q) and other broad suites have not yet been measured for this exact merged artifact.
70
+ - The model retains the **Mother's `<think>...</think>` reasoning template** ??strip via post-processing if undesired.
71
+
72
+ ## Intended use
73
+
74
+ - Korean/English step-by-step reasoning, instruction following, knowledge QA
75
+ - The `Think` suffix reflects the inherited Opus-distilled chain-of-thought behavior
76
+
77
+ ## Out-of-scope / limitations
78
+
79
+ - Not a final clinical/legal advisor; outputs may be confidently wrong on hard graduate-level questions (40% wrong on the GPQA-20 set).
80
+ - Inherits Gemma-4 base limitations (multimodal wrapper retained; image inputs not the primary use-case here).
81
+ - Subject to Gemma Terms of Use; see parent model cards for derivative-use clauses.
82
+
83
+ ## Inference
84
+
85
+ ```python
86
+ from transformers import AutoTokenizer, AutoModelForCausalLM
87
+ import torch
88
+ tok = AutoTokenizer.from_pretrained("Anserwise/AWAXIS-Think-31B", trust_remote_code=True)
89
+ model = AutoModelForCausalLM.from_pretrained(
90
+ "Anserwise/AWAXIS-Think-31B",
91
+ dtype=torch.bfloat16,
92
+ device_map="auto",
93
+ trust_remote_code=True,
94
+ attn_implementation="eager", # required for the Gemma4 multimodal wrapper
95
+ )
96
+ msgs = [{"role": "user", "content": "?쒓뎅?대줈 ?먯떊???뚭컻??二쇱꽭??"}]
97
+ text = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
98
+ inp = tok(text, return_tensors="pt").to(model.device)
99
+ out = model.generate(**inp, max_new_tokens=2048, do_sample=False)
100
+ print(tok.decode(out[0][inp["input_ids"].shape[-1]:], skip_special_tokens=True))
101
+ ```
102
+
103
+ ## License
104
+
105
+ Gemma Terms of Use (inherited from base). Use of this model is bound by [Google Gemma Terms](https://ai.google.dev/gemma/terms).
106
+
107
+ ## Acknowledgements
108
+
109
+ - TeichAI for the Opus-Distill base
110
+ - Google DeepMind for Gemma-4
111
+
112
+ ---
113
+ *Built with Darwin V8 FFN-crossbreed merge engine. Measured numbers above are exact; nothing inflated.*
chat_template.jinja ADDED
@@ -0,0 +1,355 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set enable_thinking = enable_thinking if enable_thinking is defined else true -%}
2
+ {%- macro format_parameters(properties, required, filter_keys=false) -%}
3
+ {%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%}
4
+ {%- set ns = namespace(found_first=false) -%}
5
+ {%- for key, value in properties | dictsort -%}
6
+ {%- set add_comma = false -%}
7
+ {%- if not filter_keys or key not in standard_keys -%}
8
+ {%- if ns.found_first %},{% endif -%}
9
+ {%- set ns.found_first = true -%}
10
+ {{ key }}:{
11
+ {%- if value['description'] -%}
12
+ description:<|"|>{{ value['description'] }}<|"|>
13
+ {%- set add_comma = true -%}
14
+ {%- endif -%}
15
+ {%- if value['type'] | upper == 'STRING' -%}
16
+ {%- if value['enum'] -%}
17
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
18
+ enum:{{ format_argument(value['enum']) }}
19
+ {%- endif -%}
20
+ {%- elif value['type'] | upper == 'ARRAY' -%}
21
+ {%- if value['items'] is mapping and value['items'] -%}
22
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
23
+ items:{
24
+ {%- set ns_items = namespace(found_first=false) -%}
25
+ {%- for item_key, item_value in value['items'] | dictsort -%}
26
+ {%- if item_value is not none -%}
27
+ {%- if ns_items.found_first %},{% endif -%}
28
+ {%- set ns_items.found_first = true -%}
29
+ {%- if item_key == 'properties' -%}
30
+ properties:{
31
+ {%- if item_value is mapping -%}
32
+ {{- format_parameters(item_value, value['items']['required'] | default([])) -}}
33
+ {%- endif -%}
34
+ }
35
+ {%- elif item_key == 'required' -%}
36
+ required:[
37
+ {%- for req_item in item_value -%}
38
+ <|"|>{{- req_item -}}<|"|>
39
+ {%- if not loop.last %},{% endif -%}
40
+ {%- endfor -%}
41
+ ]
42
+ {%- elif item_key == 'type' -%}
43
+ {%- if item_value is string -%}
44
+ type:{{ format_argument(item_value | upper) }}
45
+ {%- else -%}
46
+ type:{{ format_argument(item_value | map('upper') | list) }}
47
+ {%- endif -%}
48
+ {%- else -%}
49
+ {{ item_key }}:{{ format_argument(item_value) }}
50
+ {%- endif -%}
51
+ {%- endif -%}
52
+ {%- endfor -%}
53
+ }
54
+ {%- endif -%}
55
+ {%- endif -%}
56
+ {%- if value['nullable'] %}
57
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
58
+ nullable:true
59
+ {%- endif -%}
60
+ {%- if value['type'] | upper == 'OBJECT' -%}
61
+ {%- if value['properties'] is defined and value['properties'] is mapping -%}
62
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
63
+ properties:{
64
+ {{- format_parameters(value['properties'], value['required'] | default([])) -}}
65
+ }
66
+ {%- elif value is mapping -%}
67
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
68
+ properties:{
69
+ {{- format_parameters(value, value['required'] | default([]), filter_keys=true) -}}
70
+ }
71
+ {%- endif -%}
72
+ {%- if value['required'] -%}
73
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
74
+ required:[
75
+ {%- for item in value['required'] | default([]) -%}
76
+ <|"|>{{- item -}}<|"|>
77
+ {%- if not loop.last %},{% endif -%}
78
+ {%- endfor -%}
79
+ ]
80
+ {%- endif -%}
81
+ {%- endif -%}
82
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
83
+ type:<|"|>{{ value['type'] | upper }}<|"|>}
84
+ {%- endif -%}
85
+ {%- endfor -%}
86
+ {%- endmacro -%}
87
+ {%- macro format_function_declaration(tool_data) -%}
88
+ declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|>
89
+ {%- set params = tool_data['function']['parameters'] -%}
90
+ {%- if params -%}
91
+ ,parameters:{
92
+ {%- if params['properties'] -%}
93
+ properties:{ {{- format_parameters(params['properties'], params['required']) -}} },
94
+ {%- endif -%}
95
+ {%- if params['required'] -%}
96
+ required:[
97
+ {%- for item in params['required'] -%}
98
+ <|"|>{{- item -}}<|"|>
99
+ {{- ',' if not loop.last -}}
100
+ {%- endfor -%}
101
+ ],
102
+ {%- endif -%}
103
+ {%- if params['type'] -%}
104
+ type:<|"|>{{- params['type'] | upper -}}<|"|>}
105
+ {%- endif -%}
106
+ {%- endif -%}
107
+ {%- if 'response' in tool_data['function'] -%}
108
+ {%- set response_declaration = tool_data['function']['response'] -%}
109
+ ,response:{
110
+ {%- if response_declaration['description'] -%}
111
+ description:<|"|>{{- response_declaration['description'] -}}<|"|>,
112
+ {%- endif -%}
113
+ {%- if response_declaration['type'] | upper == 'OBJECT' -%}
114
+ type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>}
115
+ {%- endif -%}
116
+ {%- endif -%}
117
+ }
118
+ {%- endmacro -%}
119
+ {%- macro format_argument(argument, escape_keys=True) -%}
120
+ {%- if argument is string -%}
121
+ {{- '<|"|>' + argument + '<|"|>' -}}
122
+ {%- elif argument is boolean -%}
123
+ {{- 'true' if argument else 'false' -}}
124
+ {%- elif argument is mapping -%}
125
+ {{- '{' -}}
126
+ {%- set ns = namespace(found_first=false) -%}
127
+ {%- for key, value in argument | dictsort -%}
128
+ {%- if ns.found_first %},{% endif -%}
129
+ {%- set ns.found_first = true -%}
130
+ {%- if escape_keys -%}
131
+ {{- '<|"|>' + key + '<|"|>' -}}
132
+ {%- else -%}
133
+ {{- key -}}
134
+ {%- endif -%}
135
+ :{{- format_argument(value, escape_keys=escape_keys) -}}
136
+ {%- endfor -%}
137
+ {{- '}' -}}
138
+ {%- elif argument is sequence -%}
139
+ {{- '[' -}}
140
+ {%- for item in argument -%}
141
+ {{- format_argument(item, escape_keys=escape_keys) -}}
142
+ {%- if not loop.last %},{% endif -%}
143
+ {%- endfor -%}
144
+ {{- ']' -}}
145
+ {%- else -%}
146
+ {{- argument -}}
147
+ {%- endif -%}
148
+ {%- endmacro -%}
149
+ {%- macro strip_thinking(text) -%}
150
+ {%- set ns = namespace(result='') -%}
151
+ {%- for part in text.split('<channel|>') -%}
152
+ {%- if '<|channel>' in part -%}
153
+ {%- set ns.result = ns.result + part.split('<|channel>')[0] -%}
154
+ {%- else -%}
155
+ {%- set ns.result = ns.result + part -%}
156
+ {%- endif -%}
157
+ {%- endfor -%}
158
+ {{- ns.result | trim -}}
159
+ {%- endmacro -%}
160
+
161
+ {%- macro format_tool_response_block(tool_name, response) -%}
162
+ {{- '<|tool_response>' -}}
163
+ {%- if response is mapping -%}
164
+ {{- 'response:' + tool_name + '{' -}}
165
+ {%- for key, value in response | dictsort -%}
166
+ {{- key -}}:{{- format_argument(value, escape_keys=False) -}}
167
+ {%- if not loop.last %},{% endif -%}
168
+ {%- endfor -%}
169
+ {{- '}' -}}
170
+ {%- else -%}
171
+ {{- 'response:' + tool_name + '{value:' + format_argument(response, escape_keys=False) + '}' -}}
172
+ {%- endif -%}
173
+ {{- '<tool_response|>' -}}
174
+ {%- endmacro -%}
175
+
176
+ {%- set ns = namespace(prev_message_type=None) -%}
177
+ {%- set loop_messages = messages -%}
178
+ {{- bos_token -}}
179
+ {#- Handle System/Tool Definitions Block -#}
180
+ {%- if (enable_thinking is defined and enable_thinking) or tools or messages[0]['role'] in ['system', 'developer'] -%}
181
+ {{- '<|turn>system\n' -}}
182
+ {#- Inject Thinking token at the very top of the FIRST system turn -#}
183
+ {%- if enable_thinking is defined and enable_thinking -%}
184
+ {{- '<|think|>\n' -}}
185
+ {%- set ns.prev_message_type = 'think' -%}
186
+ {%- endif -%}
187
+ {%- if messages[0]['role'] in ['system', 'developer'] -%}
188
+ {%- if messages[0]['content'] is string -%}
189
+ {{- messages[0]['content'] | trim -}}
190
+ {%- elif messages[0]['content'] is sequence -%}
191
+ {%- for item in messages[0]['content'] -%}
192
+ {{- item['text'] | trim + ' '-}}
193
+ {%- endfor -%}
194
+ {%- endif -%}
195
+ {%- set loop_messages = messages[1:] -%}
196
+ {%- endif -%}
197
+ {%- if tools -%}
198
+ {%- for tool in tools %}
199
+ {{- '<|tool>' -}}
200
+ {{- format_function_declaration(tool) | trim -}}
201
+ {{- '<tool|>' -}}
202
+ {%- endfor %}
203
+ {%- set ns.prev_message_type = 'tool' -%}
204
+ {%- endif -%}
205
+ {{- '<turn|>\n' -}}
206
+ {%- endif %}
207
+
208
+ {#- Pre-scan: find last user message index for reasoning guard -#}
209
+ {%- set ns_turn = namespace(last_user_idx=-1) -%}
210
+ {%- for i in range(loop_messages | length) -%}
211
+ {%- if loop_messages[i]['role'] == 'user' -%}
212
+ {%- set ns_turn.last_user_idx = i -%}
213
+ {%- endif -%}
214
+ {%- endfor -%}
215
+
216
+ {#- Loop through messages -#}
217
+ {%- for message in loop_messages -%}
218
+ {%- if message['role'] != 'tool' -%}
219
+ {%- set ns.prev_message_type = None -%}
220
+ {%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%}
221
+ {#- Detect continuation: suppress duplicate <|turn>model when previous non-tool message was also assistant -#}
222
+ {%- set prev_nt = namespace(role=None, found=false) -%}
223
+ {%- if loop.index0 > 0 -%}
224
+ {%- for j in range(loop.index0 - 1, -1, -1) -%}
225
+ {%- if not prev_nt.found -%}
226
+ {%- if loop_messages[j]['role'] != 'tool' -%}
227
+ {%- set prev_nt.role = loop_messages[j]['role'] -%}
228
+ {%- set prev_nt.found = true -%}
229
+ {%- endif -%}
230
+ {%- endif -%}
231
+ {%- endfor -%}
232
+ {%- endif -%}
233
+ {%- set continue_same_model_turn = (role == 'model' and prev_nt.role == 'assistant') -%}
234
+ {%- if not continue_same_model_turn -%}
235
+ {{- '<|turn>' + role + '\n' }}
236
+ {%- endif -%}
237
+
238
+ {#- Render reasoning/reasoning_content as thinking channel -#}
239
+ {%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%}
240
+ {%- if thinking_text and loop.index0 > ns_turn.last_user_idx and message.get('tool_calls') -%}
241
+ {{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}}
242
+ {%- endif -%}
243
+
244
+ {%- if message['tool_calls'] -%}
245
+ {%- for tool_call in message['tool_calls'] -%}
246
+ {%- set function = tool_call['function'] -%}
247
+ {{- '<|tool_call>call:' + function['name'] + '{' -}}
248
+ {%- if function['arguments'] is mapping -%}
249
+ {%- set ns_args = namespace(found_first=false) -%}
250
+ {%- for key, value in function['arguments'] | dictsort -%}
251
+ {%- if ns_args.found_first %},{% endif -%}
252
+ {%- set ns_args.found_first = true -%}
253
+ {{- key -}}:{{- format_argument(value, escape_keys=False) -}}
254
+ {%- endfor -%}
255
+ {%- elif function['arguments'] is string -%}
256
+ {{- function['arguments'] -}}
257
+ {%- endif -%}
258
+ {{- '}<tool_call|>' -}}
259
+ {%- endfor -%}
260
+ {%- set ns.prev_message_type = 'tool_call' -%}
261
+ {%- endif -%}
262
+
263
+ {%- set ns_tr_out = namespace(flag=false) -%}
264
+ {%- if message.get('tool_responses') -%}
265
+ {#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#}
266
+ {%- for tool_response in message['tool_responses'] -%}
267
+ {{- format_tool_response_block(tool_response['name'] | default('unknown'), tool_response['response']) -}}
268
+ {%- set ns_tr_out.flag = true -%}
269
+ {%- set ns.prev_message_type = 'tool_response' -%}
270
+ {%- endfor -%}
271
+ {%- elif message.get('tool_calls') -%}
272
+ {#- OpenAI Chat Completions: forward-scan consecutive role:tool messages -#}
273
+ {%- set ns_tool_scan = namespace(stopped=false) -%}
274
+ {%- for k in range(loop.index0 + 1, loop_messages | length) -%}
275
+ {%- if ns_tool_scan.stopped -%}
276
+ {%- elif loop_messages[k]['role'] != 'tool' -%}
277
+ {%- set ns_tool_scan.stopped = true -%}
278
+ {%- else -%}
279
+ {%- set follow = loop_messages[k] -%}
280
+ {#- Resolve tool_call_id to function name -#}
281
+ {%- set ns_tname = namespace(name=follow.get('name') | default('unknown')) -%}
282
+ {%- for tc in message['tool_calls'] -%}
283
+ {%- if tc.get('id') == follow.get('tool_call_id') -%}
284
+ {%- set ns_tname.name = tc['function']['name'] -%}
285
+ {%- endif -%}
286
+ {%- endfor -%}
287
+ {#- Handle content as string or content-parts array -#}
288
+ {%- set tool_body = follow.get('content') -%}
289
+ {%- if tool_body is string -%}
290
+ {{- format_tool_response_block(ns_tname.name, tool_body) -}}
291
+ {%- elif tool_body is sequence and tool_body is not string -%}
292
+ {%- set ns_txt = namespace(s='') -%}
293
+ {%- for part in tool_body -%}
294
+ {%- if part.get('type') == 'text' -%}
295
+ {%- set ns_txt.s = ns_txt.s + (part.get('text') | default('')) -%}
296
+ {%- endif -%}
297
+ {%- endfor -%}
298
+ {{- format_tool_response_block(ns_tname.name, ns_txt.s) -}}
299
+ {%- else -%}
300
+ {{- format_tool_response_block(ns_tname.name, tool_body) -}}
301
+ {%- endif -%}
302
+ {%- set ns_tr_out.flag = true -%}
303
+ {%- set ns.prev_message_type = 'tool_response' -%}
304
+ {%- endif -%}
305
+ {%- endfor -%}
306
+ {%- endif -%}
307
+
308
+ {%- set captured_content -%}
309
+ {%- if message['content'] is string -%}
310
+ {%- if role == 'model' -%}
311
+ {{- strip_thinking(message['content']) -}}
312
+ {%- else -%}
313
+ {{- message['content'] | trim -}}
314
+ {%- endif -%}
315
+ {%- elif message['content'] is sequence -%}
316
+ {%- for item in message['content'] -%}
317
+ {%- if item['type'] == 'text' -%}
318
+ {%- if role == 'model' -%}
319
+ {{- strip_thinking(item['text']) -}}
320
+ {%- else -%}
321
+ {{- item['text'] | trim -}}
322
+ {%- endif -%}
323
+ {%- elif item['type'] == 'image' -%}
324
+ {{- '<|image|>' -}}
325
+ {%- set ns.prev_message_type = 'image' -%}
326
+ {%- elif item['type'] == 'audio' -%}
327
+ {{- '<|audio|>' -}}
328
+ {%- set ns.prev_message_type = 'audio' -%}
329
+ {%- elif item['type'] == 'video' -%}
330
+ {{- '<|video|>' -}}
331
+ {%- set ns.prev_message_type = 'video' -%}
332
+ {%- endif -%}
333
+ {%- endfor -%}
334
+ {%- endif -%}
335
+ {%- endset -%}
336
+
337
+ {{- captured_content -}}
338
+ {%- set has_content = captured_content | trim | length > 0 -%}
339
+
340
+ {%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%}
341
+ {{- '<|tool_response>' -}}
342
+ {%- elif not (ns_tr_out.flag and not has_content) -%}
343
+ {{- '<turn|>\n' -}}
344
+ {%- endif -%}
345
+ {%- endif -%}
346
+ {%- endfor -%}
347
+
348
+ {%- if add_generation_prompt -%}
349
+ {%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%}
350
+ {{- '<|turn>model\n' -}}
351
+ {%- if not enable_thinking | default(false) -%}
352
+ {{- '<|channel>thought\n<channel|>' -}}
353
+ {%- endif -%}
354
+ {%- endif -%}
355
+ {%- endif -%}
config.json ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Gemma4ForConditionalGeneration"
4
+ ],
5
+ "audio_config": null,
6
+ "audio_token_id": 258881,
7
+ "boa_token_id": 256000,
8
+ "boi_token_id": 255999,
9
+ "bos_token_id": 2,
10
+ "dtype": "bfloat16",
11
+ "eoa_token_id": 258883,
12
+ "eoa_token_index": 258883,
13
+ "eoi_token_id": 258882,
14
+ "eos_token_id": 106,
15
+ "image_token_id": 258880,
16
+ "initializer_range": 0.02,
17
+ "model_name": "unsloth/gemma-4-31B-it",
18
+ "model_type": "gemma4",
19
+ "pad_token_id": 0,
20
+ "text_config": {
21
+ "attention_bias": false,
22
+ "attention_dropout": 0.0,
23
+ "attention_k_eq_v": true,
24
+ "bos_token_id": 2,
25
+ "dtype": "bfloat16",
26
+ "enable_moe_block": false,
27
+ "eos_token_id": 1,
28
+ "expert_intermediate_size": null,
29
+ "final_logit_softcapping": 30.0,
30
+ "global_head_dim": 512,
31
+ "head_dim": 256,
32
+ "hidden_activation": "gelu_pytorch_tanh",
33
+ "hidden_size": 5376,
34
+ "hidden_size_per_layer_input": 0,
35
+ "initializer_range": 0.02,
36
+ "intermediate_size": 21504,
37
+ "layer_types": [
38
+ "sliding_attention",
39
+ "sliding_attention",
40
+ "sliding_attention",
41
+ "sliding_attention",
42
+ "sliding_attention",
43
+ "full_attention",
44
+ "sliding_attention",
45
+ "sliding_attention",
46
+ "sliding_attention",
47
+ "sliding_attention",
48
+ "sliding_attention",
49
+ "full_attention",
50
+ "sliding_attention",
51
+ "sliding_attention",
52
+ "sliding_attention",
53
+ "sliding_attention",
54
+ "sliding_attention",
55
+ "full_attention",
56
+ "sliding_attention",
57
+ "sliding_attention",
58
+ "sliding_attention",
59
+ "sliding_attention",
60
+ "sliding_attention",
61
+ "full_attention",
62
+ "sliding_attention",
63
+ "sliding_attention",
64
+ "sliding_attention",
65
+ "sliding_attention",
66
+ "sliding_attention",
67
+ "full_attention",
68
+ "sliding_attention",
69
+ "sliding_attention",
70
+ "sliding_attention",
71
+ "sliding_attention",
72
+ "sliding_attention",
73
+ "full_attention",
74
+ "sliding_attention",
75
+ "sliding_attention",
76
+ "sliding_attention",
77
+ "sliding_attention",
78
+ "sliding_attention",
79
+ "full_attention",
80
+ "sliding_attention",
81
+ "sliding_attention",
82
+ "sliding_attention",
83
+ "sliding_attention",
84
+ "sliding_attention",
85
+ "full_attention",
86
+ "sliding_attention",
87
+ "sliding_attention",
88
+ "sliding_attention",
89
+ "sliding_attention",
90
+ "sliding_attention",
91
+ "full_attention",
92
+ "sliding_attention",
93
+ "sliding_attention",
94
+ "sliding_attention",
95
+ "sliding_attention",
96
+ "sliding_attention",
97
+ "full_attention"
98
+ ],
99
+ "max_position_embeddings": 262144,
100
+ "model_type": "gemma4_text",
101
+ "moe_intermediate_size": null,
102
+ "num_attention_heads": 32,
103
+ "num_experts": null,
104
+ "num_global_key_value_heads": 4,
105
+ "num_hidden_layers": 60,
106
+ "num_key_value_heads": 16,
107
+ "num_kv_shared_layers": 0,
108
+ "pad_token_id": 0,
109
+ "rms_norm_eps": 1e-06,
110
+ "rope_parameters": {
111
+ "full_attention": {
112
+ "partial_rotary_factor": 0.25,
113
+ "rope_theta": 1000000.0,
114
+ "rope_type": "proportional"
115
+ },
116
+ "sliding_attention": {
117
+ "rope_theta": 10000.0,
118
+ "rope_type": "default"
119
+ }
120
+ },
121
+ "sliding_window": 1024,
122
+ "tie_word_embeddings": true,
123
+ "top_k_experts": null,
124
+ "use_bidirectional_attention": "vision",
125
+ "use_cache": true,
126
+ "use_double_wide_mlp": false,
127
+ "vocab_size": 262144,
128
+ "vocab_size_per_layer_input": 262144
129
+ },
130
+ "tie_word_embeddings": true,
131
+ "transformers_version": "5.5.4",
132
+ "unsloth_fixed": true,
133
+ "unsloth_version": "2026.4.4",
134
+ "video_token_id": 258884,
135
+ "vision_config": {
136
+ "_name_or_path": "",
137
+ "architectures": null,
138
+ "attention_bias": false,
139
+ "attention_dropout": 0.0,
140
+ "chunk_size_feed_forward": 0,
141
+ "default_output_length": 280,
142
+ "dtype": "bfloat16",
143
+ "global_head_dim": 72,
144
+ "head_dim": 72,
145
+ "hidden_activation": "gelu_pytorch_tanh",
146
+ "hidden_size": 1152,
147
+ "id2label": {
148
+ "0": "LABEL_0",
149
+ "1": "LABEL_1"
150
+ },
151
+ "initializer_range": 0.02,
152
+ "intermediate_size": 4304,
153
+ "is_encoder_decoder": false,
154
+ "label2id": {
155
+ "LABEL_0": 0,
156
+ "LABEL_1": 1
157
+ },
158
+ "max_position_embeddings": 131072,
159
+ "model_type": "gemma4_vision",
160
+ "num_attention_heads": 16,
161
+ "num_hidden_layers": 27,
162
+ "num_key_value_heads": 16,
163
+ "output_attentions": false,
164
+ "output_hidden_states": false,
165
+ "patch_size": 16,
166
+ "pooling_kernel_size": 3,
167
+ "position_embedding_size": 10240,
168
+ "problem_type": null,
169
+ "return_dict": true,
170
+ "rms_norm_eps": 1e-06,
171
+ "rope_parameters": {
172
+ "rope_theta": 100.0,
173
+ "rope_type": "default"
174
+ },
175
+ "standardize": true,
176
+ "use_clipped_linears": false
177
+ },
178
+ "vision_soft_tokens_per_image": 280
179
+ }
generation_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 2,
4
+ "eos_token_id": 106,
5
+ "pad_token_id": 0,
6
+ "transformers_version": "5.5.4",
7
+ "use_cache": false
8
+ }
model-00001-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dd225be39f62155c50e0d7165cab237ea8261e48246a6a4672dac7d7ee66ace6
3
+ size 49923154850
model-00002-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0878ca17c0f6b49b74515cd88e29abf9c083a36681df9adf01ae8bf847e7403
3
+ size 12623183414
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5d84efaa7efd10a17dd1d85d92456585541d6e6c9ef37eb78b8eb753442905f5
3
+ size 32169725
tokenizer_config.json ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "audio_token": "<|audio|>",
3
+ "backend": "tokenizers",
4
+ "boa_token": "<|audio>",
5
+ "boi_token": "<|image>",
6
+ "bos_token": "<bos>",
7
+ "eoa_token": "<audio|>",
8
+ "eoc_token": "<channel|>",
9
+ "eoi_token": "<image|>",
10
+ "eos_token": "<eos>",
11
+ "eot_token": "<turn|>",
12
+ "escape_token": "<|\"|>",
13
+ "etc_token": "<tool_call|>",
14
+ "etd_token": "<tool|>",
15
+ "etr_token": "<tool_response|>",
16
+ "extra_special_tokens": [
17
+ "<|video|>"
18
+ ],
19
+ "image_token": "<|image|>",
20
+ "is_local": false,
21
+ "mask_token": "<mask>",
22
+ "model_max_length": 1000000000000000019884624838656,
23
+ "model_specific_special_tokens": {
24
+ "audio_token": "<|audio|>",
25
+ "boa_token": "<|audio>",
26
+ "boi_token": "<|image>",
27
+ "eoa_token": "<audio|>",
28
+ "eoc_token": "<channel|>",
29
+ "eoi_token": "<image|>",
30
+ "eot_token": "<turn|>",
31
+ "escape_token": "<|\"|>",
32
+ "etc_token": "<tool_call|>",
33
+ "etd_token": "<tool|>",
34
+ "etr_token": "<tool_response|>",
35
+ "image_token": "<|image|>",
36
+ "soc_token": "<|channel>",
37
+ "sot_token": "<|turn>",
38
+ "stc_token": "<|tool_call>",
39
+ "std_token": "<|tool>",
40
+ "str_token": "<|tool_response>",
41
+ "think_token": "<|think|>"
42
+ },
43
+ "pad_token": "<pad>",
44
+ "padding_side": "left",
45
+ "processor_class": "Gemma4Processor",
46
+ "response_schema": {
47
+ "properties": {
48
+ "content": {
49
+ "type": "string"
50
+ },
51
+ "role": {
52
+ "const": "assistant"
53
+ },
54
+ "thinking": {
55
+ "type": "string"
56
+ },
57
+ "tool_calls": {
58
+ "items": {
59
+ "properties": {
60
+ "function": {
61
+ "properties": {
62
+ "arguments": {
63
+ "additionalProperties": {},
64
+ "type": "object",
65
+ "x-parser": "gemma4-tool-call"
66
+ },
67
+ "name": {
68
+ "type": "string"
69
+ }
70
+ },
71
+ "type": "object",
72
+ "x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})"
73
+ },
74
+ "type": {
75
+ "const": "function"
76
+ }
77
+ },
78
+ "type": "object"
79
+ },
80
+ "type": "array",
81
+ "x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>"
82
+ }
83
+ },
84
+ "type": "object",
85
+ "x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<content>(?:(?!\\<\\|tool_call\\>)(?!\\<turn\\|\\>).)+)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?:\\<turn\\|\\>)?"
86
+ },
87
+ "soc_token": "<|channel>",
88
+ "sot_token": "<|turn>",
89
+ "stc_token": "<|tool_call>",
90
+ "std_token": "<|tool>",
91
+ "str_token": "<|tool_response>",
92
+ "think_token": "<|think|>",
93
+ "tokenizer_class": "GemmaTokenizer",
94
+ "unk_token": "<unk>"
95
+ }