Upload scripts/p1_plots.sh with huggingface_hub
Browse files- scripts/p1_plots.sh +55 -0
scripts/p1_plots.sh
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Runs after p1_finish.sh: regenerate both plots WITH the eval points, upload,
|
| 3 |
+
# and print the final combined teardown verdict.
|
| 4 |
+
set -uo pipefail
|
| 5 |
+
cd "$(dirname "$0")"
|
| 6 |
+
export PATH=/root/Adhi/BluTrain/envv/bin:$PATH
|
| 7 |
+
source /root/Adhi/BluTrain/envv/bin/activate 2>/dev/null
|
| 8 |
+
REPO=unparallelled/BluScriptCP
|
| 9 |
+
L=p1_logs; M="$L/plots.log"
|
| 10 |
+
say(){ echo "[$(date -u +%H:%M:%S)] $*" | tee -a "$M" >&2; }
|
| 11 |
+
|
| 12 |
+
say "waiting for p1_finish to reach its verdict..."
|
| 13 |
+
FP=$(cat "$L/finish.pid" 2>/dev/null)
|
| 14 |
+
while ! grep -qa 'TEARDOWN VERDICT' "$L/finish.log" 2>/dev/null; do
|
| 15 |
+
[ -n "$FP" ] && ! kill -0 "$FP" 2>/dev/null && { say "p1_finish exited without a verdict"; break; }
|
| 16 |
+
sleep 30
|
| 17 |
+
done
|
| 18 |
+
|
| 19 |
+
mkdir -p plots_p1
|
| 20 |
+
say "generating plots"
|
| 21 |
+
python mk_p1_plots.py 2>&1 | tee -a "$M"
|
| 22 |
+
|
| 23 |
+
# did the eval points actually make it in?
|
| 24 |
+
for pl in 8192 16360; do
|
| 25 |
+
f="p1_eval_len${pl}/summary.csv"
|
| 26 |
+
if [ -f "$f" ]; then say " eval len $pl: $(tail -1 "$f")"
|
| 27 |
+
else say " eval len $pl: NO SUMMARY -- that series will be absent from the plot"; fi
|
| 28 |
+
done
|
| 29 |
+
|
| 30 |
+
up(){ [ -f "$1" ] || { say " MISSING $1"; return 1; }
|
| 31 |
+
hf upload "$REPO" "$1" "$2" >>"$L/upload.log" 2>&1
|
| 32 |
+
python - "$REPO" "$1" "$2" <<'VEOF'
|
| 33 |
+
import sys,os
|
| 34 |
+
from huggingface_hub import HfApi
|
| 35 |
+
w=os.path.getsize(sys.argv[2])
|
| 36 |
+
g={f.rfilename:(f.size or 0) for f in HfApi().repo_info(sys.argv[1],files_metadata=True).siblings}.get(sys.argv[3])
|
| 37 |
+
ok=(g==w); print((" VERIFIED " if ok else " *** FAILED ")+f"{sys.argv[3]} local={w:,} remote={g}")
|
| 38 |
+
sys.exit(0 if ok else 1)
|
| 39 |
+
VEOF
|
| 40 |
+
}
|
| 41 |
+
BAD=0
|
| 42 |
+
say "=== uploading plots ==="
|
| 43 |
+
up plots_p1/p1_lineage.png plots/p1_680m_lineage.png || BAD=$((BAD+1))
|
| 44 |
+
up plots_p1/p1_results.png plots/p1_680m_results.png || BAD=$((BAD+1))
|
| 45 |
+
up mk_p1_plots.py scripts/mk_p1_plots.py || BAD=$((BAD+1))
|
| 46 |
+
up p1_plots.sh scripts/p1_plots.sh || BAD=$((BAD+1))
|
| 47 |
+
[ -f "$L/finish.log" ] && { up "$L/finish.log" "logs/p1_finish.log" || BAD=$((BAD+1)); }
|
| 48 |
+
|
| 49 |
+
say "=== FINAL VERDICT ==="
|
| 50 |
+
PRIOR=$(grep -ac 'DO NOT TEAR DOWN' "$L/finish.log" 2>/dev/null); PRIOR=${PRIOR:-0}
|
| 51 |
+
if [ "$BAD" -eq 0 ] && [ "$PRIOR" -eq 0 ]; then
|
| 52 |
+
say "ALL UPLOADS VERIFIED (training + evals + plots) -- SAFE TO TEAR DOWN"
|
| 53 |
+
else
|
| 54 |
+
say "*** NOT CLEAN: $BAD plot upload failure(s), $PRIOR earlier failure(s) -- DO NOT TEAR DOWN ***"
|
| 55 |
+
fi
|