#!/usr/bin/env bash # Wait for the next .pt checkpoint to appear under , then run probe. # Usage: probe_when_ready.sh set -euo pipefail RUN_DIR="${1:?run_dir}" MODEL="${2:?model letter A|B|C|F}" PTBXL="${3:?ptbxl npz path}" OUT="${4:?output json}" echo "[probe] waiting for ckpt in $RUN_DIR" while :; do CKPT=$(ls -t "$RUN_DIR"/*.pt 2>/dev/null | head -1 || true) if [ -n "$CKPT" ] && [ -f "$PTBXL" ]; then echo "[probe] ckpt=$CKPT, ptbxl=$PTBXL — running" cd /workspace/PhysioJEPA PYTHONPATH=src /usr/bin/python3 -u scripts/eval_checkpoint.py \ --ckpt "$CKPT" --model "$MODEL" --ptbxl_npz "$PTBXL" --out "$OUT" echo "[probe] done -> $OUT" cat "$OUT" break fi sleep 10 done