Instructions to use mlx-community/gemma-4-26b-a4b-it-bf16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/gemma-4-26b-a4b-it-bf16 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-4-26b-a4b-it-bf16") config = load_config("mlx-community/gemma-4-26b-a4b-it-bf16") # 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 Settings
- LM Studio
- Pi
How to use mlx-community/gemma-4-26b-a4b-it-bf16 with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/gemma-4-26b-a4b-it-bf16"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "mlx-community/gemma-4-26b-a4b-it-bf16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use mlx-community/gemma-4-26b-a4b-it-bf16 with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/gemma-4-26b-a4b-it-bf16"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default mlx-community/gemma-4-26b-a4b-it-bf16
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use mlx-community/gemma-4-26b-a4b-it-bf16 with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/gemma-4-26b-a4b-it-bf16"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "mlx-community/gemma-4-26b-a4b-it-bf16" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Re-upload google/gemma-4-26B-A4B-it MLX bf16
Browse filesConverted from google/gemma-4-26B-A4B-it at revision 20da991ab4afab98e8f910c4a2e8f4fbefc404ad with the current mlx-vlm checkout.
- README.md +11 -10
- config.json +18 -0
- model-00001-of-00011.safetensors +2 -2
- model-00002-of-00011.safetensors +2 -2
- model-00003-of-00011.safetensors +2 -2
- model-00004-of-00011.safetensors +2 -2
- model-00005-of-00011.safetensors +2 -2
- model-00006-of-00011.safetensors +2 -2
- model-00007-of-00011.safetensors +2 -2
- model-00008-of-00011.safetensors +2 -2
- model-00009-of-00011.safetensors +2 -2
- model-00010-of-00011.safetensors +2 -2
- model-00011-of-00011.safetensors +2 -2
- processor_config.json +33 -2
- tokenizer_config.json +42 -20
README.md
CHANGED
|
@@ -5,21 +5,22 @@ license_link: https://ai.google.dev/gemma/docs/gemma_4_license
|
|
| 5 |
pipeline_tag: image-text-to-text
|
| 6 |
tags:
|
| 7 |
- mlx
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
---
|
| 10 |
-
|
| 11 |
# mlx-community/gemma-4-26b-a4b-it-bf16
|
| 12 |
|
| 13 |
-
This model was converted to MLX format from [
|
| 14 |
-
using mlx-vlm version **0.4.3**.
|
| 15 |
-
Refer to the [original model card](https://huggingface.co/google/gemma-4-26b-a4b-it) for more details on the model.
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
| 20 |
-
pip install -U mlx-vlm
|
| 21 |
-
```
|
| 22 |
|
| 23 |
```bash
|
| 24 |
-
|
|
|
|
| 25 |
```
|
|
|
|
| 5 |
pipeline_tag: image-text-to-text
|
| 6 |
tags:
|
| 7 |
- mlx
|
| 8 |
+
- safetensors
|
| 9 |
+
- gemma4
|
| 10 |
+
- image-text-to-text
|
| 11 |
+
- conversational
|
| 12 |
+
- bf16
|
| 13 |
+
base_model: google/gemma-4-26B-A4B-it
|
| 14 |
---
|
|
|
|
| 15 |
# mlx-community/gemma-4-26b-a4b-it-bf16
|
| 16 |
|
| 17 |
+
This model was converted to MLX format from [google/gemma-4-26B-A4B-it](https://huggingface.co/google/gemma-4-26B-A4B-it) at revision `20da991ab4afab98e8f910c4a2e8f4fbefc404ad`.
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
It was generated from the current `mlx-vlm` source checkout.
|
| 20 |
|
| 21 |
+
## Use with mlx-vlm
|
|
|
|
|
|
|
| 22 |
|
| 23 |
```bash
|
| 24 |
+
pip install -U mlx-vlm
|
| 25 |
+
mlx_vlm.generate --model mlx-community/gemma-4-26b-a4b-it-bf16 --max-tokens 100 --temperature 0.0 --prompt "Describe this image." --image <path_to_image>
|
| 26 |
```
|
config.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
| 6 |
"audio_token_id": 258881,
|
| 7 |
"boa_token_id": 256000,
|
| 8 |
"boi_token_id": 255999,
|
|
|
|
| 9 |
"dtype": "bfloat16",
|
| 10 |
"eoa_token_id": 258883,
|
| 11 |
"eoa_token_index": 258883,
|
|
@@ -15,9 +16,24 @@
|
|
| 15 |
106,
|
| 16 |
50
|
| 17 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
"image_token_id": 258880,
|
| 19 |
"initializer_range": 0.02,
|
| 20 |
"model_type": "gemma4",
|
|
|
|
| 21 |
"text_config": {
|
| 22 |
"attention_bias": false,
|
| 23 |
"attention_dropout": 0.0,
|
|
@@ -98,6 +114,8 @@
|
|
| 98 |
"vocab_size_per_layer_input": 262144
|
| 99 |
},
|
| 100 |
"tie_word_embeddings": true,
|
|
|
|
|
|
|
| 101 |
"transformers_version": "5.5.0.dev0",
|
| 102 |
"video_token_id": 258884,
|
| 103 |
"vision_config": {
|
|
|
|
| 6 |
"audio_token_id": 258881,
|
| 7 |
"boa_token_id": 256000,
|
| 8 |
"boi_token_id": 255999,
|
| 9 |
+
"do_sample": true,
|
| 10 |
"dtype": "bfloat16",
|
| 11 |
"eoa_token_id": 258883,
|
| 12 |
"eoa_token_index": 258883,
|
|
|
|
| 16 |
106,
|
| 17 |
50
|
| 18 |
],
|
| 19 |
+
"generation_config": {
|
| 20 |
+
"bos_token_id": 2,
|
| 21 |
+
"do_sample": true,
|
| 22 |
+
"eos_token_id": [
|
| 23 |
+
1,
|
| 24 |
+
106,
|
| 25 |
+
50
|
| 26 |
+
],
|
| 27 |
+
"pad_token_id": 0,
|
| 28 |
+
"temperature": 1.0,
|
| 29 |
+
"top_k": 64,
|
| 30 |
+
"top_p": 0.95,
|
| 31 |
+
"transformers_version": "5.5.0.dev0"
|
| 32 |
+
},
|
| 33 |
"image_token_id": 258880,
|
| 34 |
"initializer_range": 0.02,
|
| 35 |
"model_type": "gemma4",
|
| 36 |
+
"temperature": 1.0,
|
| 37 |
"text_config": {
|
| 38 |
"attention_bias": false,
|
| 39 |
"attention_dropout": 0.0,
|
|
|
|
| 114 |
"vocab_size_per_layer_input": 262144
|
| 115 |
},
|
| 116 |
"tie_word_embeddings": true,
|
| 117 |
+
"top_k": 64,
|
| 118 |
+
"top_p": 0.95,
|
| 119 |
"transformers_version": "5.5.0.dev0",
|
| 120 |
"video_token_id": 258884,
|
| 121 |
"vision_config": {
|
model-00001-of-00011.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:3d3abd759970cd5a07a718e7a94412ee190aa324dcb5863571c7fa04cb49552d
|
| 3 |
+
size 5345934811
|
model-00002-of-00011.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:e5555b937f147b35ccbc282c3234a6c947877ab3b2214768c75aa20d818cc273
|
| 3 |
+
size 4913415699
|
model-00003-of-00011.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:addadb54f41ef12f5a853751e88fdcd87d9ebeb35ef269f999300abf3ffbb0b9
|
| 3 |
+
size 4884578893
|
model-00004-of-00011.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:a704d896d6f698abbe526e6ece4a49b7bb9fb26feed6e57444e776fbe2ca6db6
|
| 3 |
+
size 4913415700
|
model-00005-of-00011.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:f5ecbc6e6b7d7fa53fdb8bd1314d2cb9ede8e9ffc371bbc43b6efff01224ad7f
|
| 3 |
+
size 4884578998
|
model-00006-of-00011.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:e1aa7283837a88857f24bc3cd2a38f0651c79adaae182f0743310375d0d97f8d
|
| 3 |
+
size 4913415679
|
model-00007-of-00011.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:8fe948aded6caaae5f7870758b9087e0585c3f2f0984a9a53e9e80c89f251399
|
| 3 |
+
size 4884579000
|
model-00008-of-00011.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:3fdb53b1df10180b387fb78babb32b0cb5a4c2db7abcd81869e6c800db9f869d
|
| 3 |
+
size 4913415731
|
model-00009-of-00011.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:5bd647b7d70969a358dd416beb1a50a1971cd3e73d0428c87c78651053389233
|
| 3 |
+
size 4884579038
|
model-00010-of-00011.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:7306fc374c6a2229a32e528828b10f06ffe1bfe216d66740ebb8ce66a66d2274
|
| 3 |
+
size 4913415721
|
model-00011-of-00011.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:9e1e4bcb5721025e6d7101d96904ac579ce1cb01e9cfdee72bb6c17798371662
|
| 3 |
+
size 2160681171
|
processor_config.json
CHANGED
|
@@ -28,5 +28,36 @@
|
|
| 28 |
}
|
| 29 |
},
|
| 30 |
"image_seq_length": 280,
|
| 31 |
-
"processor_class": "Gemma4Processor"
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
}
|
| 29 |
},
|
| 30 |
"image_seq_length": 280,
|
| 31 |
+
"processor_class": "Gemma4Processor",
|
| 32 |
+
"video_processor": {
|
| 33 |
+
"default_fps": 2.0,
|
| 34 |
+
"do_normalize": true,
|
| 35 |
+
"do_rescale": true,
|
| 36 |
+
"image_mean": [
|
| 37 |
+
0.0,
|
| 38 |
+
0.0,
|
| 39 |
+
0.0
|
| 40 |
+
],
|
| 41 |
+
"image_std": [
|
| 42 |
+
1.0,
|
| 43 |
+
1.0,
|
| 44 |
+
1.0
|
| 45 |
+
],
|
| 46 |
+
"max_soft_tokens": 70,
|
| 47 |
+
"num_frames": 32,
|
| 48 |
+
"patch_size": 16,
|
| 49 |
+
"pooling_kernel_size": 3,
|
| 50 |
+
"rescale_factor": 0.00392156862745098,
|
| 51 |
+
"video_processor_type": "Gemma4VideoProcessor"
|
| 52 |
+
},
|
| 53 |
+
"feature_extractor": {
|
| 54 |
+
"feature_extractor_type": "Gemma4AudioFeatureExtractor",
|
| 55 |
+
"sampling_rate": 16000,
|
| 56 |
+
"num_mel_filters": 128,
|
| 57 |
+
"fft_length": 512,
|
| 58 |
+
"hop_length": 160,
|
| 59 |
+
"chunk_duration": 8.0,
|
| 60 |
+
"overlap_duration": 1.0
|
| 61 |
+
},
|
| 62 |
+
"audio_ms_per_token": 40
|
| 63 |
+
}
|
tokenizer_config.json
CHANGED
|
@@ -17,50 +17,72 @@
|
|
| 17 |
"<|video|>"
|
| 18 |
],
|
| 19 |
"image_token": "<|image|>",
|
|
|
|
|
|
|
| 20 |
"mask_token": "<mask>",
|
| 21 |
"model_max_length": 1000000000000000019884624838656,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
"pad_token": "<pad>",
|
| 23 |
"padding_side": "left",
|
| 24 |
"processor_class": "Gemma4Processor",
|
| 25 |
"response_schema": {
|
| 26 |
-
"type": "object",
|
| 27 |
"properties": {
|
|
|
|
|
|
|
|
|
|
| 28 |
"role": {
|
| 29 |
"const": "assistant"
|
| 30 |
},
|
| 31 |
"thinking": {
|
| 32 |
"type": "string"
|
| 33 |
},
|
| 34 |
-
"content": {
|
| 35 |
-
"type": "string"
|
| 36 |
-
},
|
| 37 |
"tool_calls": {
|
| 38 |
-
"x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>",
|
| 39 |
-
"type": "array",
|
| 40 |
"items": {
|
| 41 |
-
"type": "object",
|
| 42 |
"properties": {
|
| 43 |
-
"type": {
|
| 44 |
-
"const": "function"
|
| 45 |
-
},
|
| 46 |
"function": {
|
| 47 |
-
"type": "object",
|
| 48 |
-
"x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})",
|
| 49 |
"properties": {
|
| 50 |
-
"name": {
|
| 51 |
-
"type": "string"
|
| 52 |
-
},
|
| 53 |
"arguments": {
|
|
|
|
| 54 |
"type": "object",
|
| 55 |
-
"x-parser": "gemma4-tool-call"
|
| 56 |
-
|
|
|
|
|
|
|
| 57 |
}
|
| 58 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
}
|
| 60 |
-
}
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
| 62 |
}
|
| 63 |
},
|
|
|
|
| 64 |
"x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?"
|
| 65 |
},
|
| 66 |
"soc_token": "<|channel>",
|
|
|
|
| 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": "Gemma4Processor",
|
| 47 |
"response_schema": {
|
|
|
|
| 48 |
"properties": {
|
| 49 |
+
"content": {
|
| 50 |
+
"type": "string"
|
| 51 |
+
},
|
| 52 |
"role": {
|
| 53 |
"const": "assistant"
|
| 54 |
},
|
| 55 |
"thinking": {
|
| 56 |
"type": "string"
|
| 57 |
},
|
|
|
|
|
|
|
|
|
|
| 58 |
"tool_calls": {
|
|
|
|
|
|
|
| 59 |
"items": {
|
|
|
|
| 60 |
"properties": {
|
|
|
|
|
|
|
|
|
|
| 61 |
"function": {
|
|
|
|
|
|
|
| 62 |
"properties": {
|
|
|
|
|
|
|
|
|
|
| 63 |
"arguments": {
|
| 64 |
+
"additionalProperties": {},
|
| 65 |
"type": "object",
|
| 66 |
+
"x-parser": "gemma4-tool-call"
|
| 67 |
+
},
|
| 68 |
+
"name": {
|
| 69 |
+
"type": "string"
|
| 70 |
}
|
| 71 |
+
},
|
| 72 |
+
"type": "object",
|
| 73 |
+
"x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})"
|
| 74 |
+
},
|
| 75 |
+
"type": {
|
| 76 |
+
"const": "function"
|
| 77 |
}
|
| 78 |
+
},
|
| 79 |
+
"type": "object"
|
| 80 |
+
},
|
| 81 |
+
"type": "array",
|
| 82 |
+
"x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>"
|
| 83 |
}
|
| 84 |
},
|
| 85 |
+
"type": "object",
|
| 86 |
"x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?"
|
| 87 |
},
|
| 88 |
"soc_token": "<|channel>",
|