Instructions to use Neohosseinism/gemma4-stack 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 Neohosseinism/gemma4-stack 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 Neohosseinism/gemma4-stack:Q4_K_M # Run inference directly in the terminal: llama cli -hf Neohosseinism/gemma4-stack:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Neohosseinism/gemma4-stack:Q4_K_M # Run inference directly in the terminal: llama cli -hf Neohosseinism/gemma4-stack: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 Neohosseinism/gemma4-stack:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Neohosseinism/gemma4-stack: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 Neohosseinism/gemma4-stack:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Neohosseinism/gemma4-stack:Q4_K_M
Use Docker
docker model run hf.co/Neohosseinism/gemma4-stack:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use Neohosseinism/gemma4-stack with Ollama:
ollama run hf.co/Neohosseinism/gemma4-stack:Q4_K_M
- Unsloth Studio
How to use Neohosseinism/gemma4-stack 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 Neohosseinism/gemma4-stack 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 Neohosseinism/gemma4-stack to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Neohosseinism/gemma4-stack to start chatting
- Pi
How to use Neohosseinism/gemma4-stack with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Neohosseinism/gemma4-stack:Q4_K_M
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": "Neohosseinism/gemma4-stack:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- OpenClaw new
How to use Neohosseinism/gemma4-stack with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Neohosseinism/gemma4-stack: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 "Neohosseinism/gemma4-stack: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"
- Docker Model Runner
How to use Neohosseinism/gemma4-stack with Docker Model Runner:
docker model run hf.co/Neohosseinism/gemma4-stack:Q4_K_M
- Lemonade
How to use Neohosseinism/gemma4-stack with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Neohosseinism/gemma4-stack:Q4_K_M
Run and chat with the model
lemonade run user.gemma4-stack-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use Neohosseinism/gemma4-stack with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Neohosseinism/gemma4-stack: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 Neohosseinism/gemma4-stack:Q4_K_M
Run Hermes
hermes
- Atomic Chat
| # End-to-end smoke tests for the Gemma 4 stack. Exit non-zero if anything fails. | |
| # ./scripts/e2e-test.sh | |
| # Env overrides: LS=http://localhost:8080 EMB=http://localhost:8081 | |
| # RRK=http://localhost:8082 OWUI=http://localhost:3000 | |
| # MODEL=gemma-e4b TEST_WAV=/path/clip.wav TEST_IMG=/path/img.png | |
| set -u | |
| LS="${LS:-http://localhost:8080}" | |
| EMB="${EMB:-http://localhost:8081}" | |
| RRK="${RRK:-http://localhost:8082}" | |
| OWUI="${OWUI:-http://localhost:3000}" | |
| MODEL="${MODEL:-gemma-e4b}" | |
| # Auto-use the bundled demo assets so `make test` needs no setup. | |
| ROOT="$(cd "$(dirname "$0")/.." && pwd)" | |
| TEST_IMG="${TEST_IMG:-$ROOT/assets/test_image.png}" | |
| TEST_WAV="${TEST_WAV:-$ROOT/assets/test_audio_en.wav}" | |
| PASS=0; FAIL=0 | |
| ok(){ echo " ✅ $1"; PASS=$((PASS+1)); } | |
| no(){ echo " ❌ $1"; FAIL=$((FAIL+1)); } | |
| hdr(){ echo; echo "== $1 =="; } | |
| jqget(){ python3 -c "import sys,json;d=json.load(sys.stdin);print(eval(sys.argv[1]))" "$1" 2>/dev/null; } | |
| hdr "1) llama-swap lists model profiles" | |
| MODELS=$(curl -fsS "$LS/v1/models" 2>/dev/null) | |
| echo "$MODELS" | grep -q "$MODEL" && ok "model '$MODEL' present" || no "model '$MODEL' missing" | |
| hdr "2) Gemma text chat (Persian)" | |
| RESP=$(curl -fsS "$LS/v1/chat/completions" -H 'Content-Type: application/json' -d \ | |
| "{\"model\":\"$MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"به فارسی یک جمله کوتاه بنویس.\"}],\"max_tokens\":512,\"temperature\":1.0}" 2>/dev/null) | |
| TXT=$(echo "$RESP" | jqget "(d['choices'][0]['message'].get('content') or d['choices'][0]['message'].get('reasoning_content') or '')") | |
| [ -n "$TXT" ] && ok "got reply: ${TXT:0:60}" || no "no text reply ($RESP)" | |
| hdr "3) Gemma vision (image)" | |
| if [ -n "$TEST_IMG" ] && [ -f "$TEST_IMG" ]; then | |
| python3 -c "import json,base64;b=base64.b64encode(open('$TEST_IMG','rb').read()).decode();json.dump({'model':'$MODEL','messages':[{'role':'user','content':[{'type':'text','text':'Describe this image in one short sentence.'},{'type':'image_url','image_url':{'url':'data:image/png;base64,'+b}}]}],'max_tokens':512},open('/tmp/e2e_img.json','w'))" | |
| R=$(curl -s -m 600 "$LS/v1/chat/completions" -H 'Content-Type: application/json' -d @/tmp/e2e_img.json 2>/dev/null) | |
| V=$(echo "$R" | jqget "(d['choices'][0]['message'].get('content') or d['choices'][0]['message'].get('reasoning_content') or '')") | |
| [ -n "$V" ] && ok "vision reply: ${V:0:60}" || no "no vision reply ($R)" | |
| else | |
| echo " ⏭ skipped (set TEST_IMG=/path/img.png)" | |
| fi | |
| hdr "4) Gemma native audio (input_audio)" | |
| if [ -n "$TEST_WAV" ] && [ -f "$TEST_WAV" ]; then | |
| python3 -c "import json,base64;b=base64.b64encode(open('$TEST_WAV','rb').read()).decode();json.dump({'model':'$MODEL','messages':[{'role':'user','content':[{'type':'text','text':'Transcribe this audio exactly.'},{'type':'input_audio','input_audio':{'data':b,'format':'wav'}}]}],'max_tokens':512,'temperature':1.0},open('/tmp/e2e_aud.json','w'))" | |
| R=$(curl -s -m 1500 "$LS/v1/chat/completions" -H 'Content-Type: application/json' -d @/tmp/e2e_aud.json 2>/dev/null) | |
| A=$(echo "$R" | jqget "(d['choices'][0]['message'].get('content') or d['choices'][0]['message'].get('reasoning_content') or '')") | |
| [ -n "$A" ] && ok "audio reply: ${A:0:80}" || no "no audio reply ($R)" | |
| else | |
| echo " ⏭ skipped (set TEST_WAV=/path/clip.wav)" | |
| fi | |
| hdr "5) TEI embeddings (Persian)" | |
| R=$(curl -fsS "$EMB/v1/embeddings" -H 'Content-Type: application/json' -d \ | |
| '{"model":"x","input":["پایتخت ایران تهران است"]}' 2>/dev/null) | |
| DIM=$(echo "$R" | jqget "len(d['data'][0]['embedding'])") | |
| [ -n "$DIM" ] && [ "$DIM" -gt 0 ] 2>/dev/null && ok "embedding dim=$DIM" || no "no embedding ($R)" | |
| hdr "6) TEI rerank (Persian relevance ordering)" | |
| R=$(curl -fsS "$RRK/rerank" -H 'Content-Type: application/json' -d \ | |
| '{"query":"پایتخت ایران کجاست؟","texts":["تهران پایتخت ایران است.","موز یک میوه است."]}' 2>/dev/null) | |
| TOP=$(echo "$R" | python3 -c "import sys,json;d=json.load(sys.stdin);d=sorted(d,key=lambda x:-x['score']);print(d[0]['index'])" 2>/dev/null) | |
| [ "$TOP" = "0" ] && ok "relevant text ranked first" || no "rerank wrong/failed (top=$TOP, $R)" | |
| hdr "7) Open WebUI reachable" | |
| CODE=$(curl -s -o /dev/null -w "%{http_code}" "$OWUI/health" 2>/dev/null) | |
| [ "$CODE" = "200" ] && ok "Open WebUI /health 200" || no "Open WebUI not healthy (HTTP $CODE)" | |
| echo; echo "==================================================" | |
| echo " RESULT: $PASS passed, $FAIL failed" | |
| echo "==================================================" | |
| [ "$FAIL" -eq 0 ] | |