Instructions to use unsloth/gemma-4-12b-it-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use unsloth/gemma-4-12b-it-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 unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL
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 unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: ./llama-cli -hf unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL
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 unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: ./build/bin/llama-cli -hf unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL
Use Docker
docker model run hf.co/unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL
- LM Studio
- Jan
- vLLM
How to use unsloth/gemma-4-12b-it-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsloth/gemma-4-12b-it-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsloth/gemma-4-12b-it-GGUF", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL
- Ollama
How to use unsloth/gemma-4-12b-it-GGUF with Ollama:
ollama run hf.co/unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL
- Unsloth Desktop
- Pi
How to use unsloth/gemma-4-12b-it-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use unsloth/gemma-4-12b-it-GGUF with Docker Model Runner:
docker model run hf.co/unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL
- Lemonade
How to use unsloth/gemma-4-12b-it-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL
Run and chat with the model
lemonade run user.gemma-4-12b-it-GGUF-UD-Q4_K_XL
List all available models
lemonade list
- Hermes Agent
How to use unsloth/gemma-4-12b-it-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL
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 unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use unsloth/gemma-4-12b-it-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL
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 "unsloth/gemma-4-12b-it-GGUF:UD-Q4_K_XL" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Error downloading MTP model
I'm trying to download the MTP model using llama.cpp, but I'm getting this error:
Downloading mtp-gemma-4-12b-it.gguf 0%[K[1B
Downloading mmproj-BF16.gguf ── 6%[K[1B
[34m0.07.224.090[0m [31mE common_download_file_single_online: unable to rename file: C:\Users\diego.cache\huggingface\hub\models--unsloth--gemma-4-12b-it-GGUF\blobs\145db9094bc0f85f1701e255a2ed216dcc9800fc8bc8631ad00905b456bd451b.downloadInProgress to C:\Users\diego.cache\huggingface\hub\models--unsloth--gemma-4-12b-it-GGUF\blobs\145db9094bc0f85f1701e255a2ed216dcc9800fc8bc8631ad00905b456bd451b
[0m[34m0.07.224.096[0m [31mE common_download_file_single_online: download failed after 3 attempts
failed to download model from Hugging Face────────────────────────── 100%[K[3B
+1.
I manually downloaded the mtp gguf:
hf download unsloth/gemma-4-12b-it-GGUF --local-dir /home/user1/models/gemma4-12b --include "MTP/*Q8_0*"
and tried loading it with:
llama-server -m ${models}/gemma4-12b/gemma-4-12b-it-UD-Q8_K_XL.gguf -fit off -c 16384 -ngl 999 -ub 1024 -b 512 --temp 1 --min-p 0.1 --top-p 0.95 --top-k 64 --no-mmap -np 1 --model-draft ${models}/gemma4-12b/MTP/gemma-4-12b-it-Q8_0-MTP.gguf --spec-type draft-mtp --spec-draft-n-max 3 --verbose
Getting:
[...]
llama-swap-1 | 0.09.613.462 D sched_reserve: worst-case: n_tokens = 512, n_seqs = 1, n_outputs = 1
llama-swap-1 | 0.09.613.466 D graph_reserve: reserving a graph for ubatch with n_tokens = 1, n_seqs = 1, n_outputs = 1
llama-swap-1 | 0.09.614.479 I sched_reserve: Flash Attention was auto, set to enabled
llama-swap-1 | 0.09.614.496 I sched_reserve: resolving fused Gated Delta Net support:
llama-swap-1 | 0.09.614.498 D graph_reserve: reserving a graph for ubatch with n_tokens = 1, n_seqs = 1, n_outputs = 1
llama-swap-1 | 0.09.615.415 I sched_reserve: fused Gated Delta Net (autoregressive) enabled
llama-swap-1 | 0.09.615.437 D graph_reserve: reserving a graph for ubatch with n_tokens = 16, n_seqs = 1, n_outputs = 16
llama-swap-1 | 0.09.616.391 I sched_reserve: fused Gated Delta Net (chunked) enabled
llama-swap-1 | 0.09.616.415 D graph_reserve: reserving a graph for ubatch with n_tokens = 512, n_seqs = 1, n_outputs = 4
llama-swap-1 | 0.09.692.762 D ggml_cuda_host_malloc: failed to allocate 32.52 MiB of pinned memory: out of memory
llama-swap-1 | 0.09.692.925 D graph_reserve: reserving a graph for ubatch with n_tokens = 1, n_seqs = 1, n_outputs = 1
llama-swap-1 | 0.09.694.765 D graph_reserve: reserving a graph for ubatch with n_tokens = 512, n_seqs = 1, n_outputs = 4
llama-swap-1 | 0.09.696.225 I sched_reserve: CUDA0 compute buffer size = 139.52 MiB
llama-swap-1 | 0.09.696.250 I sched_reserve: CUDA_Host compute buffer size = 32.52 MiB
[...]
llama-swap-1 | 0.10.149.165 I llama_prepare_model_devices: using device CUDA0 (NVIDIA GeForce RTX 3080 Laptop GPU) (0000:01:00.0) - 0 MiB free
[...]
llama-swap-1 | 0.10.699.523 E llama_model_load: error loading model: vector::_M_range_check: __n (which is 1) >= this->size() (which is 1)
llama-swap-1 | 0.10.699.559 E llama_model_load_from_file_impl: failed to load model
llama-swap-1 | 0.10.699.564 E srv load_model: failed to load draft model, '/models/gemma4-12b/MTP/gemma-4-12b-it-Q8_0-MTP.gguf'
llama-swap-1 | 0.10.699.575 I srv operator(): operator(): cleaning up before exit...
llama-swap-1 | 0.10.701.546 E srv llama_server: exiting due to model loading error
llama-swap-1 | 0.10.701.672 D ~llama_context: CUDA0 compute buffer size is 139.5177 MiB, matches expectation of 139.5177 MiB
llama-swap-1 | 0.10.701.674 D ~llama_context: CUDA_Host compute buffer size is 32.5196 MiB, matches expectation of 32.5196 MiB
[...]
./llama-server --version
version: 9590 (d2462f8f7)
built with GNU 11.4.0 for Linux x86_64
Nvidia RTX 3080 t1, 16Gb VRAM
Please disregard my message above: turns out there was something using VRAM that i was not aware of. After restarting MTP works correctly. Getting 44tps vs 25 without MTP. Nice. Thanks you!
Please disregard my message above: turns out there was something using VRAM that i was not aware of. After restarting MTP works correctly. Getting 44tps vs 25 without MTP. Nice. Thanks you!
Thanks anyway, I managed to get it working, although I'm not seeing the same improvement in T/S as you at the moment.

