Instructions to use aimanhaziq/gemma4-2b-coder-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 aimanhaziq/gemma4-2b-coder-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 aimanhaziq/gemma4-2b-coder-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf aimanhaziq/gemma4-2b-coder-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 aimanhaziq/gemma4-2b-coder-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf aimanhaziq/gemma4-2b-coder-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf aimanhaziq/gemma4-2b-coder-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf aimanhaziq/gemma4-2b-coder-GGUF:Q4_K_M
Use Docker
docker model run hf.co/aimanhaziq/gemma4-2b-coder-GGUF:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use aimanhaziq/gemma4-2b-coder-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "aimanhaziq/gemma4-2b-coder-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": "aimanhaziq/gemma4-2b-coder-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/aimanhaziq/gemma4-2b-coder-GGUF:Q4_K_M
- Ollama
How to use aimanhaziq/gemma4-2b-coder-GGUF with Ollama:
ollama run hf.co/aimanhaziq/gemma4-2b-coder-GGUF:Q4_K_M
- Unsloth Desktop
- Pi
How to use aimanhaziq/gemma4-2b-coder-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf aimanhaziq/gemma4-2b-coder-GGUF:Q4_K_M
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": "aimanhaziq/gemma4-2b-coder-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use aimanhaziq/gemma4-2b-coder-GGUF with Docker Model Runner:
docker model run hf.co/aimanhaziq/gemma4-2b-coder-GGUF:Q4_K_M
- Lemonade
How to use aimanhaziq/gemma4-2b-coder-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull aimanhaziq/gemma4-2b-coder-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.gemma4-2b-coder-GGUF-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use aimanhaziq/gemma4-2b-coder-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 aimanhaziq/gemma4-2b-coder-GGUF:Q4_K_M
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 aimanhaziq/gemma4-2b-coder-GGUF:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use aimanhaziq/gemma4-2b-coder-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf aimanhaziq/gemma4-2b-coder-GGUF:Q4_K_M
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 "aimanhaziq/gemma4-2b-coder-GGUF:Q4_K_M" \ --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"
Gemma 4 2B Coder (GGUF)
Quantized GGUF binary of aimanhaziq/gemma4-2b-coder for fast, lightweight local and edge inference via llama.cpp, Ollama, LM Studio, and Open-WebUI.
- Base Architecture: Google Gemma 4 (Effective 2B)
- Primary Specializations: Production Kubernetes manifests (Deployments, StatefulSets, Ingress, CRDs), idiomatic async Rust (Tokio, Axum, ownership patterns), and TypeScript/Web API backends.
- Quantization:
Q4_K_M(4-bit Medium: optimal trade-off preserving attention layer precision while minimizing footprint).
Model Files & Specifications
| Filename | Quant Type | File Size | Memory (VRAM / RAM) | Best For |
|---|---|---|---|---|
gemma4-2b-coder-Q4_K_M.gguf |
Q4_K_M | ~1.8 GB | ~2.5 GB peak | Edge devices, macOS Metal, low-spec cloud VMs, mobile |
1. Run with Ollama
Step 1: Create a Modelfile
Save the following as Modelfile in the folder where your .gguf file is stored:
FROM ./gemma4-2b-coder-Q4_K_M.gguf
TEMPLATE """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
{{ .Prompt }}
### Input:
{{ .System }}
### Response:
"""
PARAMETER stop "<end_of_turn>"
PARAMETER stop "### Instruction:"
PARAMETER stop "### Response:"
PARAMETER temperature 0.2
PARAMETER top_p 0.95
PARAMETER num_ctx 8192
Step 2: Build and Execute
# Build the local Ollama model
ollama create gemma4-coder -f Modelfile
# Run interactive prompt
ollama run gemma4-coder "Write a Rust function using Tokio to query a Kubernetes metrics endpoint."
2. Run with llama.cpp
Interactive CLI (llama-cli)
./llama-cli \
-m gemma4-2b-coder-Q4_K_M.gguf \
-p "Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n\n### Instruction:\nWrite a production-ready Kubernetes NetworkPolicy that restricts inbound traffic to port 8080 from pods labeled app: frontend.\n\n### Input:\n\n\n### Response:\n" \
-n 512 \
-c 8192 \
--temp 0.2 \
-ngl 99
(Use -ngl 99 to offload all layers to your GPU/Metal engine, or omit it to run entirely on CPU).
Standalone OpenAI-Compatible Server (llama-server)
./llama-server \
-m gemma4-2b-coder-Q4_K_M.gguf \
--port 8080 \
-c 8192 \
-ngl 99 \
--host 0.0.0.0
3. Training & Quantization Details
- Instruction Fine-Tuning Format: Alpaca template (
### Instruction:,### Input:,### Response:). - Quantization Toolchain:
llama.cpp(convert_hf_to_gguf.py->llama-quantize). - Context Length: Supports up to 8k native tokens.
- Downloads last month
- 205
4-bit