hatchimera / scripts /start-local-real-model.sh
arkai2025's picture
refactor(runtime): single Gemma 4 12B model + Hatchimera rename
b6ded85
Raw
History Blame Contribute Delete
1.51 kB
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
PYTHON_BIN="${PYTHON_BIN:-$ROOT_DIR/.venv/bin/python}"
if [[ ! -x "$PYTHON_BIN" ]]; then
PYTHON_BIN="${PYTHON_BIN_FALLBACK:-python3}"
fi
export BUDDY_FORCE_FAKE_RUNTIME=0
# The app runs a single model: Gemma 4 12B (runtime.py FREEFORM_MODEL_*). Point
# BUDDY_MODEL_PATH at a local gguf, or BUDDY_FREEFORM_MODEL_REPO/_FILE at another
# repo, to override.
MODEL_REPO="${BUDDY_FREEFORM_MODEL_REPO:-unsloth/gemma-4-12b-it-GGUF}"
MODEL_FILE="${BUDDY_FREEFORM_MODEL_FILE:-gemma-4-12b-it-Q4_K_M.gguf}"
if [[ -n "${BUDDY_MODEL_PATH:-}" && ! -f "$BUDDY_MODEL_PATH" ]]; then
printf 'BUDDY_MODEL_PATH does not exist: %s\n' "$BUDDY_MODEL_PATH" >&2
exit 2
fi
if [[ "${BUDDY_SKIP_MODEL_PREFLIGHT:-0}" != "1" ]]; then
"$PYTHON_BIN" - <<'PY'
import importlib.util
import os
import sys
missing = []
if importlib.util.find_spec("llama_cpp") is None:
missing.append("llama_cpp")
if not os.getenv("BUDDY_MODEL_PATH") and importlib.util.find_spec("huggingface_hub") is None:
missing.append("huggingface_hub")
if missing:
print(f"Missing Python package(s): {', '.join(missing)}", file=sys.stderr)
print("Install with: .venv/bin/python -m pip install -r requirements.txt", file=sys.stderr)
raise SystemExit(2)
PY
fi
cat <<EOF
Hatchimera real-model mode
Runtime:
BUDDY_FORCE_FAKE_RUNTIME=0
Model:
${BUDDY_MODEL_PATH:-$MODEL_REPO / $MODEL_FILE}
EOF
exec "$ROOT_DIR/scripts/start-local.sh"