Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- README.md +25 -0
- config.json +197 -0
- generation_config.json +10 -0
- model.safetensors +3 -0
- model.safetensors.index.json +0 -0
- processor_config.json +32 -0
- tokenizer.json +3 -0
- tokenizer_config.json +54 -0
.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,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: mlx
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
license_link: https://ai.google.dev/gemma/docs/gemma_4_license
|
| 5 |
+
pipeline_tag: any-to-any
|
| 6 |
+
base_model: google/gemma-4-e2b
|
| 7 |
+
tags:
|
| 8 |
+
- mlx
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# mlx-community/gemma-4-e2b-4bit
|
| 12 |
+
|
| 13 |
+
This model was converted to MLX format from [`google/gemma-4-e2b`](https://huggingface.co/google/gemma-4-e2b)
|
| 14 |
+
using mlx-vlm version **0.4.3**.
|
| 15 |
+
Refer to the [original model card](https://huggingface.co/google/gemma-4-e2b) for more details on the model.
|
| 16 |
+
|
| 17 |
+
## Use with mlx
|
| 18 |
+
|
| 19 |
+
```bash
|
| 20 |
+
pip install -U mlx-vlm
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
```bash
|
| 24 |
+
python -m mlx_vlm.generate --model mlx-community/gemma-4-e2b-4bit --max-tokens 100 --temperature 0.0 --prompt "Describe this image." --image <path_to_image>
|
| 25 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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": 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 |
+
"dtype": "bfloat16",
|
| 49 |
+
"eoa_token_id": 258883,
|
| 50 |
+
"eoa_token_index": 258883,
|
| 51 |
+
"eoi_token_id": 258882,
|
| 52 |
+
"eos_token_id": 1,
|
| 53 |
+
"image_token_id": 258880,
|
| 54 |
+
"initializer_range": 0.02,
|
| 55 |
+
"model_type": "gemma4",
|
| 56 |
+
"quantization": {
|
| 57 |
+
"group_size": 64,
|
| 58 |
+
"bits": 4,
|
| 59 |
+
"mode": "affine"
|
| 60 |
+
},
|
| 61 |
+
"quantization_config": {
|
| 62 |
+
"group_size": 64,
|
| 63 |
+
"bits": 4,
|
| 64 |
+
"mode": "affine"
|
| 65 |
+
},
|
| 66 |
+
"text_config": {
|
| 67 |
+
"attention_bias": false,
|
| 68 |
+
"attention_dropout": 0.0,
|
| 69 |
+
"attention_k_eq_v": false,
|
| 70 |
+
"bos_token_id": 2,
|
| 71 |
+
"dtype": "bfloat16",
|
| 72 |
+
"enable_moe_block": false,
|
| 73 |
+
"eos_token_id": 1,
|
| 74 |
+
"expert_intermediate_size": null,
|
| 75 |
+
"final_logit_softcapping": 30.0,
|
| 76 |
+
"global_head_dim": 512,
|
| 77 |
+
"head_dim": 256,
|
| 78 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 79 |
+
"hidden_size": 1536,
|
| 80 |
+
"hidden_size_per_layer_input": 256,
|
| 81 |
+
"initializer_range": 0.02,
|
| 82 |
+
"intermediate_size": 6144,
|
| 83 |
+
"layer_types": [
|
| 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 |
+
"full_attention",
|
| 94 |
+
"sliding_attention",
|
| 95 |
+
"sliding_attention",
|
| 96 |
+
"sliding_attention",
|
| 97 |
+
"sliding_attention",
|
| 98 |
+
"full_attention",
|
| 99 |
+
"sliding_attention",
|
| 100 |
+
"sliding_attention",
|
| 101 |
+
"sliding_attention",
|
| 102 |
+
"sliding_attention",
|
| 103 |
+
"full_attention",
|
| 104 |
+
"sliding_attention",
|
| 105 |
+
"sliding_attention",
|
| 106 |
+
"sliding_attention",
|
| 107 |
+
"sliding_attention",
|
| 108 |
+
"full_attention",
|
| 109 |
+
"sliding_attention",
|
| 110 |
+
"sliding_attention",
|
| 111 |
+
"sliding_attention",
|
| 112 |
+
"sliding_attention",
|
| 113 |
+
"full_attention",
|
| 114 |
+
"sliding_attention",
|
| 115 |
+
"sliding_attention",
|
| 116 |
+
"sliding_attention",
|
| 117 |
+
"sliding_attention",
|
| 118 |
+
"full_attention"
|
| 119 |
+
],
|
| 120 |
+
"max_position_embeddings": 131072,
|
| 121 |
+
"model_type": "gemma4_text",
|
| 122 |
+
"num_attention_heads": 8,
|
| 123 |
+
"num_experts": null,
|
| 124 |
+
"num_global_key_value_heads": null,
|
| 125 |
+
"num_hidden_layers": 35,
|
| 126 |
+
"num_key_value_heads": 1,
|
| 127 |
+
"num_kv_shared_layers": 20,
|
| 128 |
+
"pad_token_id": 0,
|
| 129 |
+
"rms_norm_eps": 1e-06,
|
| 130 |
+
"rope_parameters": {
|
| 131 |
+
"full_attention": {
|
| 132 |
+
"partial_rotary_factor": 0.25,
|
| 133 |
+
"rope_theta": 1000000.0,
|
| 134 |
+
"rope_type": "proportional"
|
| 135 |
+
},
|
| 136 |
+
"sliding_attention": {
|
| 137 |
+
"rope_theta": 10000.0,
|
| 138 |
+
"rope_type": "default"
|
| 139 |
+
}
|
| 140 |
+
},
|
| 141 |
+
"sliding_window": 512,
|
| 142 |
+
"tie_word_embeddings": true,
|
| 143 |
+
"top_k_experts": null,
|
| 144 |
+
"use_bidirectional_attention": null,
|
| 145 |
+
"use_cache": true,
|
| 146 |
+
"use_double_wide_mlp": true,
|
| 147 |
+
"vocab_size": 262144,
|
| 148 |
+
"vocab_size_per_layer_input": 262144
|
| 149 |
+
},
|
| 150 |
+
"tie_word_embeddings": true,
|
| 151 |
+
"transformers_version": "5.5.0.dev0",
|
| 152 |
+
"video_token_id": 258884,
|
| 153 |
+
"vision_config": {
|
| 154 |
+
"_name_or_path": "",
|
| 155 |
+
"architectures": null,
|
| 156 |
+
"attention_bias": false,
|
| 157 |
+
"attention_dropout": 0.0,
|
| 158 |
+
"chunk_size_feed_forward": 0,
|
| 159 |
+
"default_output_length": 280,
|
| 160 |
+
"dtype": "bfloat16",
|
| 161 |
+
"global_head_dim": 64,
|
| 162 |
+
"head_dim": 64,
|
| 163 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 164 |
+
"hidden_size": 768,
|
| 165 |
+
"id2label": {
|
| 166 |
+
"0": "LABEL_0",
|
| 167 |
+
"1": "LABEL_1"
|
| 168 |
+
},
|
| 169 |
+
"initializer_range": 0.02,
|
| 170 |
+
"intermediate_size": 3072,
|
| 171 |
+
"is_encoder_decoder": false,
|
| 172 |
+
"label2id": {
|
| 173 |
+
"LABEL_0": 0,
|
| 174 |
+
"LABEL_1": 1
|
| 175 |
+
},
|
| 176 |
+
"max_position_embeddings": 131072,
|
| 177 |
+
"model_type": "gemma4_vision",
|
| 178 |
+
"num_attention_heads": 12,
|
| 179 |
+
"num_hidden_layers": 16,
|
| 180 |
+
"num_key_value_heads": 12,
|
| 181 |
+
"output_attentions": false,
|
| 182 |
+
"output_hidden_states": false,
|
| 183 |
+
"patch_size": 16,
|
| 184 |
+
"pooling_kernel_size": 3,
|
| 185 |
+
"position_embedding_size": 10240,
|
| 186 |
+
"problem_type": null,
|
| 187 |
+
"return_dict": true,
|
| 188 |
+
"rms_norm_eps": 1e-06,
|
| 189 |
+
"rope_parameters": {
|
| 190 |
+
"rope_theta": 100.0,
|
| 191 |
+
"rope_type": "default"
|
| 192 |
+
},
|
| 193 |
+
"standardize": false,
|
| 194 |
+
"use_clipped_linears": true
|
| 195 |
+
},
|
| 196 |
+
"vision_soft_tokens_per_image": 280
|
| 197 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 2,
|
| 3 |
+
"do_sample": true,
|
| 4 |
+
"eos_token_id": 1,
|
| 5 |
+
"pad_token_id": 0,
|
| 6 |
+
"temperature": 1.0,
|
| 7 |
+
"top_k": 64,
|
| 8 |
+
"top_p": 0.95,
|
| 9 |
+
"transformers_version": "5.5.0.dev0"
|
| 10 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1b75a001977eeadfe0c82eabde23d470530c311b6a8c279a3c2382aafc2a2d5b
|
| 3 |
+
size 3581101896
|
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,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"audio_seq_length": 750,
|
| 3 |
+
"image_processor": {
|
| 4 |
+
"do_convert_rgb": true,
|
| 5 |
+
"do_normalize": false,
|
| 6 |
+
"do_rescale": true,
|
| 7 |
+
"do_resize": true,
|
| 8 |
+
"image_mean": [
|
| 9 |
+
0.0,
|
| 10 |
+
0.0,
|
| 11 |
+
0.0
|
| 12 |
+
],
|
| 13 |
+
"image_processor_type": "Gemma4ImageProcessor",
|
| 14 |
+
"image_seq_length": 280,
|
| 15 |
+
"image_std": [
|
| 16 |
+
1.0,
|
| 17 |
+
1.0,
|
| 18 |
+
1.0
|
| 19 |
+
],
|
| 20 |
+
"max_soft_tokens": 280,
|
| 21 |
+
"patch_size": 16,
|
| 22 |
+
"pooling_kernel_size": 3,
|
| 23 |
+
"resample": 3,
|
| 24 |
+
"rescale_factor": 0.00392156862745098,
|
| 25 |
+
"size": {
|
| 26 |
+
"height": 224,
|
| 27 |
+
"width": 224
|
| 28 |
+
}
|
| 29 |
+
},
|
| 30 |
+
"image_seq_length": 280,
|
| 31 |
+
"processor_class": "Gemma4Processor"
|
| 32 |
+
}
|
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,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
"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 |
+
"soc_token": "<|channel>",
|
| 47 |
+
"sot_token": "<|turn>",
|
| 48 |
+
"stc_token": "<|tool_call>",
|
| 49 |
+
"std_token": "<|tool>",
|
| 50 |
+
"str_token": "<|tool_response>",
|
| 51 |
+
"think_token": "<|think|>",
|
| 52 |
+
"tokenizer_class": "GemmaTokenizer",
|
| 53 |
+
"unk_token": "<unk>"
|
| 54 |
+
}
|