Instructions to use Mediform/gemma4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use Mediform/gemma4 with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Mediform/gemma4", filename="gemma-4-E4B-it-ckpt500-Q4_K_M.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Mediform/gemma4 with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Mediform/gemma4:Q4_K_M # Run inference directly in the terminal: llama-cli -hf Mediform/gemma4:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Mediform/gemma4:Q4_K_M # Run inference directly in the terminal: llama-cli -hf Mediform/gemma4: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 Mediform/gemma4:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Mediform/gemma4: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 Mediform/gemma4:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Mediform/gemma4:Q4_K_M
Use Docker
docker model run hf.co/Mediform/gemma4:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use Mediform/gemma4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Mediform/gemma4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mediform/gemma4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Mediform/gemma4:Q4_K_M
- Ollama
How to use Mediform/gemma4 with Ollama:
ollama run hf.co/Mediform/gemma4:Q4_K_M
- Unsloth Studio
How to use Mediform/gemma4 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 Mediform/gemma4 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 Mediform/gemma4 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Mediform/gemma4 to start chatting
- Docker Model Runner
How to use Mediform/gemma4 with Docker Model Runner:
docker model run hf.co/Mediform/gemma4:Q4_K_M
- Lemonade
How to use Mediform/gemma4 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Mediform/gemma4:Q4_K_M
Run and chat with the model
lemonade run user.gemma4-Q4_K_M
List all available models
lemonade list
gemma-4-E4B-it β text-finetuned (QLoRA) β GGUF
GGUF export of a QLoRA fine-tune of gemma-4-E4B-it, quantized to Q4_K_M for
llama.cpp. The fine-tune targets text
generation (German medical domain); the multimodal audio (and vision) capabilities
are inherited unchanged from the base model.
Files
| File | Size | Description |
|---|---|---|
gemma-4-E4B-it-ckpt500-Q4_K_M.gguf |
5.0 GB | Language model. Base gemma-4-E4B-it with the text-generation QLoRA adapter (checkpoint-500) merged in, quantized to Q4_K_M. |
mmproj-gemma-4-E4B-it-BF16.gguf |
946 MB | Multimodal projector (BF16) β audio + vision encoders. Required for audio/image input. Not fine-tuned. |
β οΈ Chat template / system prompt (important)
The base gemma-4-E4B-it is a reasoning model: its original chat template auto-enables a
<channel>thought reasoning trace whenever the first message has role system or developer.
For a JSON-only extraction task this looks like "gibberish" (the model emits a thinking trace
instead of the JSON). This GGUF ships a corrected chat template that folds any
system/developer message into the first user turn and never enables thinking β so the
model answers directly. Just deploy normally with --jinja:
# Text + audio
llama-server -m gemma-4-E4B-it-ckpt500-Q4_K_M.gguf \
--mmproj mmproj-gemma-4-E4B-it-BF16.gguf --jinja
# Text only
llama-cli -m gemma-4-E4B-it-ckpt500-Q4_K_M.gguf --jinja -st -sysf system.txt -f user.txt
system + user chat-completions requests now return the trained JSON directly.
(If you ever use the base model's template instead, send the instructions in the user
message β do not use a system role β to avoid the reasoning trace.)
What is and isn't fine-tuned
- β Text generation β QLoRA adapter (rank 8, checkpoint-500) merged into the language model.
- β Audio / vision β base
mmprojencoders, unchanged.
Provenance
- Base model:
unsloth/gemma-4-E4B-it(16-bit). - Adapter: LoRA r=8, Ξ±=8, checkpoint-500.
- Export: adapter β GGUF (
convert_lora_to_gguf.py) β merged into base text GGUF (llama-export-lora) β quantizedQ4_K_M(llama-quantize) β chat template corrected (gguf_new_metadata.py).
- Downloads last month
- 56
4-bit