majentik commited on
Commit
ad64132
·
verified ·
1 Parent(s): 922b334

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,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: google/gemma-4-12B
3
+ license: gemma
4
+ library_name: mlx
5
+ pipeline_tag: image-text-to-text
6
+ tags:
7
+ - mlx
8
+ - quantized
9
+ - gemma
10
+ - gemma4
11
+ - image-text-to-text
12
+ - apple-silicon
13
+ - turboquant
14
+ ---
15
+
16
+ # gemma-4-12B — TurboQuant MLX MXFP4
17
+
18
+ [`google/gemma-4-12B`](https://huggingface.co/google/gemma-4-12B) @ `023679ed352de9bb66cc873c9009ce3482585c08` quantized pack, published as `majentik/gemma-4-12B-TurboQuant-MLX-MXFP4`.
19
+
20
+ ## Method
21
+
22
+ MLX quantization via mlx-vlm 0.6.3 (MXFP4, group_size 32); vision + audio towers retained in BF16 (not quantized).
23
+
24
+ ## Release line
25
+
26
+ Released under the **TurboQuant** line. RotorQuant and TurboQuant are this project's release labels for this pack, not distinct quantization algorithms — both brand repos for a given tier carry byte-identical weights, produced once and published under two names. No brand-specific speedup is claimed or measured for either label.
27
+
28
+ ## Modality
29
+
30
+ This pack is `image-text-to-text` capable: the vision and audio towers ship in BF16 alongside the quantized text tower, so image (and audio) inputs are supported end to end via `mlx-vlm`.
31
+
32
+ **Base-model note:** this is the raw completion model (not instruction-tuned). It is not instruction-aligned for multimodal Q&A — expect free-form continuation behavior rather than chat-style image description, even though the vision/audio towers are present.
33
+
34
+ **mlx-vlm suppress-tokens note:** the base model's `generation_config.json` carries `suppress_tokens` for six multimodal placeholder token ids so that `transformers` generation is clean. `mlx-vlm` does not honor `suppress_tokens` automatically, so text-only generation with `mlx-vlm` can leak placeholder tokens (observed as a degenerate `A<image|>A<image|>...` loop in smoke testing) unless you suppress them yourself:
35
+
36
+ ```python
37
+ from mlx_vlm import load, generate
38
+
39
+ model, processor = load("majentik/gemma-4-12B-TurboQuant-MLX-MXFP4")
40
+ suppress = {255999: -1e9, 256000: -1e9, 258880: -1e9, 258881: -1e9, 258882: -1e9, 258883: -1e9}
41
+ output = generate(
42
+ model, processor, prompt,
43
+ max_tokens=256,
44
+ logit_bias=suppress,
45
+ )
46
+ ```
47
+
48
+ ## License
49
+
50
+ Governed by the [Gemma Terms of Use](https://ai.google.dev/gemma/terms). See the upstream repo for the full license text.
51
+
config.json ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Gemma4UnifiedForConditionalGeneration"
4
+ ],
5
+ "audio_config": {
6
+ "_name_or_path": "",
7
+ "architectures": null,
8
+ "audio_embed_dim": 640,
9
+ "audio_samples_per_token": 640,
10
+ "chunk_size_feed_forward": 0,
11
+ "dtype": null,
12
+ "hidden_size": 640,
13
+ "id2label": {
14
+ "0": "LABEL_0",
15
+ "1": "LABEL_1"
16
+ },
17
+ "initializer_range": 0.02,
18
+ "is_encoder_decoder": false,
19
+ "label2id": {
20
+ "LABEL_0": 0,
21
+ "LABEL_1": 1
22
+ },
23
+ "model_type": "gemma4_unified_audio",
24
+ "output_attentions": false,
25
+ "output_hidden_states": false,
26
+ "output_proj_dims": 640,
27
+ "problem_type": null,
28
+ "return_dict": true,
29
+ "rms_norm_eps": 1e-06
30
+ },
31
+ "audio_token_id": 258881,
32
+ "boa_token_id": 256000,
33
+ "boi_token_id": 255999,
34
+ "do_sample": true,
35
+ "dtype": "bfloat16",
36
+ "eoa_token_index": 258883,
37
+ "eoi_token_id": 258882,
38
+ "eos_token_id": 1,
39
+ "generation_config": {
40
+ "bos_token_id": 2,
41
+ "do_sample": true,
42
+ "eos_token_id": 1,
43
+ "pad_token_id": 0,
44
+ "suppress_tokens": [
45
+ 258883,
46
+ 258882
47
+ ],
48
+ "temperature": 1.0,
49
+ "top_k": 64,
50
+ "top_p": 0.95,
51
+ "transformers_version": "5.10.0.dev0"
52
+ },
53
+ "image_token_id": 258880,
54
+ "initializer_range": 0.02,
55
+ "model_type": "gemma4_unified",
56
+ "quantization": {
57
+ "group_size": 32,
58
+ "bits": 4,
59
+ "mode": "mxfp4"
60
+ },
61
+ "quantization_config": {
62
+ "group_size": 32,
63
+ "bits": 4,
64
+ "mode": "mxfp4"
65
+ },
66
+ "temperature": 1.0,
67
+ "text_config": {
68
+ "attention_bias": false,
69
+ "attention_dropout": 0.0,
70
+ "attention_k_eq_v": true,
71
+ "bos_token_id": 2,
72
+ "enable_moe_block": false,
73
+ "eos_token_id": 1,
74
+ "final_logit_softcapping": 30.0,
75
+ "global_head_dim": 512,
76
+ "head_dim": 256,
77
+ "hidden_activation": "gelu_pytorch_tanh",
78
+ "hidden_size": 3840,
79
+ "hidden_size_per_layer_input": 0,
80
+ "initializer_range": 0.02,
81
+ "intermediate_size": 15360,
82
+ "layer_types": [
83
+ "sliding_attention",
84
+ "sliding_attention",
85
+ "sliding_attention",
86
+ "sliding_attention",
87
+ "sliding_attention",
88
+ "full_attention",
89
+ "sliding_attention",
90
+ "sliding_attention",
91
+ "sliding_attention",
92
+ "sliding_attention",
93
+ "sliding_attention",
94
+ "full_attention",
95
+ "sliding_attention",
96
+ "sliding_attention",
97
+ "sliding_attention",
98
+ "sliding_attention",
99
+ "sliding_attention",
100
+ "full_attention",
101
+ "sliding_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
+ "sliding_attention",
112
+ "full_attention",
113
+ "sliding_attention",
114
+ "sliding_attention",
115
+ "sliding_attention",
116
+ "sliding_attention",
117
+ "sliding_attention",
118
+ "full_attention",
119
+ "sliding_attention",
120
+ "sliding_attention",
121
+ "sliding_attention",
122
+ "sliding_attention",
123
+ "sliding_attention",
124
+ "full_attention",
125
+ "sliding_attention",
126
+ "sliding_attention",
127
+ "sliding_attention",
128
+ "sliding_attention",
129
+ "sliding_attention",
130
+ "full_attention"
131
+ ],
132
+ "max_position_embeddings": 262144,
133
+ "model_type": "gemma4_unified_text",
134
+ "moe_intermediate_size": null,
135
+ "num_attention_heads": 16,
136
+ "num_experts": null,
137
+ "num_global_key_value_heads": 1,
138
+ "num_hidden_layers": 48,
139
+ "num_key_value_heads": 8,
140
+ "num_kv_shared_layers": 0,
141
+ "pad_token_id": 0,
142
+ "rms_norm_eps": 1e-06,
143
+ "rope_parameters": {
144
+ "full_attention": {
145
+ "partial_rotary_factor": 0.25,
146
+ "rope_theta": 1000000.0,
147
+ "rope_type": "proportional"
148
+ },
149
+ "sliding_attention": {
150
+ "rope_theta": 10000.0,
151
+ "rope_type": "default"
152
+ }
153
+ },
154
+ "sliding_window": 1024,
155
+ "tie_word_embeddings": true,
156
+ "top_k_experts": null,
157
+ "use_bidirectional_attention": "vision",
158
+ "use_cache": true,
159
+ "use_double_wide_mlp": false,
160
+ "vocab_size": 262144,
161
+ "vocab_size_per_layer_input": 262144
162
+ },
163
+ "tie_word_embeddings": true,
164
+ "top_k": 64,
165
+ "top_p": 0.95,
166
+ "transformers_version": "5.10.0.dev0",
167
+ "video_token_id": 258884,
168
+ "vision_config": {
169
+ "_name_or_path": "",
170
+ "architectures": null,
171
+ "chunk_size_feed_forward": 0,
172
+ "dtype": null,
173
+ "id2label": {
174
+ "0": "LABEL_0",
175
+ "1": "LABEL_1"
176
+ },
177
+ "initializer_range": 0.02,
178
+ "is_encoder_decoder": false,
179
+ "label2id": {
180
+ "LABEL_0": 0,
181
+ "LABEL_1": 1
182
+ },
183
+ "mm_embed_dim": 3840,
184
+ "mm_posemb_size": 1120,
185
+ "model_patch_size": 48,
186
+ "model_type": "gemma4_unified_vision",
187
+ "num_soft_tokens": 280,
188
+ "output_attentions": false,
189
+ "output_hidden_states": false,
190
+ "output_proj_dims": 3840,
191
+ "patch_size": 16,
192
+ "pooling_kernel_size": 3,
193
+ "problem_type": null,
194
+ "return_dict": true,
195
+ "rms_norm_eps": 1e-06
196
+ }
197
+ }
generation_config.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 2,
3
+ "do_sample": true,
4
+ "eos_token_id": 1,
5
+ "pad_token_id": 0,
6
+ "suppress_tokens": [
7
+ 255999,
8
+ 256000,
9
+ 258880,
10
+ 258881,
11
+ 258882,
12
+ 258883
13
+ ],
14
+ "temperature": 1.0,
15
+ "top_k": 64,
16
+ "top_p": 0.95,
17
+ "transformers_version": "5.10.0.dev0"
18
+ }
model-00001-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f767a133827d478e5bd72c3c9368d27093f6cae7f9f6ba300e46f24c584cf68b
3
+ size 5367921355
model-00002-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5e6aff45aef8a31e39e22b22cbf78f3b747750094c45311e582e20443b6e0a3f
3
+ size 999627210
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
processor_config.json ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "do_convert_rgb": true,
4
+ "do_normalize": false,
5
+ "do_rescale": true,
6
+ "do_resize": true,
7
+ "image_mean": [
8
+ 0.0,
9
+ 0.0,
10
+ 0.0
11
+ ],
12
+ "image_processor_type": "Gemma4UnifiedImageProcessor",
13
+ "image_std": [
14
+ 1.0,
15
+ 1.0,
16
+ 1.0
17
+ ],
18
+ "max_soft_tokens": 280,
19
+ "model_patch_size": 48,
20
+ "patch_size": 16,
21
+ "pooling_kernel_size": 3,
22
+ "resample": 3,
23
+ "rescale_factor": 0.00392156862745098,
24
+ "size": {
25
+ "height": 224,
26
+ "width": 224
27
+ }
28
+ },
29
+ "processor_class": "Gemma4UnifiedProcessor",
30
+ "feature_extractor": {
31
+ "feature_extractor_type": "Gemma4UnifiedAudioFeatureExtractor",
32
+ "sampling_rate": 16000,
33
+ "num_mel_filters": 128,
34
+ "fft_length": 512,
35
+ "hop_length": 160,
36
+ "chunk_duration": 8.0,
37
+ "overlap_duration": 1.0
38
+ },
39
+ "audio_ms_per_token": 40
40
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:12bac982b793c44b03d52a250a9f0d0b666813da566b910c24a6da0695fd11e6
3
+ size 32170070
tokenizer_config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": true,
21
+ "local_files_only": true,
22
+ "mask_token": "<mask>",
23
+ "model_max_length": 1000000000000000019884624838656,
24
+ "model_specific_special_tokens": {
25
+ "audio_token": "<|audio|>",
26
+ "boa_token": "<|audio>",
27
+ "boi_token": "<|image>",
28
+ "eoa_token": "<audio|>",
29
+ "eoc_token": "<channel|>",
30
+ "eoi_token": "<image|>",
31
+ "eot_token": "<turn|>",
32
+ "escape_token": "<|\"|>",
33
+ "etc_token": "<tool_call|>",
34
+ "etd_token": "<tool|>",
35
+ "etr_token": "<tool_response|>",
36
+ "image_token": "<|image|>",
37
+ "soc_token": "<|channel>",
38
+ "sot_token": "<|turn>",
39
+ "stc_token": "<|tool_call>",
40
+ "std_token": "<|tool>",
41
+ "str_token": "<|tool_response>",
42
+ "think_token": "<|think|>"
43
+ },
44
+ "pad_token": "<pad>",
45
+ "padding_side": "left",
46
+ "processor_class": "Gemma4UnifiedProcessor",
47
+ "soc_token": "<|channel>",
48
+ "sot_token": "<|turn>",
49
+ "stc_token": "<|tool_call>",
50
+ "std_token": "<|tool>",
51
+ "str_token": "<|tool_response>",
52
+ "think_token": "<|think|>",
53
+ "tokenizer_class": "GemmaTokenizer",
54
+ "unk_token": "<unk>"
55
+ }