#!/bin/bash
# Gemma 4 Server Startup Script
# Generated for Ezra wizard house

MODEL_PATH=/root/wizards/ezra/home/models/gemma4/gemma-4-31B-it-Q4_K_M.gguf
LLAMA_SERVER=/usr/local/bin/llama-server
PORT=11435
THREADS=4
CONTEXT=16384

echo "Starting Gemma 4 Server..."
echo "Model: $MODEL_PATH"
echo "Port: $PORT"
echo ""

# Check if llama-server exists, if not, print instructions
if [ ! -f "$LLAMA_SERVER" ]; then
    echo "ERROR: llama-server not found at $LLAMA_SERVER"
    echo ""
    echo "To install:"
    echo "  git clone --depth 1 https://github.com/ggerganov/llama.cpp.git"
    echo "  cd llama.cpp && cmake -B build && cmake --build build --target llama-server"
    echo "  cp build/bin/llama-server /usr/local/bin/"
    exit 1
fi

exec $LLAMA_SERVER \
    -m "$MODEL_PATH" \
    --host 127.0.0.1 \
    --port $PORT \
    -c $CONTEXT \
    -n 4096 \
    --jinja \
    -t $THREADS
