Image-Text-to-Text
Safetensors
MLX
mlx-vlm
gemma4_unified
gemma-4
vision-language
quantized
4-bit precision
6-bit
8-bit precision
apple-silicon
Instructions to use chanderbalaji/Grug-12B-VLM-MLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use chanderbalaji/Grug-12B-VLM-MLX 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("chanderbalaji/Grug-12B-VLM-MLX") config = load_config("chanderbalaji/Grug-12B-VLM-MLX") # 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
Add Grug-12B MLX model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pipeline_tag: image-text-to-text
|
| 3 |
+
library_name: mlx-vlm
|
| 4 |
+
license: other
|
| 5 |
+
base_model: kai-os/Grug-12B
|
| 6 |
+
base_model_relation: quantized
|
| 7 |
+
tags:
|
| 8 |
+
- mlx
|
| 9 |
+
- mlx-vlm
|
| 10 |
+
- gemma4_unified
|
| 11 |
+
- gemma-4
|
| 12 |
+
- vision-language
|
| 13 |
+
- image-text-to-text
|
| 14 |
+
- quantized
|
| 15 |
+
- 4-bit
|
| 16 |
+
- 6-bit
|
| 17 |
+
- 8-bit
|
| 18 |
+
- apple-silicon
|
| 19 |
+
datasets:
|
| 20 |
+
- hotdogs/uka-glm-5.2
|
| 21 |
+
- Scale-or-Reason/general-reasoning-ift-pairs
|
| 22 |
+
- samcheng0/lumia-reasoning-sft-v1
|
| 23 |
+
- HSH-Intelligence/verified-math-reasoning-3k
|
| 24 |
+
- kd13/CodeDebug-Instruct-v2-Reasoning
|
| 25 |
+
- Madarabr/cortex-adaptive-thinking
|
| 26 |
+
- CL-From-Nothing/code_rose_initial_1_7B_SFT_10K_rollouts_Qwen3-4B-Thinking-2507_k12_t0.7_maxtok12288
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
# Grug-12B VLM MLX
|
| 30 |
+
|
| 31 |
+
This repository contains MLX VLM quantizations of
|
| 32 |
+
[`kai-os/Grug-12B`](https://huggingface.co/kai-os/Grug-12B), packaged in one
|
| 33 |
+
Hugging Face repo with separate folders for each quantization level.
|
| 34 |
+
|
| 35 |
+
`Grug-12B` is a compact-reasoning fine-tune of
|
| 36 |
+
[`google/gemma-4-12B-it`](https://huggingface.co/google/gemma-4-12B-it). The
|
| 37 |
+
source model was released as merged Transformers/safetensors weights after
|
| 38 |
+
QLoRA training. This repo only provides MLX quantized derivatives for Apple
|
| 39 |
+
Silicon inference and keeps the original vision-language model structure.
|
| 40 |
+
|
| 41 |
+
## Available variants
|
| 42 |
+
|
| 43 |
+
| Folder | Quantization | Local size | Notes |
|
| 44 |
+
| --- | --- | ---: | --- |
|
| 45 |
+
| `mlx-8bit/` | MLX affine 8-bit, group size 64 | 12 GB | Highest quality local MLX variant. |
|
| 46 |
+
| `mlx-6bit/` | MLX affine 6-bit, group size 64 | 9.1 GB | Balanced size and quality. |
|
| 47 |
+
| `mlx-4bit/` | MLX affine 4-bit, group size 64 | 6.3 GB | Smallest and easiest to run. |
|
| 48 |
+
|
| 49 |
+
These are not GGUF files and are not llama.cpp quants. They are MLX safetensors
|
| 50 |
+
folders intended for `mlx-vlm`.
|
| 51 |
+
|
| 52 |
+
## Usage
|
| 53 |
+
|
| 54 |
+
Download only the variant you want:
|
| 55 |
+
|
| 56 |
+
```python
|
| 57 |
+
from pathlib import Path
|
| 58 |
+
from huggingface_hub import snapshot_download
|
| 59 |
+
|
| 60 |
+
repo_id = "chanderbalaji/Grug-12B-VLM-MLX"
|
| 61 |
+
variant = "mlx-4bit"
|
| 62 |
+
|
| 63 |
+
snapshot = snapshot_download(
|
| 64 |
+
repo_id,
|
| 65 |
+
allow_patterns=[f"{variant}/*"],
|
| 66 |
+
)
|
| 67 |
+
model_path = Path(snapshot) / variant
|
| 68 |
+
print(model_path)
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
Run with `mlx-vlm`:
|
| 72 |
+
|
| 73 |
+
```bash
|
| 74 |
+
python -m mlx_vlm.generate \
|
| 75 |
+
--model /path/to/downloaded/snapshot/mlx-4bit \
|
| 76 |
+
--prompt "Describe this image." \
|
| 77 |
+
--image /path/to/image.jpg \
|
| 78 |
+
--max-tokens 256
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
For text-only prompts, omit the `--image` argument.
|
| 82 |
+
|
| 83 |
+
## Provenance and attribution
|
| 84 |
+
|
| 85 |
+
- Source model: [`kai-os/Grug-12B`](https://huggingface.co/kai-os/Grug-12B)
|
| 86 |
+
- Base model: [`google/gemma-4-12B-it`](https://huggingface.co/google/gemma-4-12B-it)
|
| 87 |
+
- Relationship: MLX quantized derivatives of the source model
|
| 88 |
+
- Source revision used locally: `ad3feab42542e3361dcaf0ebe795d55009765918`
|
| 89 |
+
- Conversion target: Gemma 4 unified VLM with `vision_config` preserved
|
| 90 |
+
|
| 91 |
+
The source model card describes the original training recipe, datasets, local
|
| 92 |
+
evaluation, limitations, and acknowledgements. Please refer to that card for
|
| 93 |
+
the full model provenance and license context.
|
| 94 |
+
|
| 95 |
+
## Limitations
|
| 96 |
+
|
| 97 |
+
Quantization can change output quality, numerical behavior, and edge-case
|
| 98 |
+
performance. These files are intended for local MLX inference on Apple Silicon.
|
| 99 |
+
Use the source model repo for the original BF16 Transformers weights.
|