#!/bin/zsh # End-to-end run: offline checks -> generation for 4 conditions (time-budgeted, <= ~38 min) -> analysis. # No network needed: both models must already be in the Hugging Face cache. set -euo pipefail setopt NO_BG_NICE # zsh would otherwise renice background jobs, skewing timings cd "${0:A:h}" PY=/opt/homebrew/Caskroom/miniconda/base/bin/python export HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 HF_DATASETS_OFFLINE=1 TOKENIZERS_PARALLELISM=false LIMIT_S=${LIMIT_S:-2280} # hard stop for generation (38 min); run_bench.py budgets itself to 36.5 min echo "== $(date '+%F %T') offline checks" $PY test_offline.py $PY run_bench.py --dry-run echo "== $(date '+%F %T') generation" rm -rf raw review scored_rows.jsonl results.json caffeinate -i -w $$ & # keep the machine awake for the run $PY run_bench.py "$@" 2>&1 | tee run.log & BENCH=$! ( sleep $LIMIT_S; echo "watchdog: stopping generation after ${LIMIT_S}s"; pkill -f "run_bench.py" ) & WATCHDOG=$! wait $BENCH || true pkill -P $WATCHDOG 2>/dev/null || true; kill $WATCHDOG 2>/dev/null || true echo "== $(date '+%F %T') analysis" $PY analyze.py echo "== $(date '+%F %T') done: results.json"