Upload scripts/teardown_upload.sh with huggingface_hub
Browse files- scripts/teardown_upload.sh +91 -0
scripts/teardown_upload.sh
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# =============================================================================
|
| 3 |
+
# Teardown upload for the cont64k full-epoch run -- VERIFIED.
|
| 4 |
+
#
|
| 5 |
+
# Runs while PHASE 3 eval is still going, so the irreplaceable artifacts are
|
| 6 |
+
# durable before anything can go wrong. It deliberately does NOT touch the
|
| 7 |
+
# cont64k_len_* eval directories: those are being written right now, and the
|
| 8 |
+
# script's own PHASE 4 uploads them when they are complete.
|
| 9 |
+
#
|
| 10 |
+
# WHY EVERY FILE IS SIZE-CHECKED AGAINST HF: on 2026-09-10 the upload helper
|
| 11 |
+
# was `up(){ [ -e "$1" ] || return 0; ... }` -- it returned SUCCESS when the
|
| 12 |
+
# source was missing. ~17 GB of checkpoints silently never left the box, the
|
| 13 |
+
# CLI never errored, and the instance was torn down. Only a 61-byte pointer
|
| 14 |
+
# file survived. An "ok" from the CLI is NOT proof; only the byte size that HF
|
| 15 |
+
# reports back is.
|
| 16 |
+
#
|
| 17 |
+
# WHY ALL 8 RANKS: rank_0's .ckpt alone is enough to branch from (weights are
|
| 18 |
+
# replicated, and CP_INIT_FROM is how every topology change in this project has
|
| 19 |
+
# been done). But an EXACT resume at 8 ranks needs each rank's own .ckpt (it
|
| 20 |
+
# carries that rank's ZeRO group-0 shard) AND its .zero_g1. After teardown
|
| 21 |
+
# nothing is recoverable, so all 16 files go up -- 30.9 GB.
|
| 22 |
+
# =============================================================================
|
| 23 |
+
set -uo pipefail
|
| 24 |
+
cd "$(dirname "$0")"
|
| 25 |
+
source /root/gv/envv/bin/activate
|
| 26 |
+
HF=/root/gv/envv/bin/hf
|
| 27 |
+
PY=/root/gv/envv/bin/python3
|
| 28 |
+
REPO=unparallelled/BluScriptCP
|
| 29 |
+
CKD=checkpoints_bluscriptcp
|
| 30 |
+
RUN=4; STEP=1651
|
| 31 |
+
L=teardown_upload.log; : > "$L"
|
| 32 |
+
say(){ echo "[$(date -u +%H:%M:%S)] $*" | tee -a "$L" >&2; }
|
| 33 |
+
|
| 34 |
+
MANIFEST=/tmp/teardown_manifest.txt; : > "$MANIFEST"
|
| 35 |
+
|
| 36 |
+
up(){ # src dst -- records src/dst for the verification pass
|
| 37 |
+
local src=$1 dst=$2
|
| 38 |
+
if [ ! -e "$src" ]; then say " MISSING SOURCE (NOT UPLOADED): $src"; echo "MISSING|$src|$dst" >> "$MANIFEST"; return 1; fi
|
| 39 |
+
local sz="-"; [ -f "$src" ] && sz=$(stat -c%s "$src")
|
| 40 |
+
say " -> $dst ${sz}"
|
| 41 |
+
if $HF upload "$REPO" "$src" "$dst" >>"$L" 2>&1; then
|
| 42 |
+
[ -f "$src" ] && echo "FILE|$src|$dst" >> "$MANIFEST" || echo "DIR|$src|$dst" >> "$MANIFEST"
|
| 43 |
+
else
|
| 44 |
+
say " CLI FAILED"; echo "FAILED|$src|$dst" >> "$MANIFEST"; return 1
|
| 45 |
+
fi
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
say "=== 1. the model (8 ranks x .ckpt + .zero_g1) ==="
|
| 49 |
+
for r in 0 1 2 3 4 5 6 7; do
|
| 50 |
+
up "$CKD/rank_$r/blumodelcp_run${RUN}_step_${STEP}.ckpt" "checkpoints/cont64k_b5_rank${r}_step_${STEP}.ckpt"
|
| 51 |
+
up "$CKD/rank_$r/blumodelcp_run${RUN}_step_${STEP}.zero_g1" "checkpoints/cont64k_b5_rank${r}_step_${STEP}.zero_g1"
|
| 52 |
+
done
|
| 53 |
+
|
| 54 |
+
say "=== 2. training logs + the script that produced them ==="
|
| 55 |
+
up cont64k_logs/master.log "logs/cont64k/master.log"
|
| 56 |
+
up cont64k_logs/cont.log "logs/cont64k/cont.log"
|
| 57 |
+
up cont64k_logs/probe.log "logs/cont64k/probe.log"
|
| 58 |
+
up cont64k_b5_h100.sh "scripts/cont64k_b5_h100.sh"
|
| 59 |
+
up "$(basename "$0")" "scripts/$(basename "$0")"
|
| 60 |
+
|
| 61 |
+
say "=== 3. VERIFY every upload against the size HF reports back ==="
|
| 62 |
+
$PY - "$REPO" "$MANIFEST" <<'PYEOF' | tee -a "$L"
|
| 63 |
+
import sys, os
|
| 64 |
+
from huggingface_hub import HfApi
|
| 65 |
+
repo, man = sys.argv[1], sys.argv[2]
|
| 66 |
+
remote = {f.rfilename: (f.size or 0) for f in HfApi().repo_info(repo, files_metadata=True).siblings}
|
| 67 |
+
rows = [l.rstrip("\n").split("|", 2) for l in open(man) if l.strip()]
|
| 68 |
+
bad = 0
|
| 69 |
+
for kind, src, dst in rows:
|
| 70 |
+
if kind in ("MISSING", "FAILED"):
|
| 71 |
+
print(f" {kind:<9} {dst}"); bad += 1; continue
|
| 72 |
+
if kind == "DIR":
|
| 73 |
+
print(f" DIR {dst} (not size-checked)"); continue
|
| 74 |
+
want = os.path.getsize(src); got = remote.get(dst)
|
| 75 |
+
if got == want:
|
| 76 |
+
print(f" VERIFIED {want:>13,} {dst}")
|
| 77 |
+
else:
|
| 78 |
+
print(f" *** {'ABSENT' if got is None else 'MISMATCH'} local={want:,} remote={got} {dst}"); bad += 1
|
| 79 |
+
print(f"\n{len(rows)-bad}/{len(rows)} verified")
|
| 80 |
+
sys.exit(1 if bad else 0)
|
| 81 |
+
PYEOF
|
| 82 |
+
VOK=$?
|
| 83 |
+
|
| 84 |
+
if [ "$VOK" -eq 0 ]; then
|
| 85 |
+
say "=== MODEL + LOGS VERIFIED ON HF ==="
|
| 86 |
+
say "Still pending before teardown: PHASE 4 uploads the eval results and"
|
| 87 |
+
say "RESULTS.md once eval finishes. Wait for its 'safe to tear down' line."
|
| 88 |
+
else
|
| 89 |
+
say "=== VERIFICATION FAILED -- DO NOT TEAR DOWN ==="
|
| 90 |
+
fi
|
| 91 |
+
exit $VOK
|