armand0e commited on
Commit
3293bb8
·
verified ·
1 Parent(s): c8e08a2

(Trained with Unsloth)

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
chat_template.jinja ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{ bos_token }}{%- if messages[0]['role'] == 'system' -%}
2
+ {%- set first_user_prefix = messages[0]['content'] + '
3
+
4
+ ' -%}
5
+ {%- set loop_messages = messages[1:] -%}
6
+ {%- else -%}
7
+ {%- set first_user_prefix = "" -%}
8
+ {%- set loop_messages = messages -%}
9
+ {%- endif -%}
10
+ {%- for message in loop_messages -%}
11
+ {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}
12
+ {{ raise_exception("Conversation roles must alternate user/assistant/user/assistant/...") }}
13
+ {%- endif -%}
14
+ {%- if (message['role'] == 'assistant') -%}
15
+ {%- set role = "model" -%}
16
+ {%- else -%}
17
+ {%- set role = message['role'] -%}
18
+ {%- endif -%}
19
+ {%- if message['content'] is string -%}
20
+ {%- set content = message['content'] | trim -%}
21
+ {%- else -%}
22
+ {%- set content = '' -%}
23
+ {%- endif -%}
24
+ {%- if role == "model" -%}
25
+ {%- set reasoning_content = '' -%}
26
+ {%- if message['reasoning_content'] is defined and message['reasoning_content'] is string -%}
27
+ {%- set reasoning_content = message['reasoning_content'] | trim -%}
28
+ {%- elif message['thinking'] is defined and message['thinking'] is string -%}
29
+ {%- set reasoning_content = message['thinking'] | trim -%}
30
+ {%- elif message['reasoning'] is defined and message['reasoning'] is string -%}
31
+ {%- set reasoning_content = message['reasoning'] | trim -%}
32
+ {%- endif -%}
33
+ {%- if reasoning_content == '' and message['content'] is string and '<|channel>thought' in content and '<channel|>' in content -%}
34
+ {%- set reasoning_content = content.split('<|channel>thought', 1)[1].split('<channel|>', 1)[0].strip('
35
+ ') -%}
36
+ {%- set content = content.split('<channel|>', 1)[1].lstrip('
37
+ ') -%}
38
+ {%- endif -%}
39
+ {%- if reasoning_content == '' and message['content'] is string and '<think>' in content and '</think>' in content -%}
40
+ {%- set reasoning_content = content.split('</think>', 1)[0].rstrip('
41
+ ').split('<think>', 1)[-1].lstrip('
42
+ ') -%}
43
+ {%- set content = content.split('</think>', 1)[1].lstrip('
44
+ ') -%}
45
+ {%- endif -%}
46
+ {%- endif -%}
47
+ {{ '<|turn>' + role + '
48
+ ' + (first_user_prefix if loop.first else "") }}
49
+ {%- if role == "model" -%}
50
+ {%- if reasoning_content -%}
51
+ {{ '<|channel>thought
52
+ ' + reasoning_content + '<channel|>' }}
53
+ {%- else -%}
54
+ {{ '<|channel>thought
55
+ <channel|>' }}
56
+ {%- endif -%}
57
+ {%- endif -%}
58
+ {%- if message['content'] is string -%}
59
+ {{ content }}
60
+ {%- elif message['content'] is iterable -%}
61
+ {%- for item in message['content'] -%}
62
+ {%- if item['type'] == 'audio' -%}
63
+ {{ '<|audio|>' }}
64
+ {%- elif item['type'] == 'image' -%}
65
+ {{ '<|image|>' }}
66
+ {%- elif item['type'] == 'video' -%}
67
+ {{ '<|video|>' }}
68
+ {%- elif item['type'] == 'text' -%}
69
+ {{ item['text'] | trim }}
70
+ {%- endif -%}
71
+ {%- endfor -%}
72
+ {%- else -%}
73
+ {{ raise_exception("Invalid content type") }}
74
+ {%- endif -%}
75
+ {{ '<turn|>
76
+ ' }}
77
+ {%- endfor -%}
78
+ {%- if add_generation_prompt -%}
79
+ {{ '<|turn>model
80
+ ' }}
81
+ {%- if enable_thinking | default(true) -%}
82
+ {{ '<|channel>thought
83
+ ' }}
84
+ {%- else -%}
85
+ {{ '<|channel>thought
86
+ <channel|>' }}
87
+ {%- endif -%}
88
+ {%- endif -%}
config.json ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "torch_dtype": "bfloat16",
16
+ "gradient_clipping": 10000000000.0,
17
+ "hidden_act": "silu",
18
+ "hidden_size": 1024,
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": 8,
31
+ "num_hidden_layers": 12,
32
+ "output_attentions": false,
33
+ "output_hidden_states": false,
34
+ "output_proj_dims": 1536,
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
+ "bos_token_id": 2,
49
+ "torch_dtype": "bfloat16",
50
+ "eoa_token_id": 258883,
51
+ "eoa_token_index": 258883,
52
+ "eoi_token_id": 258882,
53
+ "eos_token_id": 106,
54
+ "image_token_id": 258880,
55
+ "initializer_range": 0.02,
56
+ "model_name": "unsloth/gemma-4-E2B-it",
57
+ "model_type": "gemma4",
58
+ "pad_token_id": 0,
59
+ "text_config": {
60
+ "attention_bias": false,
61
+ "attention_dropout": 0.0,
62
+ "attention_k_eq_v": false,
63
+ "bos_token_id": 2,
64
+ "torch_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": 512,
70
+ "head_dim": 256,
71
+ "hidden_activation": "gelu_pytorch_tanh",
72
+ "hidden_size": 1536,
73
+ "hidden_size_per_layer_input": 256,
74
+ "initializer_range": 0.02,
75
+ "intermediate_size": 6144,
76
+ "layer_types": [
77
+ "sliding_attention",
78
+ "sliding_attention",
79
+ "sliding_attention",
80
+ "sliding_attention",
81
+ "full_attention",
82
+ "sliding_attention",
83
+ "sliding_attention",
84
+ "sliding_attention",
85
+ "sliding_attention",
86
+ "full_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
+ "full_attention",
97
+ "sliding_attention",
98
+ "sliding_attention",
99
+ "sliding_attention",
100
+ "sliding_attention",
101
+ "full_attention",
102
+ "sliding_attention",
103
+ "sliding_attention",
104
+ "sliding_attention",
105
+ "sliding_attention",
106
+ "full_attention",
107
+ "sliding_attention",
108
+ "sliding_attention",
109
+ "sliding_attention",
110
+ "sliding_attention",
111
+ "full_attention"
112
+ ],
113
+ "max_position_embeddings": 131072,
114
+ "model_type": "gemma4_text",
115
+ "moe_intermediate_size": null,
116
+ "num_attention_heads": 8,
117
+ "num_experts": null,
118
+ "num_global_key_value_heads": null,
119
+ "num_hidden_layers": 35,
120
+ "num_key_value_heads": 1,
121
+ "num_kv_shared_layers": 20,
122
+ "pad_token_id": 0,
123
+ "rms_norm_eps": 1e-06,
124
+ "rope_parameters": {
125
+ "full_attention": {
126
+ "partial_rotary_factor": 0.25,
127
+ "rope_theta": 1000000.0,
128
+ "rope_type": "proportional"
129
+ },
130
+ "sliding_attention": {
131
+ "rope_theta": 10000.0,
132
+ "rope_type": "default"
133
+ }
134
+ },
135
+ "sliding_window": 512,
136
+ "tie_word_embeddings": true,
137
+ "top_k_experts": null,
138
+ "use_bidirectional_attention": null,
139
+ "use_cache": true,
140
+ "use_double_wide_mlp": true,
141
+ "vocab_size": 262144,
142
+ "vocab_size_per_layer_input": 262144
143
+ },
144
+ "tie_word_embeddings": true,
145
+ "unsloth_fixed": true,
146
+ "unsloth_version": "2026.4.2",
147
+ "use_cache": false,
148
+ "video_token_id": 258884,
149
+ "vision_config": {
150
+ "_name_or_path": "",
151
+ "architectures": null,
152
+ "attention_bias": false,
153
+ "attention_dropout": 0.0,
154
+ "chunk_size_feed_forward": 0,
155
+ "default_output_length": 280,
156
+ "torch_dtype": "bfloat16",
157
+ "global_head_dim": 64,
158
+ "head_dim": 64,
159
+ "hidden_activation": "gelu_pytorch_tanh",
160
+ "hidden_size": 768,
161
+ "id2label": {
162
+ "0": "LABEL_0",
163
+ "1": "LABEL_1"
164
+ },
165
+ "initializer_range": 0.02,
166
+ "intermediate_size": 3072,
167
+ "is_encoder_decoder": false,
168
+ "label2id": {
169
+ "LABEL_0": 0,
170
+ "LABEL_1": 1
171
+ },
172
+ "max_position_embeddings": 131072,
173
+ "model_type": "gemma4_vision",
174
+ "num_attention_heads": 12,
175
+ "num_hidden_layers": 16,
176
+ "num_key_value_heads": 12,
177
+ "output_attentions": false,
178
+ "output_hidden_states": false,
179
+ "patch_size": 16,
180
+ "pooling_kernel_size": 3,
181
+ "position_embedding_size": 10240,
182
+ "problem_type": null,
183
+ "return_dict": true,
184
+ "rms_norm_eps": 1e-06,
185
+ "rope_parameters": {
186
+ "rope_theta": 100.0,
187
+ "rope_type": "default"
188
+ },
189
+ "standardize": false,
190
+ "use_clipped_linears": true
191
+ },
192
+ "vision_soft_tokens_per_image": 280
193
+ }
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": "left",
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,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": "<turn|>",
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": 131072,
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": "right",
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
+ "chat_template": "{{ bos_token }}{%- if messages[0]['role'] == 'system' -%}\n {%- set first_user_prefix = messages[0]['content'] + '\n\n' -%}\n {%- set loop_messages = messages[1:] -%}\n{%- else -%}\n {%- set first_user_prefix = \"\" -%}\n {%- set loop_messages = messages -%}\n{%- endif -%}\n{%- for message in loop_messages -%}\n {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}\n {{ raise_exception(\"Conversation roles must alternate user/assistant/user/assistant/...\") }}\n {%- endif -%}\n {%- if (message['role'] == 'assistant') -%}\n {%- set role = \"model\" -%}\n {%- else -%}\n {%- set role = message['role'] -%}\n {%- endif -%}\n {%- if message['content'] is string -%}\n {%- set content = message['content'] | trim -%}\n {%- else -%}\n {%- set content = '' -%}\n {%- endif -%}\n {%- if role == \"model\" -%}\n {%- set reasoning_content = '' -%}\n {%- if message['reasoning_content'] is defined and message['reasoning_content'] is string -%}\n {%- set reasoning_content = message['reasoning_content'] | trim -%}\n {%- elif message['thinking'] is defined and message['thinking'] is string -%}\n {%- set reasoning_content = message['thinking'] | trim -%}\n {%- elif message['reasoning'] is defined and message['reasoning'] is string -%}\n {%- set reasoning_content = message['reasoning'] | trim -%}\n {%- endif -%}\n {%- if reasoning_content == '' and message['content'] is string and '<|channel>thought' in content and '<channel|>' in content -%}\n {%- set reasoning_content = content.split('<|channel>thought', 1)[1].split('<channel|>', 1)[0].strip('\n') -%}\n {%- set content = content.split('<channel|>', 1)[1].lstrip('\n') -%}\n {%- endif -%}\n {%- if reasoning_content == '' and message['content'] is string and '<think>' in content and '</think>' in content -%}\n {%- set reasoning_content = content.split('</think>', 1)[0].rstrip('\n').split('<think>', 1)[-1].lstrip('\n') -%}\n {%- set content = content.split('</think>', 1)[1].lstrip('\n') -%}\n {%- endif -%}\n {%- endif -%}\n {{ '<|turn>' + role + '\n' + (first_user_prefix if loop.first else \"\") }}\n {%- if role == \"model\" -%}\n {%- if reasoning_content -%}\n {{ '<|channel>thought\n' + reasoning_content + '<channel|>' }}\n {%- else -%}\n {{ '<|channel>thought\n<channel|>' }}\n {%- endif -%}\n {%- endif -%}\n {%- if message['content'] is string -%}\n {{ content }}\n {%- elif message['content'] is iterable -%}\n {%- for item in message['content'] -%}\n {%- if item['type'] == 'audio' -%}\n {{ '<|audio|>' }}\n {%- elif item['type'] == 'image' -%}\n {{ '<|image|>' }}\n {%- elif item['type'] == 'video' -%}\n {{ '<|video|>' }}\n {%- elif item['type'] == 'text' -%}\n {{ item['text'] | trim }}\n {%- endif -%}\n {%- endfor -%}\n {%- else -%}\n {{ raise_exception(\"Invalid content type\") }}\n {%- endif -%}\n {{ '<turn|>\n' }}\n{%- endfor -%}\n{%- if add_generation_prompt -%}\n {{ '<|turn>model\n' }}\n {%- if enable_thinking | default(true) -%}\n {{ '<|channel>thought\n' }}\n {%- else -%}\n {{ '<|channel>thought\n<channel|>' }}\n {%- endif -%}\n{%- endif -%}\n"
96
+ }