Image-Text-to-Text
Transformers
Safetensors
MLX
gemma3n
automatic-speech-recognition
automatic-speech-translation
audio-text-to-text
video-text-to-text
6-bit
Instructions to use mlx-community/gemma-3n-E2B-6bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mlx-community/gemma-3n-E2B-6bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="mlx-community/gemma-3n-E2B-6bit")# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("mlx-community/gemma-3n-E2B-6bit") model = AutoModelForImageTextToText.from_pretrained("mlx-community/gemma-3n-E2B-6bit") - MLX
How to use mlx-community/gemma-3n-E2B-6bit with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("mlx-community/gemma-3n-E2B-6bit") config = load_config("mlx-community/gemma-3n-E2B-6bit") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- LM Studio
- vLLM
How to use mlx-community/gemma-3n-E2B-6bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mlx-community/gemma-3n-E2B-6bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/gemma-3n-E2B-6bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/mlx-community/gemma-3n-E2B-6bit
- SGLang
How to use mlx-community/gemma-3n-E2B-6bit with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "mlx-community/gemma-3n-E2B-6bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/gemma-3n-E2B-6bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "mlx-community/gemma-3n-E2B-6bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/gemma-3n-E2B-6bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use mlx-community/gemma-3n-E2B-6bit with Docker Model Runner:
docker model run hf.co/mlx-community/gemma-3n-E2B-6bit
Upload folder using huggingface_hub
Browse files- README.md +1 -1
- config.json +2 -6
- generation_config.json +1 -1
- model-00001-of-00002.safetensors +2 -2
- model.safetensors.index.json +3 -2
- preprocessor_config.json +1 -1
README.md
CHANGED
|
@@ -17,7 +17,7 @@ tags:
|
|
| 17 |
---
|
| 18 |
|
| 19 |
# mlx-community/gemma-3n-E2B-6bit
|
| 20 |
-
This model was converted to MLX format from [`google/gemma-3n-E2B`]() using mlx-vlm version **0.3.
|
| 21 |
Refer to the [original model card](https://huggingface.co/google/gemma-3n-E2B) for more details on the model.
|
| 22 |
## Use with mlx
|
| 23 |
|
|
|
|
| 17 |
---
|
| 18 |
|
| 19 |
# mlx-community/gemma-3n-E2B-6bit
|
| 20 |
+
This model was converted to MLX format from [`google/gemma-3n-E2B`]() using mlx-vlm version **0.3.1**.
|
| 21 |
Refer to the [original model card](https://huggingface.co/google/gemma-3n-E2B) for more details on the model.
|
| 22 |
## Use with mlx
|
| 23 |
|
config.json
CHANGED
|
@@ -63,9 +63,7 @@
|
|
| 63 |
"task_specific_params": null,
|
| 64 |
"problem_type": null,
|
| 65 |
"_name_or_path": "",
|
| 66 |
-
"conf_positional_bias_size": 256,
|
| 67 |
"model_type": "gemma3n_audio",
|
| 68 |
-
"sscp_conv_eps": 0.001,
|
| 69 |
"input_feat_size": 128,
|
| 70 |
"hidden_size": 1536,
|
| 71 |
"rms_norm_eps": 1e-06,
|
|
@@ -3744,9 +3742,7 @@
|
|
| 3744 |
"task_specific_params": null,
|
| 3745 |
"problem_type": null,
|
| 3746 |
"_name_or_path": "",
|
| 3747 |
-
"altup_lr_multiplier": 1.0,
|
| 3748 |
"model_type": "gemma3n_text",
|
| 3749 |
-
"query_pre_attn_scalar": 256,
|
| 3750 |
"vocab_size": 262400,
|
| 3751 |
"vocab_size_per_layer_input": 262144,
|
| 3752 |
"max_position_embeddings": 32768,
|
|
@@ -3878,7 +3874,7 @@
|
|
| 3878 |
"top_k": 50,
|
| 3879 |
"top_p": 1.0,
|
| 3880 |
"torchscript": false,
|
| 3881 |
-
"transformers_version": "4.53.
|
| 3882 |
"typical_p": 1.0,
|
| 3883 |
"use_bfloat16": false,
|
| 3884 |
"vision_config": {
|
|
@@ -3940,7 +3936,7 @@
|
|
| 3940 |
"model_type": "gemma3n_vision",
|
| 3941 |
"num_classes": 2,
|
| 3942 |
"initializer_range": 0.02,
|
| 3943 |
-
"do_pooling":
|
| 3944 |
"model_args": null,
|
| 3945 |
"architecture": "mobilenetv5_300m_enc",
|
| 3946 |
"hidden_size": 2048,
|
|
|
|
| 63 |
"task_specific_params": null,
|
| 64 |
"problem_type": null,
|
| 65 |
"_name_or_path": "",
|
|
|
|
| 66 |
"model_type": "gemma3n_audio",
|
|
|
|
| 67 |
"input_feat_size": 128,
|
| 68 |
"hidden_size": 1536,
|
| 69 |
"rms_norm_eps": 1e-06,
|
|
|
|
| 3742 |
"task_specific_params": null,
|
| 3743 |
"problem_type": null,
|
| 3744 |
"_name_or_path": "",
|
|
|
|
| 3745 |
"model_type": "gemma3n_text",
|
|
|
|
| 3746 |
"vocab_size": 262400,
|
| 3747 |
"vocab_size_per_layer_input": 262144,
|
| 3748 |
"max_position_embeddings": 32768,
|
|
|
|
| 3874 |
"top_k": 50,
|
| 3875 |
"top_p": 1.0,
|
| 3876 |
"torchscript": false,
|
| 3877 |
+
"transformers_version": "4.53.2",
|
| 3878 |
"typical_p": 1.0,
|
| 3879 |
"use_bfloat16": false,
|
| 3880 |
"vision_config": {
|
|
|
|
| 3936 |
"model_type": "gemma3n_vision",
|
| 3937 |
"num_classes": 2,
|
| 3938 |
"initializer_range": 0.02,
|
| 3939 |
+
"do_pooling": false,
|
| 3940 |
"model_args": null,
|
| 3941 |
"architecture": "mobilenetv5_300m_enc",
|
| 3942 |
"hidden_size": 2048,
|
generation_config.json
CHANGED
|
@@ -6,5 +6,5 @@
|
|
| 6 |
"pad_token_id": 0,
|
| 7 |
"top_k": 64,
|
| 8 |
"top_p": 0.95,
|
| 9 |
-
"transformers_version": "4.
|
| 10 |
}
|
|
|
|
| 6 |
"pad_token_id": 0,
|
| 7 |
"top_k": 64,
|
| 8 |
"top_p": 0.95,
|
| 9 |
+
"transformers_version": "4.54.0.dev0"
|
| 10 |
}
|
model-00001-of-00002.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b25ddd00a44bf592444642f18735f7e6e7c4aa880af9d2ca71700990091c3668
|
| 3 |
+
size 5368407542
|
model.safetensors.index.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
{
|
| 2 |
"metadata": {
|
| 3 |
-
"total_parameters":
|
| 4 |
-
"total_size":
|
| 5 |
},
|
| 6 |
"weight_map": {
|
| 7 |
"model.audio_tower.conformer.0.attention.attn.k_proj.weight": "model-00001-of-00003.safetensors",
|
|
@@ -1553,6 +1553,7 @@
|
|
| 1553 |
"model.vision_tower.timm_model.blocks.3.9.layer_scale.gamma": "model-00001-of-00003.safetensors",
|
| 1554 |
"model.vision_tower.timm_model.blocks.3.9.norm.weight": "model-00001-of-00003.safetensors",
|
| 1555 |
"model.vision_tower.timm_model.conv_stem.bn.weight": "model-00001-of-00003.safetensors",
|
|
|
|
| 1556 |
"model.vision_tower.timm_model.conv_stem.conv.weight": "model-00001-of-00003.safetensors",
|
| 1557 |
"model.vision_tower.timm_model.msfa.ffn.pw_exp.bn.weight": "model-00001-of-00003.safetensors",
|
| 1558 |
"model.vision_tower.timm_model.msfa.ffn.pw_exp.conv.weight": "model-00001-of-00003.safetensors",
|
|
|
|
| 1 |
{
|
| 2 |
"metadata": {
|
| 3 |
+
"total_parameters": 5976833472,
|
| 4 |
+
"total_size": 10878876544
|
| 5 |
},
|
| 6 |
"weight_map": {
|
| 7 |
"model.audio_tower.conformer.0.attention.attn.k_proj.weight": "model-00001-of-00003.safetensors",
|
|
|
|
| 1553 |
"model.vision_tower.timm_model.blocks.3.9.layer_scale.gamma": "model-00001-of-00003.safetensors",
|
| 1554 |
"model.vision_tower.timm_model.blocks.3.9.norm.weight": "model-00001-of-00003.safetensors",
|
| 1555 |
"model.vision_tower.timm_model.conv_stem.bn.weight": "model-00001-of-00003.safetensors",
|
| 1556 |
+
"model.vision_tower.timm_model.conv_stem.conv.bias": "model-00001-of-00003.safetensors",
|
| 1557 |
"model.vision_tower.timm_model.conv_stem.conv.weight": "model-00001-of-00003.safetensors",
|
| 1558 |
"model.vision_tower.timm_model.msfa.ffn.pw_exp.bn.weight": "model-00001-of-00003.safetensors",
|
| 1559 |
"model.vision_tower.timm_model.msfa.ffn.pw_exp.conv.weight": "model-00001-of-00003.safetensors",
|
preprocessor_config.json
CHANGED
|
@@ -41,7 +41,7 @@
|
|
| 41 |
"processor_class": "Gemma3nProcessor",
|
| 42 |
"resample": 2,
|
| 43 |
"rescale_factor": 0.00392156862745098,
|
| 44 |
-
"return_attention_mask":
|
| 45 |
"return_tensors": null,
|
| 46 |
"sampling_rate": 16000,
|
| 47 |
"size": {
|
|
|
|
| 41 |
"processor_class": "Gemma3nProcessor",
|
| 42 |
"resample": 2,
|
| 43 |
"rescale_factor": 0.00392156862745098,
|
| 44 |
+
"return_attention_mask": true,
|
| 45 |
"return_tensors": null,
|
| 46 |
"sampling_rate": 16000,
|
| 47 |
"size": {
|