Instructions to use thanglq150188/gemma4-e4b-mini 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 thanglq150188/gemma4-e4b-mini 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 thanglq150188/gemma4-e4b-mini:Q8_0 # Run inference directly in the terminal: llama cli -hf thanglq150188/gemma4-e4b-mini:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf thanglq150188/gemma4-e4b-mini:Q8_0 # Run inference directly in the terminal: llama cli -hf thanglq150188/gemma4-e4b-mini:Q8_0
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 thanglq150188/gemma4-e4b-mini:Q8_0 # Run inference directly in the terminal: ./llama-cli -hf thanglq150188/gemma4-e4b-mini:Q8_0
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 thanglq150188/gemma4-e4b-mini:Q8_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf thanglq150188/gemma4-e4b-mini:Q8_0
Use Docker
docker model run hf.co/thanglq150188/gemma4-e4b-mini:Q8_0
- LM Studio
- Jan
- vLLM
How to use thanglq150188/gemma4-e4b-mini with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "thanglq150188/gemma4-e4b-mini" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "thanglq150188/gemma4-e4b-mini", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/thanglq150188/gemma4-e4b-mini:Q8_0
- Ollama
How to use thanglq150188/gemma4-e4b-mini with Ollama:
ollama run hf.co/thanglq150188/gemma4-e4b-mini:Q8_0
- Unsloth Studio
How to use thanglq150188/gemma4-e4b-mini with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for thanglq150188/gemma4-e4b-mini to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for thanglq150188/gemma4-e4b-mini to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for thanglq150188/gemma4-e4b-mini to start chatting
- Pi
How to use thanglq150188/gemma4-e4b-mini with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf thanglq150188/gemma4-e4b-mini:Q8_0
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "thanglq150188/gemma4-e4b-mini:Q8_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use thanglq150188/gemma4-e4b-mini with Docker Model Runner:
docker model run hf.co/thanglq150188/gemma4-e4b-mini:Q8_0
- Lemonade
How to use thanglq150188/gemma4-e4b-mini with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull thanglq150188/gemma4-e4b-mini:Q8_0
Run and chat with the model
lemonade run user.gemma4-e4b-mini-Q8_0
List all available models
lemonade list
- Hermes Agent
How to use thanglq150188/gemma4-e4b-mini with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf thanglq150188/gemma4-e4b-mini:Q8_0
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 thanglq150188/gemma4-e4b-mini:Q8_0
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use thanglq150188/gemma4-e4b-mini with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf thanglq150188/gemma4-e4b-mini:Q8_0
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 "thanglq150188/gemma4-e4b-mini:Q8_0" \ --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"
| license: gemma | |
| base_model: principled-intelligence/gemma-4-E4B-it-text-only | |
| language: | |
| - en | |
| - vi | |
| tags: | |
| - gguf | |
| - llama.cpp | |
| - gemma4 | |
| - vocab-pruned | |
| pipeline_tag: text-generation | |
| # Gemma-4 E4B (EN+VI vocab-pruned) — Q8_0 GGUF | |
| Vocabulary-pruned build of [principled-intelligence/gemma-4-E4B-it-text-only](https://huggingface.co/principled-intelligence/gemma-4-E4B-it-text-only): the token vocabulary is reduced to 69,246 entries covering English + Vietnamese, shrinking the embedding/LM-head so the q8_0 model fits comfortably on a 12 GB consumer GPU (~5.0 GB VRAM for weights, ~60 tok/s single-stream on an RTX 3060). | |
| | | | | |
| |---|---| | |
| | **Format** | GGUF `q8_0` (5.2 GB) | | |
| | **Architecture** | Gemma-4 E4B text-only — 42 layers, hidden 2560, per-layer input embeddings, sliding+full hybrid attention | | |
| | **Vocab** | 69,246 (EN+VI pruned) | | |
| | **Context** | 131,072 tokens | | |
| | **Chat template** | Gemma-4 `<|turn>` format — **must** use the bundled `gemma4_chat.jinja` | | |
| ## Requirements | |
| - **GPU path**: NVIDIA GPU with ≥ 8 GB VRAM (12 GB recommended for long context), recent NVIDIA driver, and — for Docker — [nvidia-container-toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html). | |
| - **CPU path**: works too (llama.cpp CPU build), just slower; needs ~6 GB free RAM. | |
| - To download: `pip install -U huggingface_hub` (gives you the `hf` CLI). No Python libraries are needed to *serve* — llama.cpp is self-contained. | |
| ## 1. Download the model | |
| ```bash | |
| hf download thanglq150188/gemma4-e4b-mini \ | |
| --local-dir ./models | |
| # -> ./models/gemma4-e4b-envi-pruned-q8_0.gguf | |
| # -> ./models/gemma4_chat.jinja | |
| ``` | |
| ## 2. Serve | |
| ### Option A — Docker (recommended, this is the tested production setup) | |
| Uses the official llama.cpp server image with CUDA: | |
| ```bash | |
| docker run -d --name gemma4-e4b \ | |
| --gpus all \ | |
| -p 8080:8080 \ | |
| -v "$(pwd)/models:/models" \ | |
| ghcr.io/ggml-org/llama.cpp:server-cuda \ | |
| -m /models/gemma4-e4b-envi-pruned-q8_0.gguf \ | |
| --host 0.0.0.0 --port 8080 \ | |
| -ngl 99 -c 131072 -np 16 \ | |
| -fa on --cache-reuse 256 \ | |
| --jinja --chat-template-file /models/gemma4_chat.jinja | |
| ``` | |
| Flag meanings, tune to taste: | |
| - `-ngl 99` — offload all layers to GPU | |
| - `-c 131072` — context window (lower, e.g. `-c 16384`, to save VRAM) | |
| - `-np 16` — 16 parallel request slots (server throughput; each slot splits the context) | |
| - `-fa on` — flash attention | |
| - `--cache-reuse 256` — prefix-cache reuse across requests (big win for shared system prompts) | |
| - `--jinja --chat-template-file ...` — **required**: applies the Gemma-4 `<|turn>` chat template; without it the model receives a wrong prompt format and quality collapses | |
| For CPU-only, use the `ghcr.io/ggml-org/llama.cpp:server` image and drop `--gpus all` and `-ngl 99`. | |
| ### Option B — Native llama.cpp binary (no Docker) | |
| ```bash | |
| # prebuilt releases: https://github.com/ggml-org/llama.cpp/releases (or build with cmake) | |
| llama-server -m ./models/gemma4-e4b-envi-pruned-q8_0.gguf \ | |
| --host 0.0.0.0 --port 8080 -ngl 99 -c 131072 -np 16 \ | |
| -fa on --cache-reuse 256 --jinja \ | |
| --chat-template-file ./models/gemma4_chat.jinja | |
| ``` | |
| ## 3. Call it (OpenAI-compatible API) | |
| `llama-server` exposes an OpenAI-compatible endpoint at `/v1`: | |
| ```bash | |
| curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{ | |
| "messages": [ | |
| {"role": "user", "content": "Xin chào! Tóm tắt giúp tôi lợi ích của điện gió ngoài khơi."} | |
| ], | |
| "max_tokens": 256, "temperature": 0.7 | |
| }' | |
| ``` | |
| Or from Python: | |
| ```python | |
| from openai import OpenAI | |
| client = OpenAI(base_url="http://localhost:8080/v1", api_key="none") | |
| resp = client.chat.completions.create( | |
| model="gemma4-e4b", # name is ignored by llama-server, any string works | |
| messages=[{"role": "user", "content": "Việt Nam có bao nhiêu tỉnh thành?"}], | |
| max_tokens=256, | |
| ) | |
| print(resp.choices[0].message.content) | |
| ``` | |
| Health check: `curl http://localhost:8080/health` → `{"status":"ok"}` when the model is loaded. | |
| ## Caveats | |
| - Text-only (vision tower removed in the upstream text-only base). | |
| - Because the vocab is pruned to EN+VI, tokenization of other languages degrades (falls back to byte pieces) — expect worse quality and higher token counts outside English/Vietnamese. | |
| - The bundled `gemma4_chat.jinja` is mandatory; Gemma-3-style `start_of_turn` templates will not work with Gemma-4's `<|turn>` tokens. | |