Image-Text-to-Text
Transformers
GGUF
Safetensors
English
vlm
multimodal
gemma4_unified
vision
quantized
any-to-any
Instructions to use DhruvalLabs/gemma-4-12B-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DhruvalLabs/gemma-4-12B-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="DhruvalLabs/gemma-4-12B-GGUF")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("DhruvalLabs/gemma-4-12B-GGUF", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use DhruvalLabs/gemma-4-12B-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf DhruvalLabs/gemma-4-12B-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf DhruvalLabs/gemma-4-12B-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf DhruvalLabs/gemma-4-12B-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf DhruvalLabs/gemma-4-12B-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf DhruvalLabs/gemma-4-12B-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf DhruvalLabs/gemma-4-12B-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf DhruvalLabs/gemma-4-12B-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf DhruvalLabs/gemma-4-12B-GGUF:Q4_K_M
Use Docker
docker model run hf.co/DhruvalLabs/gemma-4-12B-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use DhruvalLabs/gemma-4-12B-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "DhruvalLabs/gemma-4-12B-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DhruvalLabs/gemma-4-12B-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/DhruvalLabs/gemma-4-12B-GGUF:Q4_K_M
- SGLang
How to use DhruvalLabs/gemma-4-12B-GGUF 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 "DhruvalLabs/gemma-4-12B-GGUF" \ --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": "DhruvalLabs/gemma-4-12B-GGUF", "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 "DhruvalLabs/gemma-4-12B-GGUF" \ --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": "DhruvalLabs/gemma-4-12B-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use DhruvalLabs/gemma-4-12B-GGUF with Ollama:
ollama run hf.co/DhruvalLabs/gemma-4-12B-GGUF:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use DhruvalLabs/gemma-4-12B-GGUF with Docker Model Runner:
docker model run hf.co/DhruvalLabs/gemma-4-12B-GGUF:Q4_K_M
- Lemonade
How to use DhruvalLabs/gemma-4-12B-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull DhruvalLabs/gemma-4-12B-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.gemma-4-12B-GGUF-Q4_K_M
List all available models
lemonade list
- Atomic Chat
File size: 5,818 Bytes
7d10227 14bd113 7d10227 14bd113 0344b5a 14bd113 7d10227 0344b5a 7d10227 0344b5a 7d10227 0344b5a 7d10227 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | ---
license: apache-2.0
base_model: google/gemma-4-12B
pipeline_tag: image-text-to-text
tags:
- safetensors
- region:us
- vlm
- transformers
- multimodal
- gemma4_unified
- license:apache-2.0
- gguf
- vision
- quantized
- image-text-to-text
- any-to-any
language:
- en
---
<div align="center">
# gemma-4-12B β GGUF Quantizations (VLM)
[](https://huggingface.co/Dhptl/gemma-4-12B-GGUF)
[](https://huggingface.co/google/gemma-4-12B)
[](https://github.com/DhruvalPtl/quant-kit)
**Quantized GGUF versions of [google/gemma-4-12B](https://huggingface.co/google/gemma-4-12B)**
This is a **Vision-Language Model (VLM)** β it can understand both text and images.
Works with **[llama.cpp](https://github.com/ggerganov/llama.cpp)** Β· **[LM Studio](https://lmstudio.ai)** Β· **[Jan](https://jan.ai)** Β· **[Ollama](https://ollama.ai)**
*Quantized by **[Dhptl](https://huggingface.co/Dhptl)** on June 19, 2026 using [quant-kit](https://github.com/DhruvalPtl/quant-kit)*
</div>
---
> [!IMPORTANT]
> **This VLM requires TWO files** β a text backbone GGUF and the `mmproj` vision encoder GGUF.
> Download one text backbone (e.g. Q4_K_M) **and** the mmproj file. Both must be in the same folder.
---
## π¦ Available Files
### π€ Text Backbone (quantized β pick ONE)
| Filename | Size | RAM Required | Quant | Quality | Best For |
|---|---|---|---|---|---|
| `gemma-4-12B-Q2_K.gguf` | 4.50 GB | ~6.0 GB | `Q2_K` | β | Extreme compression, significant quality loss. |
| `gemma-4-12B-Q3_K_L.gguf` | 6.12 GB | ~7.6 GB | `Q3_K_L` | βββ | Slightly better than Q3_K_M, still a compromise. |
| `gemma-4-12B-Q3_K_M.gguf` | 5.67 GB | ~7.2 GB | `Q3_K_M` | βββ | Very small file. Quality drop noticeable. |
| `gemma-4-12B-Q3_K_S.gguf` | 5.15 GB | ~6.6 GB | `Q3_K_S` | ββ | Very high compression, high quality loss. |
| `gemma-4-12B-Q4_K_M.gguf` | 6.87 GB | ~8.4 GB | `Q4_K_M` β
**Recommended** | ββββ | Best balance of size and quality. Recommended for most users. |
| `gemma-4-12B-Q4_K_S.gguf` | 6.54 GB | ~8.0 GB | `Q4_K_S` | βββΒ½ | Good speed/size balance, slight quality loss. |
| `gemma-4-12B-Q5_K_M.gguf` | 7.96 GB | ~9.5 GB | `Q5_K_M` | ββββΒ½ | Better quality than Q4, slightly larger. Great if you have the RAM. |
| `gemma-4-12B-Q5_K_S.gguf` | 7.77 GB | ~9.3 GB | `Q5_K_S` | ββββ | Large but accurate. |
| `gemma-4-12B-Q6_K.gguf` | 9.11 GB | ~10.6 GB | `Q6_K` | βββββ | Near-perfect quality, very large. |
| `gemma-4-12B-Q8_0.gguf` | 11.80 GB | ~13.3 GB | `Q8_0` | βββββ | Closest to original quality. Use when RAM is not a concern. |
### πΌοΈ Vision Encoder β mmproj (always required, always F16)
| Filename | Size | Notes |
|---|---|---|
| `gemma-4-12B-mmproj-f16.gguf` | 0.11 GB | Always F16 β vision encoder is not quantized |
> β οΈ **You need BOTH files** β one text backbone + the mmproj β to run this VLM.
---
## β‘ Speed Benchmarks
*Run `python benchmark.py --model gemma-4-12B` to generate results.*
---
## π How to Use
### LM Studio (Easiest β GUI)
1. Search for `Dhptl/gemma-4-12B` in LM Studio
2. Download the Q4_K_M text file **and** the mmproj file
3. Load the model β LM Studio automatically uses both files
### Ollama
```bash
ollama run dhptl/gemma-4-12b
```
### llama.cpp CLI β Text + Image
```bash
# Download both files to the same directory, then:
./llama-llava-cli \
-m gemma-4-12B-Q4_K_M.gguf \
--mmproj gemma-4-12B-mmproj-f16.gguf \
--image /path/to/your/image.jpg \
-p "Describe this image in detail." \
-n 512
```
### llama.cpp CLI β Text only (no image)
```bash
./llama-cli \
-m gemma-4-12B-Q4_K_M.gguf \
-p "You are a helpful assistant." \
--conversation
```
### Python β llama-cpp-python
```python
from llama_cpp import Llama
from llama_cpp.llama_chat_format import Llava16ChatHandler
# Load VLM with mmproj
chat_handler = Llava16ChatHandler(clip_model_path="./gemma-4-12B-mmproj-f16.gguf")
llm = Llama(
model_path="./gemma-4-12B-Q4_K_M.gguf",
chat_handler=chat_handler,
n_gpu_layers=-1,
n_ctx=4096,
logits_all=True,
)
# Text + image inference
response = llm.create_chat_completion(
messages=[
{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}},
{"type": "text", "text": "What do you see in this image?"}
]
}
]
)
print(response["choices"][0]["message"]["content"])
```
---
## π VLM Architecture
This model uses a **two-component architecture**:
| Component | File | Purpose |
|---|---|---|
| **Text Backbone** | `gemma-4-12B-Q4_K_M.gguf` | Language understanding & generation |
| **Vision Encoder (mmproj)** | `gemma-4-12B-mmproj-f16.gguf` | Image feature extraction (always F16) |
> **Why is mmproj always F16?**
> The vision encoder maps image pixels to token embeddings. Quantizing it causes
> visible visual artifacts and degraded image understanding. It stays at F16 (half precision)
> which is already very efficient at ~1-2GB for most models.
---
## π About GGUF Quantization
| Format | Bits/weight | Quality |
|---|---|---|
| Q3_K_M | ~3.3 | βββ |
| Q4_K_M | ~4.5 | ββββ β recommended |
| Q5_K_M | ~5.6 | ββββΒ½ |
| Q8_0 | ~8.5 | βββββ |
---
## π¬ Community & Feedback
Found an issue? Open a **Discussion** in the Community tab.
If useful, please:
- β Star [quant-kit](https://github.com/DhruvalPtl/quant-kit) on GitHub
- π Like this model on HuggingFace |