yujiepan commited on
Commit
98a9a8f
·
verified ·
1 Parent(s): 36dd3f9

Upload folder using huggingface_hub

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,387 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ base_model:
4
+ - google/gemma-4-E4B-it
5
+ ---
6
+
7
+ This tiny model is intended for debugging. It is randomly initialized using the configuration adapted from [google/gemma-4-E4B-it](https://huggingface.co/google/gemma-4-E4B-it).
8
+
9
+ | File path | Size |
10
+ |------|------|
11
+ | model.safetensors | 9.5MB |
12
+
13
+
14
+ ### Example usage:
15
+
16
+ ```python
17
+ import torch
18
+
19
+ from transformers import pipeline, AutoProcessor, AutoModelForCausalLM
20
+
21
+ model_id = "tiny-random/gemma-4e"
22
+ processor = AutoProcessor.from_pretrained(model_id)
23
+ model = AutoModelForCausalLM.from_pretrained(
24
+ model_id,
25
+ dtype=torch.bfloat16,
26
+ device_map="auto"
27
+ )
28
+ messages = [
29
+ {"role": "system", "content": "You are a helpful assistant."},
30
+ {"role": "user", "content": [
31
+ {"type": "audio", "audio": "https://raw.githubusercontent.com/google-gemma/cookbook/refs/heads/main/Demos/sample-data/journal1.wav"},
32
+ {"type": "text", "text": "Transcribe the following speech segment in its original language. Follow these specific instructions for formatting the answer:\n* Only output the transcription, with no newlines.\n* When transcribing numbers, write the digits, i.e. write 1.7 and not one point seven, and write 3 instead of three."},
33
+ ]},
34
+ ]
35
+ text = processor.apply_chat_template(
36
+ messages,
37
+ tokenize=False,
38
+ add_generation_prompt=True,
39
+ enable_thinking=True,
40
+ )
41
+ inputs = processor(text=text, return_tensors="pt").to(model.device)
42
+ input_len = inputs["input_ids"].shape[-1]
43
+ outputs = model.generate(**inputs, max_new_tokens=16)
44
+ response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
45
+ print(processor.parse_response(response))
46
+ ```
47
+
48
+ ### Codes to create this repo:
49
+
50
+ <details>
51
+ <summary>Click to expand</summary>
52
+
53
+ ```python
54
+ import json
55
+ from pathlib import Path
56
+
57
+ import torch
58
+
59
+ from huggingface_hub import file_exists, hf_hub_download
60
+ # from timm.models.mobilenetv5 import decode_arch_def
61
+ from transformers import (
62
+ AutoConfig,
63
+ AutoModelForCausalLM,
64
+ AutoProcessor,
65
+ AutoTokenizer,
66
+ Gemma4ForConditionalGeneration,
67
+ GenerationConfig,
68
+ set_seed,
69
+ )
70
+
71
+ source_model_id = "google/gemma-4-E4B-it"
72
+ save_folder = "/tmp/tiny-random/gemma-4e"
73
+
74
+ processor = AutoProcessor.from_pretrained(source_model_id)
75
+ processor.save_pretrained(save_folder)
76
+
77
+ with open(hf_hub_download(source_model_id, filename='config.json', repo_type='model'), 'r', encoding='utf-8') as f:
78
+ config_json = json.load(f)
79
+
80
+ config_json['audio_config'].update({
81
+ "num_attention_heads": 2,
82
+ "num_hidden_layers": 2,
83
+ "hidden_size": 64,
84
+ 'output_proj_dims': 32,
85
+ })
86
+ config_json['text_config'].update({
87
+ "global_head_dim": 64,
88
+ "head_dim": 32,
89
+ "hidden_size": 8,
90
+ "hidden_size_per_layer_input": 2,
91
+ "intermediate_size": 64,
92
+ "layer_types": ['sliding_attention', 'full_attention', 'sliding_attention', 'full_attention'],
93
+ "num_attention_heads": 8,
94
+ "num_hidden_layers": 4,
95
+ "num_key_value_heads": 4,
96
+ "num_kv_shared_layers": 2,
97
+ })
98
+ config_json['vision_config'].update({
99
+ 'num_hidden_layers': 2,
100
+ 'hidden_size': 8,
101
+ 'intermediate_size': 64,
102
+ 'head_dim': 32,
103
+ 'global_head_dim': 32,
104
+ 'num_attention_heads': 4,
105
+ "num_key_value_heads": 4,
106
+ })
107
+
108
+ with open(f"{save_folder}/config.json", "w", encoding='utf-8') as f:
109
+ json.dump(config_json, f, indent=2)
110
+
111
+ config = AutoConfig.from_pretrained(
112
+ save_folder,
113
+ trust_remote_code=True,
114
+ )
115
+ print(config)
116
+
117
+ torch.set_default_dtype(torch.bfloat16)
118
+ model = Gemma4ForConditionalGeneration(config)
119
+ torch.set_default_dtype(torch.float32)
120
+ if file_exists(filename="generation_config.json", repo_id=source_model_id, repo_type='model'):
121
+ model.generation_config = GenerationConfig.from_pretrained(
122
+ source_model_id, trust_remote_code=True,
123
+ )
124
+ set_seed(42)
125
+ model = model.cpu()
126
+ all_numels = 0
127
+ for name, p in sorted(model.named_parameters()):
128
+ all_numels += p.numel()
129
+ with torch.no_grad():
130
+ for name, p in sorted(model.named_parameters()):
131
+ torch.nn.init.normal_(p, 0, 0.2)
132
+ print(name, p.shape, f'{p.numel() / all_numels * 100: .4f}%')
133
+ model.save_pretrained(save_folder)
134
+ ```
135
+
136
+ </details>
137
+
138
+ ### Printing the model:
139
+
140
+ <details><summary>Click to expand</summary>
141
+
142
+ ```text
143
+ Gemma4ForConditionalGeneration(
144
+ (model): Gemma4Model(
145
+ (language_model): Gemma4TextModel(
146
+ (embed_tokens): Gemma4TextScaledWordEmbedding(262144, 8, padding_idx=0)
147
+ (layers): ModuleList(
148
+ (0): Gemma4TextDecoderLayer(
149
+ (self_attn): Gemma4TextAttention(
150
+ (q_norm): Gemma4RMSNorm()
151
+ (k_norm): Gemma4RMSNorm()
152
+ (v_norm): Gemma4RMSNorm()
153
+ (k_proj): Linear(in_features=8, out_features=128, bias=False)
154
+ (q_proj): Linear(in_features=8, out_features=256, bias=False)
155
+ (v_proj): Linear(in_features=8, out_features=128, bias=False)
156
+ (o_proj): Linear(in_features=256, out_features=8, bias=False)
157
+ )
158
+ (mlp): Gemma4TextMLP(
159
+ (gate_proj): Linear(in_features=8, out_features=64, bias=False)
160
+ (up_proj): Linear(in_features=8, out_features=64, bias=False)
161
+ (down_proj): Linear(in_features=64, out_features=8, bias=False)
162
+ (act_fn): GELUTanh()
163
+ )
164
+ (input_layernorm): Gemma4RMSNorm()
165
+ (post_attention_layernorm): Gemma4RMSNorm()
166
+ (pre_feedforward_layernorm): Gemma4RMSNorm()
167
+ (post_feedforward_layernorm): Gemma4RMSNorm()
168
+ (act_fn): GELUTanh()
169
+ (per_layer_input_gate): Linear(in_features=8, out_features=2, bias=False)
170
+ (per_layer_projection): Linear(in_features=2, out_features=8, bias=False)
171
+ (post_per_layer_input_norm): Gemma4RMSNorm()
172
+ )
173
+ (1): Gemma4TextDecoderLayer(
174
+ (self_attn): Gemma4TextAttention(
175
+ (q_norm): Gemma4RMSNorm()
176
+ (k_norm): Gemma4RMSNorm()
177
+ (v_norm): Gemma4RMSNorm()
178
+ (k_proj): Linear(in_features=8, out_features=256, bias=False)
179
+ (q_proj): Linear(in_features=8, out_features=512, bias=False)
180
+ (v_proj): Linear(in_features=8, out_features=256, bias=False)
181
+ (o_proj): Linear(in_features=512, out_features=8, bias=False)
182
+ )
183
+ (mlp): Gemma4TextMLP(
184
+ (gate_proj): Linear(in_features=8, out_features=64, bias=False)
185
+ (up_proj): Linear(in_features=8, out_features=64, bias=False)
186
+ (down_proj): Linear(in_features=64, out_features=8, bias=False)
187
+ (act_fn): GELUTanh()
188
+ )
189
+ (input_layernorm): Gemma4RMSNorm()
190
+ (post_attention_layernorm): Gemma4RMSNorm()
191
+ (pre_feedforward_layernorm): Gemma4RMSNorm()
192
+ (post_feedforward_layernorm): Gemma4RMSNorm()
193
+ (act_fn): GELUTanh()
194
+ (per_layer_input_gate): Linear(in_features=8, out_features=2, bias=False)
195
+ (per_layer_projection): Linear(in_features=2, out_features=8, bias=False)
196
+ (post_per_layer_input_norm): Gemma4RMSNorm()
197
+ )
198
+ (2): Gemma4TextDecoderLayer(
199
+ (self_attn): Gemma4TextAttention(
200
+ (q_norm): Gemma4RMSNorm()
201
+ (k_norm): Gemma4RMSNorm()
202
+ (v_norm): Gemma4RMSNorm()
203
+ (k_proj): Linear(in_features=8, out_features=128, bias=False)
204
+ (q_proj): Linear(in_features=8, out_features=256, bias=False)
205
+ (v_proj): Linear(in_features=8, out_features=128, bias=False)
206
+ (o_proj): Linear(in_features=256, out_features=8, bias=False)
207
+ )
208
+ (mlp): Gemma4TextMLP(
209
+ (gate_proj): Linear(in_features=8, out_features=64, bias=False)
210
+ (up_proj): Linear(in_features=8, out_features=64, bias=False)
211
+ (down_proj): Linear(in_features=64, out_features=8, bias=False)
212
+ (act_fn): GELUTanh()
213
+ )
214
+ (input_layernorm): Gemma4RMSNorm()
215
+ (post_attention_layernorm): Gemma4RMSNorm()
216
+ (pre_feedforward_layernorm): Gemma4RMSNorm()
217
+ (post_feedforward_layernorm): Gemma4RMSNorm()
218
+ (act_fn): GELUTanh()
219
+ (per_layer_input_gate): Linear(in_features=8, out_features=2, bias=False)
220
+ (per_layer_projection): Linear(in_features=2, out_features=8, bias=False)
221
+ (post_per_layer_input_norm): Gemma4RMSNorm()
222
+ )
223
+ (3): Gemma4TextDecoderLayer(
224
+ (self_attn): Gemma4TextAttention(
225
+ (q_norm): Gemma4RMSNorm()
226
+ (k_norm): Gemma4RMSNorm()
227
+ (v_norm): Gemma4RMSNorm()
228
+ (k_proj): Linear(in_features=8, out_features=256, bias=False)
229
+ (q_proj): Linear(in_features=8, out_features=512, bias=False)
230
+ (v_proj): Linear(in_features=8, out_features=256, bias=False)
231
+ (o_proj): Linear(in_features=512, out_features=8, bias=False)
232
+ )
233
+ (mlp): Gemma4TextMLP(
234
+ (gate_proj): Linear(in_features=8, out_features=64, bias=False)
235
+ (up_proj): Linear(in_features=8, out_features=64, bias=False)
236
+ (down_proj): Linear(in_features=64, out_features=8, bias=False)
237
+ (act_fn): GELUTanh()
238
+ )
239
+ (input_layernorm): Gemma4RMSNorm()
240
+ (post_attention_layernorm): Gemma4RMSNorm()
241
+ (pre_feedforward_layernorm): Gemma4RMSNorm()
242
+ (post_feedforward_layernorm): Gemma4RMSNorm()
243
+ (act_fn): GELUTanh()
244
+ (per_layer_input_gate): Linear(in_features=8, out_features=2, bias=False)
245
+ (per_layer_projection): Linear(in_features=2, out_features=8, bias=False)
246
+ (post_per_layer_input_norm): Gemma4RMSNorm()
247
+ )
248
+ )
249
+ (norm): Gemma4RMSNorm()
250
+ (rotary_emb): Gemma4TextRotaryEmbedding()
251
+ (embed_tokens_per_layer): Gemma4TextScaledWordEmbedding(262144, 8, padding_idx=0)
252
+ (per_layer_model_projection): Linear(in_features=8, out_features=8, bias=False)
253
+ (per_layer_projection_norm): Gemma4RMSNorm()
254
+ )
255
+ (vision_tower): Gemma4VisionModel(
256
+ (patch_embedder): Gemma4VisionPatchEmbedder(
257
+ (input_proj): Linear(in_features=768, out_features=8, bias=False)
258
+ )
259
+ (encoder): Gemma4VisionEncoder(
260
+ (rotary_emb): Gemma4VisionRotaryEmbedding()
261
+ (layers): ModuleList(
262
+ (0-1): 2 x Gemma4VisionEncoderLayer(
263
+ (self_attn): Gemma4VisionAttention(
264
+ (q_proj): Gemma4ClippableLinear(
265
+ (linear): Linear(in_features=8, out_features=128, bias=False)
266
+ )
267
+ (k_proj): Gemma4ClippableLinear(
268
+ (linear): Linear(in_features=8, out_features=128, bias=False)
269
+ )
270
+ (v_proj): Gemma4ClippableLinear(
271
+ (linear): Linear(in_features=8, out_features=128, bias=False)
272
+ )
273
+ (o_proj): Gemma4ClippableLinear(
274
+ (linear): Linear(in_features=128, out_features=8, bias=False)
275
+ )
276
+ (q_norm): Gemma4RMSNorm()
277
+ (k_norm): Gemma4RMSNorm()
278
+ (v_norm): Gemma4RMSNorm()
279
+ )
280
+ (mlp): Gemma4VisionMLP(
281
+ (gate_proj): Gemma4ClippableLinear(
282
+ (linear): Linear(in_features=8, out_features=64, bias=False)
283
+ )
284
+ (up_proj): Gemma4ClippableLinear(
285
+ (linear): Linear(in_features=8, out_features=64, bias=False)
286
+ )
287
+ (down_proj): Gemma4ClippableLinear(
288
+ (linear): Linear(in_features=64, out_features=8, bias=False)
289
+ )
290
+ (act_fn): GELUTanh()
291
+ )
292
+ (input_layernorm): Gemma4RMSNorm()
293
+ (post_attention_layernorm): Gemma4RMSNorm()
294
+ (pre_feedforward_layernorm): Gemma4RMSNorm()
295
+ (post_feedforward_layernorm): Gemma4RMSNorm()
296
+ )
297
+ )
298
+ )
299
+ (pooler): Gemma4VisionPooler()
300
+ )
301
+ (embed_vision): Gemma4MultimodalEmbedder(
302
+ (embedding_projection): Linear(in_features=8, out_features=8, bias=False)
303
+ (embedding_pre_projection_norm): Gemma4RMSNorm()
304
+ )
305
+ (audio_tower): Gemma4AudioModel(
306
+ (subsample_conv_projection): Gemma4AudioSubSampleConvProjection(
307
+ (layer0): Gemma4AudioSubSampleConvProjectionLayer(
308
+ (conv): Conv2d(1, 128, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
309
+ (norm): LayerNorm((128,), eps=1e-06, elementwise_affine=True)
310
+ (act): ReLU()
311
+ )
312
+ (layer1): Gemma4AudioSubSampleConvProjectionLayer(
313
+ (conv): Conv2d(128, 32, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
314
+ (norm): LayerNorm((32,), eps=1e-06, elementwise_affine=True)
315
+ (act): ReLU()
316
+ )
317
+ (input_proj_linear): Linear(in_features=1024, out_features=64, bias=False)
318
+ )
319
+ (rel_pos_enc): Gemma4AudioRelPositionalEncoding()
320
+ (layers): ModuleList(
321
+ (0-1): 2 x Gemma4AudioLayer(
322
+ (feed_forward1): Gemma4AudioFeedForward(
323
+ (ffw_layer_1): Gemma4ClippableLinear(
324
+ (linear): Linear(in_features=64, out_features=256, bias=False)
325
+ )
326
+ (ffw_layer_2): Gemma4ClippableLinear(
327
+ (linear): Linear(in_features=256, out_features=64, bias=False)
328
+ )
329
+ (pre_layer_norm): Gemma4RMSNorm()
330
+ (post_layer_norm): Gemma4RMSNorm()
331
+ (act_fn): SiLUActivation()
332
+ )
333
+ (feed_forward2): Gemma4AudioFeedForward(
334
+ (ffw_layer_1): Gemma4ClippableLinear(
335
+ (linear): Linear(in_features=64, out_features=256, bias=False)
336
+ )
337
+ (ffw_layer_2): Gemma4ClippableLinear(
338
+ (linear): Linear(in_features=256, out_features=64, bias=False)
339
+ )
340
+ (pre_layer_norm): Gemma4RMSNorm()
341
+ (post_layer_norm): Gemma4RMSNorm()
342
+ (act_fn): SiLUActivation()
343
+ )
344
+ (self_attn): Gemma4AudioAttention(
345
+ (q_proj): Gemma4ClippableLinear(
346
+ (linear): Linear(in_features=64, out_features=64, bias=False)
347
+ )
348
+ (k_proj): Gemma4ClippableLinear(
349
+ (linear): Linear(in_features=64, out_features=64, bias=False)
350
+ )
351
+ (v_proj): Gemma4ClippableLinear(
352
+ (linear): Linear(in_features=64, out_features=64, bias=False)
353
+ )
354
+ (post): Gemma4ClippableLinear(
355
+ (linear): Linear(in_features=64, out_features=64, bias=False)
356
+ )
357
+ (relative_k_proj): Linear(in_features=64, out_features=64, bias=False)
358
+ )
359
+ (lconv1d): Gemma4AudioLightConv1d(
360
+ (linear_start): Gemma4ClippableLinear(
361
+ (linear): Linear(in_features=64, out_features=128, bias=False)
362
+ )
363
+ (linear_end): Gemma4ClippableLinear(
364
+ (linear): Linear(in_features=64, out_features=64, bias=False)
365
+ )
366
+ (depthwise_conv1d): Gemma4AudioCausalConv1d(64, 64, kernel_size=(5,), stride=(1,), groups=64, bias=False)
367
+ (pre_layer_norm): Gemma4RMSNorm()
368
+ (conv_norm): Gemma4RMSNorm()
369
+ (act_fn): SiLUActivation()
370
+ )
371
+ (norm_pre_attn): Gemma4RMSNorm()
372
+ (norm_post_attn): Gemma4RMSNorm()
373
+ (norm_out): Gemma4RMSNorm()
374
+ )
375
+ )
376
+ (output_proj): Linear(in_features=64, out_features=32, bias=True)
377
+ )
378
+ (embed_audio): Gemma4MultimodalEmbedder(
379
+ (embedding_projection): Linear(in_features=32, out_features=8, bias=False)
380
+ (embedding_pre_projection_norm): Gemma4RMSNorm()
381
+ )
382
+ )
383
+ (lm_head): Linear(in_features=8, out_features=262144, bias=False)
384
+ )
385
+ ```
386
+
387
+ </details>
chat_template.jinja ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- macro format_parameters(properties, required) -%}
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 }}:{
10
+ {%- if value['description'] -%}
11
+ description:<|"|>{{ value['description'] }}<|"|>
12
+ {%- set add_comma = true -%}
13
+ {%- endif -%}
14
+ {%- if value['nullable'] %}
15
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
16
+ nullable:true
17
+ {%- endif -%}
18
+ {%- if value['type'] | upper == 'STRING' -%}
19
+ {%- if value['enum'] -%}
20
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
21
+ enum:{{ format_argument(value['enum']) }}
22
+ {%- endif -%}
23
+ {%- elif value['type'] | upper == 'OBJECT' -%}
24
+ ,properties:{
25
+ {%- if value['properties'] is defined and value['properties'] is mapping -%}
26
+ {{- format_parameters(value['properties'], value['required'] | default([])) -}}
27
+ {%- elif value is mapping -%}
28
+ {{- format_parameters(value, value['required'] | default([])) -}}
29
+ {%- endif -%}
30
+ }
31
+ {%- if value['required'] -%}
32
+ ,required:[
33
+ {%- for item in value['required'] | default([]) -%}
34
+ <|"|>{{- item -}}<|"|>
35
+ {%- if not loop.last %},{% endif -%}
36
+ {%- endfor -%}
37
+ ]
38
+ {%- endif -%}
39
+ {%- elif value['type'] | upper == 'ARRAY' -%}
40
+ {%- if value['items'] is mapping and value['items'] -%}
41
+ ,items:{
42
+ {%- set ns_items = namespace(found_first=false) -%}
43
+ {%- for item_key, item_value in value['items'] | dictsort -%}
44
+ {%- if item_value is not none -%}
45
+ {%- if ns_items.found_first %},{% endif -%}
46
+ {%- set ns_items.found_first = true -%}
47
+ {%- if item_key == 'properties' -%}
48
+ properties:{
49
+ {%- if item_value is mapping -%}
50
+ {{- format_parameters(item_value, value['items']['required'] | default([])) -}}
51
+ {%- endif -%}
52
+ }
53
+ {%- elif item_key == 'required' -%}
54
+ required:[
55
+ {%- for req_item in item_value -%}
56
+ <|"|>{{- req_item -}}<|"|>
57
+ {%- if not loop.last %},{% endif -%}
58
+ {%- endfor -%}
59
+ ]
60
+ {%- elif item_key == 'type' -%}
61
+ {%- if item_value is string -%}
62
+ type:{{ format_argument(item_value | upper) }}
63
+ {%- else -%}
64
+ type:{{ format_argument(item_value | map('upper') | list) }}
65
+ {%- endif -%}
66
+ {%- else -%}
67
+ {{ item_key }}:{{ format_argument(item_value) }}
68
+ {%- endif -%}
69
+ {%- endif -%}
70
+ {%- endfor -%}
71
+ }
72
+ {%- endif -%}
73
+ {%- endif -%}
74
+ {%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
75
+ type:<|"|>{{ value['type'] | upper }}<|"|>}
76
+ {%- endif -%}
77
+ {%- endfor -%}
78
+ {%- endmacro -%}
79
+ {%- macro format_function_declaration(tool_data) -%}
80
+ declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|>
81
+ {%- set params = tool_data['function']['parameters'] -%}
82
+ {%- if params -%}
83
+ ,parameters:{
84
+ {%- if params['properties'] -%}
85
+ properties:{ {{- format_parameters(params['properties'], params['required']) -}} },
86
+ {%- endif -%}
87
+ {%- if params['required'] -%}
88
+ required:[
89
+ {%- for item in params['required'] -%}
90
+ <|"|>{{- item -}}<|"|>
91
+ {{- ',' if not loop.last -}}
92
+ {%- endfor -%}
93
+ ],
94
+ {%- endif -%}
95
+ {%- if params['type'] -%}
96
+ type:<|"|>{{- params['type'] | upper -}}<|"|>}
97
+ {%- endif -%}
98
+ {%- endif -%}
99
+ {%- if 'response' in tool_data['function'] -%}
100
+ {%- set response_declaration = tool_data['function']['response'] -%}
101
+ ,response:{
102
+ {%- if response_declaration['description'] -%}
103
+ description:<|"|>{{- response_declaration['description'] -}}<|"|>,
104
+ {%- endif -%}
105
+ {%- if response_declaration['type'] | upper == 'OBJECT' -%}
106
+ type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>}
107
+ {%- endif -%}
108
+ {%- endif -%}
109
+ }
110
+ {%- endmacro -%}
111
+ {%- macro format_argument(argument, escape_keys=True) -%}
112
+ {%- if argument is string -%}
113
+ {{- '<|"|>' + argument + '<|"|>' -}}
114
+ {%- elif argument is boolean -%}
115
+ {{- 'true' if argument else 'false' -}}
116
+ {%- elif argument is mapping -%}
117
+ {{- '{' -}}
118
+ {%- set ns = namespace(found_first=false) -%}
119
+ {%- for key, value in argument | dictsort -%}
120
+ {%- if ns.found_first %},{% endif -%}
121
+ {%- set ns.found_first = true -%}
122
+ {%- if escape_keys -%}
123
+ {{- '<|"|>' + key + '<|"|>' -}}
124
+ {%- else -%}
125
+ {{- key -}}
126
+ {%- endif -%}
127
+ :{{- format_argument(value, escape_keys=escape_keys) -}}
128
+ {%- endfor -%}
129
+ {{- '}' -}}
130
+ {%- elif argument is sequence -%}
131
+ {{- '[' -}}
132
+ {%- for item in argument -%}
133
+ {{- format_argument(item, escape_keys=escape_keys) -}}
134
+ {%- if not loop.last %},{% endif -%}
135
+ {%- endfor -%}
136
+ {{- ']' -}}
137
+ {%- else -%}
138
+ {{- argument -}}
139
+ {%- endif -%}
140
+ {%- endmacro -%}
141
+ {%- macro strip_thinking(text) -%}
142
+ {%- set ns = namespace(result='') -%}
143
+ {%- for part in text.split('<channel|>') -%}
144
+ {%- if '<|channel>' in part -%}
145
+ {%- set ns.result = ns.result + part.split('<|channel>')[0] -%}
146
+ {%- else -%}
147
+ {%- set ns.result = ns.result + part -%}
148
+ {%- endif -%}
149
+ {%- endfor -%}
150
+ {{- ns.result | trim -}}
151
+ {%- endmacro -%}
152
+
153
+ {%- set ns = namespace(prev_message_type=None) -%}
154
+ {%- set loop_messages = messages -%}
155
+ {{ bos_token }}
156
+ {#- Handle System/Tool Definitions Block -#}
157
+ {%- if (enable_thinking is defined and enable_thinking) or tools or messages[0]['role'] in ['system', 'developer'] -%}
158
+ {{- '<|turn>system\n' -}}
159
+
160
+ {#- Inject Thinking token at the very top of the FIRST system turn -#}
161
+ {%- if enable_thinking is defined and enable_thinking -%}
162
+ {{- '<|think|>' -}}
163
+ {%- set ns.prev_message_type = 'think' -%}
164
+ {%- endif -%}
165
+
166
+ {%- if messages[0]['role'] in ['system', 'developer'] -%}
167
+ {{- messages[0]['content'] | trim -}}
168
+ {%- set loop_messages = messages[1:] -%}
169
+ {%- endif -%}
170
+
171
+ {%- if tools -%}
172
+ {%- for tool in tools %}
173
+ {{- '<|tool>' -}}
174
+ {{- format_function_declaration(tool) | trim -}}
175
+ {{- '<tool|>' -}}
176
+ {%- endfor %}
177
+ {%- set ns.prev_message_type = 'tool' -%}
178
+ {%- endif -%}
179
+
180
+ {{- '<turn|>\n' -}}
181
+ {%- endif %}
182
+
183
+ {#- Loop through messages -#}
184
+ {%- for message in loop_messages -%}
185
+ {%- set ns.prev_message_type = None -%}
186
+ {%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%}
187
+ {{- '<|turn>' + role + '\n' }}
188
+
189
+ {%- if message['tool_calls'] -%}
190
+ {%- for tool_call in message['tool_calls'] -%}
191
+ {%- set function = tool_call['function'] -%}
192
+ {{- '<|tool_call>call:' + function['name'] + '{' -}}
193
+ {%- if function['arguments'] is mapping -%}
194
+ {%- set ns_args = namespace(found_first=false) -%}
195
+ {%- for key, value in function['arguments'] | dictsort -%}
196
+ {%- if ns_args.found_first %},{% endif -%}
197
+ {%- set ns_args.found_first = true -%}
198
+ {{- key -}}:{{- format_argument(value, escape_keys=False) -}}
199
+ {%- endfor -%}
200
+ {%- elif function['arguments'] is string -%}
201
+ {{- function['arguments'] -}}
202
+ {%- endif -%}
203
+ {{- '}<tool_call|>' -}}
204
+ {%- endfor -%}
205
+ {%- set ns.prev_message_type = 'tool_call' -%}
206
+ {%- endif -%}
207
+
208
+ {%- if message['tool_responses'] -%}
209
+ {#- Tool Response handling -#}
210
+ {%- for tool_response in message['tool_responses'] -%}
211
+ {{- '<|tool_response>' -}}
212
+ {%- if tool_response['response'] is mapping -%}
213
+ {{- 'response:' + tool_response['name'] | default('unknown') + '{' -}}
214
+ {%- for key, value in tool_response['response'] | dictsort -%}
215
+ {{- key -}}:{{- format_argument(value, escape_keys=False) -}}
216
+ {%- if not loop.last %},{% endif -%}
217
+ {%- endfor -%}
218
+ {{- '}' -}}
219
+ {%- else -%}
220
+ {{- 'response:' + tool_response['name'] | default('unknown') + '{value:' + format_argument(tool_response['response'], escape_keys=False) + '}' -}}
221
+ {%- endif -%}
222
+ {{- '<tool_response|>' -}}
223
+ {%- endfor -%}
224
+ {%- set ns.prev_message_type = 'tool_response' -%}
225
+ {%- endif -%}
226
+
227
+ {%- if message['content'] is string -%}
228
+ {%- if role == 'model' -%}
229
+ {{- strip_thinking(message['content']) -}}
230
+ {%- else -%}
231
+ {{- message['content'] | trim -}}
232
+ {%- endif -%}
233
+ {%- elif message['content'] is sequence -%}
234
+ {%- for item in message['content'] -%}
235
+ {%- if item['type'] == 'text' -%}
236
+ {%- if role == 'model' -%}
237
+ {{- strip_thinking(item['text']) -}}
238
+ {%- else -%}
239
+ {{- item['text'] | trim -}}
240
+ {%- endif -%}
241
+ {%- elif item['type'] == 'image' -%}
242
+ {{- '\n\n<|image|>\n\n' -}}
243
+ {%- set ns.prev_message_type = 'image' -%}
244
+ {%- elif item['type'] == 'audio' -%}
245
+ {{- '<|audio|>' -}}
246
+ {%- set ns.prev_message_type = 'audio' -%}
247
+ {%- elif item['type'] == 'video' -%}
248
+ {{- '\n\n<|video|>\n\n' -}}
249
+ {%- set ns.prev_message_type = 'video' -%}
250
+ {%- endif -%}
251
+ {%- endfor -%}
252
+ {%- endif -%}
253
+
254
+ {%- if not (message['tool_responses'] and not message['content']) -%}
255
+ {{- '<turn|>\n' -}}
256
+ {%- endif -%}
257
+ {%- endfor -%}
258
+
259
+ {%- if add_generation_prompt -%}
260
+ {%- if ns.prev_message_type != 'tool_response' -%}
261
+ {{- '<|turn>model\n' -}}
262
+ {%- endif -%}
263
+ {%- endif -%}
config.json ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Gemma4ForConditionalGeneration"
4
+ ],
5
+ "audio_config": {
6
+ "_name_or_path": "",
7
+ "architectures": null,
8
+ "attention_chunk_size": 12,
9
+ "attention_context_left": 13,
10
+ "attention_context_right": 0,
11
+ "attention_invalid_logits_value": -1000000000.0,
12
+ "attention_logit_cap": 50.0,
13
+ "chunk_size_feed_forward": 0,
14
+ "conv_kernel_size": 5,
15
+ "dtype": "bfloat16",
16
+ "gradient_clipping": 10000000000.0,
17
+ "hidden_act": "silu",
18
+ "hidden_size": 64,
19
+ "id2label": {
20
+ "0": "LABEL_0",
21
+ "1": "LABEL_1"
22
+ },
23
+ "initializer_range": 0.02,
24
+ "is_encoder_decoder": false,
25
+ "label2id": {
26
+ "LABEL_0": 0,
27
+ "LABEL_1": 1
28
+ },
29
+ "model_type": "gemma4_audio",
30
+ "num_attention_heads": 2,
31
+ "num_hidden_layers": 2,
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,
38
+ "rms_norm_eps": 1e-06,
39
+ "subsampling_conv_channels": [
40
+ 128,
41
+ 32
42
+ ],
43
+ "use_clipped_linears": true
44
+ },
45
+ "audio_token_id": 258881,
46
+ "boa_token_id": 256000,
47
+ "boi_token_id": 255999,
48
+ "dtype": "bfloat16",
49
+ "eoa_token_id": 258883,
50
+ "eoa_token_index": 258883,
51
+ "eoi_token_id": 258882,
52
+ "eos_token_id": [
53
+ 1,
54
+ 106
55
+ ],
56
+ "image_token_id": 258880,
57
+ "initializer_range": 0.02,
58
+ "model_type": "gemma4",
59
+ "text_config": {
60
+ "attention_bias": false,
61
+ "attention_dropout": 0.0,
62
+ "attention_k_eq_v": false,
63
+ "bos_token_id": 2,
64
+ "dtype": "bfloat16",
65
+ "enable_moe_block": false,
66
+ "eos_token_id": 1,
67
+ "expert_intermediate_size": null,
68
+ "final_logit_softcapping": 30.0,
69
+ "global_head_dim": 64,
70
+ "head_dim": 32,
71
+ "hidden_activation": "gelu_pytorch_tanh",
72
+ "hidden_size": 8,
73
+ "hidden_size_per_layer_input": 2,
74
+ "initializer_range": 0.02,
75
+ "intermediate_size": 64,
76
+ "layer_types": [
77
+ "sliding_attention",
78
+ "full_attention",
79
+ "sliding_attention",
80
+ "full_attention"
81
+ ],
82
+ "max_position_embeddings": 131072,
83
+ "model_type": "gemma4_text",
84
+ "moe_intermediate_size": null,
85
+ "num_attention_heads": 8,
86
+ "num_experts": null,
87
+ "num_global_key_value_heads": null,
88
+ "num_hidden_layers": 4,
89
+ "num_key_value_heads": 4,
90
+ "num_kv_shared_layers": 2,
91
+ "pad_token_id": 0,
92
+ "rms_norm_eps": 1e-06,
93
+ "rope_parameters": {
94
+ "full_attention": {
95
+ "partial_rotary_factor": 0.25,
96
+ "rope_theta": 1000000.0,
97
+ "rope_type": "proportional"
98
+ },
99
+ "sliding_attention": {
100
+ "rope_theta": 10000.0,
101
+ "rope_type": "default"
102
+ }
103
+ },
104
+ "sliding_window": 512,
105
+ "tie_word_embeddings": true,
106
+ "top_k_experts": null,
107
+ "use_bidirectional_attention": null,
108
+ "use_cache": true,
109
+ "use_double_wide_mlp": false,
110
+ "vocab_size": 262144,
111
+ "vocab_size_per_layer_input": 262144
112
+ },
113
+ "tie_word_embeddings": true,
114
+ "transformers_version": "5.5.0",
115
+ "video_token_id": 258884,
116
+ "vision_config": {
117
+ "_name_or_path": "",
118
+ "architectures": null,
119
+ "attention_bias": false,
120
+ "attention_dropout": 0.0,
121
+ "chunk_size_feed_forward": 0,
122
+ "default_output_length": 280,
123
+ "dtype": "bfloat16",
124
+ "global_head_dim": 32,
125
+ "head_dim": 32,
126
+ "hidden_activation": "gelu_pytorch_tanh",
127
+ "hidden_size": 8,
128
+ "id2label": {
129
+ "0": "LABEL_0",
130
+ "1": "LABEL_1"
131
+ },
132
+ "initializer_range": 0.02,
133
+ "intermediate_size": 64,
134
+ "is_encoder_decoder": false,
135
+ "label2id": {
136
+ "LABEL_0": 0,
137
+ "LABEL_1": 1
138
+ },
139
+ "max_position_embeddings": 131072,
140
+ "model_type": "gemma4_vision",
141
+ "num_attention_heads": 4,
142
+ "num_hidden_layers": 2,
143
+ "num_key_value_heads": 4,
144
+ "output_attentions": false,
145
+ "output_hidden_states": false,
146
+ "patch_size": 16,
147
+ "pooling_kernel_size": 3,
148
+ "position_embedding_size": 10240,
149
+ "problem_type": null,
150
+ "return_dict": true,
151
+ "rms_norm_eps": 1e-06,
152
+ "rope_parameters": {
153
+ "rope_theta": 100.0,
154
+ "rope_type": "default"
155
+ },
156
+ "standardize": false,
157
+ "use_clipped_linears": true
158
+ },
159
+ "vision_soft_tokens_per_image": 280
160
+ }
generation_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 2,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 1,
6
+ 106,
7
+ 50
8
+ ],
9
+ "pad_token_id": 0,
10
+ "temperature": 1.0,
11
+ "top_k": 64,
12
+ "top_p": 0.95,
13
+ "transformers_version": "5.5.0",
14
+ "trust_remote_code": true
15
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c2045c91d5ee53e379d6f3c4947b914c36ab4308f708e25858c2eb5bd694bc3
3
+ size 9483948
processor_config.json ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "audio_ms_per_token": 40,
3
+ "audio_seq_length": 750,
4
+ "feature_extractor": {
5
+ "dither": 0.0,
6
+ "feature_extractor_type": "Gemma4AudioFeatureExtractor",
7
+ "feature_size": 128,
8
+ "fft_length": 512,
9
+ "fft_overdrive": false,
10
+ "frame_length": 320,
11
+ "hop_length": 160,
12
+ "input_scale_factor": 1.0,
13
+ "max_frequency": 8000.0,
14
+ "mel_floor": 0.001,
15
+ "min_frequency": 0.0,
16
+ "padding_side": "right",
17
+ "padding_value": 0.0,
18
+ "per_bin_mean": null,
19
+ "per_bin_stddev": null,
20
+ "preemphasis": 0.0,
21
+ "preemphasis_htk_flavor": true,
22
+ "return_attention_mask": true,
23
+ "sampling_rate": 16000
24
+ },
25
+ "image_processor": {
26
+ "do_convert_rgb": true,
27
+ "do_normalize": false,
28
+ "do_rescale": true,
29
+ "do_resize": true,
30
+ "image_mean": [
31
+ 0.0,
32
+ 0.0,
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,
52
+ "do_normalize": true,
53
+ "do_rescale": true,
54
+ "do_resize": true,
55
+ "do_sample_frames": true,
56
+ "image_mean": [
57
+ 0.0,
58
+ 0.0,
59
+ 0.0
60
+ ],
61
+ "image_std": [
62
+ 1.0,
63
+ 1.0,
64
+ 1.0
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,
72
+ "return_metadata": false,
73
+ "video_processor_type": "Gemma4VideoProcessor"
74
+ }
75
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0f
3
+ size 32169626
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
+ }