#!/usr/bin/env bash # harvest — one-shot pod setup. Idempotent; safe to re-run. # Fetches the self-contained runtime bundle + tools from the public HF repo. # No credentials, no build, no torch changes. set -uo pipefail RT="https://huggingface.co/PS4Research/harvest-runtime/resolve/main" W=/tmp/harvest mkdir -p "$W" echo "== GPU ==" nvidia-smi --query-gpu=name,compute_cap,memory.total --format=csv,noheader || { echo "NO GPU — abort"; exit 1; } echo "== python deps ==" python3 -c "import requests" 2>/dev/null || pip install -q requests echo "== runtime bundle (self-contained llama.cpp, sm_80+sm_120) ==" if [ -x "$W/portable-fat/run-server.sh" ]; then echo " cached" else curl -fsSL -o "$W/portable-fat.tar.gz" "$RT/portable-fat.tar.gz" tar xzf "$W/portable-fat.tar.gz" -C "$W" && rm -f "$W/portable-fat.tar.gz" [ -x "$W/portable-fat/run-server.sh" ] || { echo "bundle bad"; exit 1; } fi echo "== tools ==" curl -fsSL -o /tmp/bench-pod.py "$RT/bench-pod.py" curl -fsSL -o /tmp/sweep-all.sh "$RT/sweep-all.sh" curl -fsSL -o /tmp/pod-bootstrap.sh "$RT/pod-bootstrap.sh" echo "SETUP OK"