unparallelled commited on
Commit
1e44574
·
verified ·
1 Parent(s): 68c9404

Upload scripts/eval_run7c.sh with huggingface_hub

Browse files
Files changed (1) hide show
  1. scripts/eval_run7c.sh +102 -0
scripts/eval_run7c.sh ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # =============================================================================
3
+ # eval_run7c.sh -- evaluate the CORRECTED-CACHE models generatively and produce
4
+ # the data for a direct comparison against the 2026-09-02 buggy-cache results
5
+ # recorded in EVAL_COMPARISON.md.
6
+ #
7
+ # THE COMPARISON THIS FEEDS
8
+ # old run7 + buggy cache (matched) -> EVAL_COMPARISON.md sections 1,2,4
9
+ # run7' + corrected cache (matched) -> measured here
10
+ # Both arms of that comparison are train/eval MATCHED, which is the only way the
11
+ # cache fix can be credited or blamed for a difference. The intermediate
12
+ # condition (old weights + corrected cache) is a MISMATCH and is not the test.
13
+ #
14
+ # TASKS: niah_single reproduces EVAL_COMPARISON.md section 1 (and, via DEPTHS,
15
+ # section 4); val_backward reproduces section 2. Restricting to these two keeps
16
+ # the sweep to ~2000 prompts instead of ~6000 -- the other four tasks were all at
17
+ # the floor at 16k last time and were never run in the length sweep, so adding
18
+ # them would cost 3x for cells that have no old counterpart to compare against.
19
+ #
20
+ # WAITS for arm B rather than killing it: arm B's run-number collision with the
21
+ # old run7 destroyed its step-200 shard on rank_0, so it cannot be resumed. It is
22
+ # cheaper to let it finish (~12 min) than to restart it from step 0 (~41 min),
23
+ # and finishing means arm B can be evaluated in the same sweep for free.
24
+ # =============================================================================
25
+ set -uo pipefail
26
+ cd "$(dirname "$0")"
27
+
28
+ L=eval_logs; mkdir -p "$L"
29
+ M="$L/eval_master.log"
30
+ PY=${PY:-/root/Adhi/BluTrain/envv/bin/python}
31
+ CK=checkpoints_bluscriptcp/rank_0
32
+ LENS=${LENS:-"1024 2048 4096 8192 16360"}
33
+ N=${N:-100}
34
+ TASKS=${TASKS:-"niah_single val_backward"}
35
+
36
+ # say() writes to STDERR. It used to write to stdout, which silently poisoned
37
+ # every $(...) capture of a function that also logged -- that is what fed a
38
+ # 3-line checkpoint path into arm B's CP_INIT_FROM and aborted it on rank 2.
39
+ say(){ echo "[$(date -u +%H:%M:%S)] $*" | tee -a "$M" >&2; }
40
+ die(){ say "FATAL: $*"; exit 1; }
41
+
42
+ BASE_CK=blumodelcp_run6_step_750.ckpt # run7', the corrected-cache 16k base
43
+ ARMB_RUN=$(cat retrain_logs/arm_b.runnum 2>/dev/null || echo 7)
44
+
45
+ # ---- 1. wait for the GPUs -------------------------------------------------
46
+ if pgrep -f bluscriptCP_exec >/dev/null 2>&1; then
47
+ say "arm B still training -- waiting for it to finish (not killing it: its"
48
+ say " step-200 shard on rank_0 was lost to a run-number collision, so a"
49
+ say " resume is impossible and a kill would cost 41 min, not 12)"
50
+ for i in $(seq 1 240); do
51
+ pgrep -f bluscriptCP_exec >/dev/null 2>&1 || break
52
+ sleep 15
53
+ done
54
+ fi
55
+ pgrep -f bluscriptCP_exec >/dev/null 2>&1 && die "training still running after 60 min"
56
+ say "GPUs free"
57
+
58
+ # ---- 2. register whatever checkpoints actually exist ------------------------
59
+ EXTRA=""
60
+ [ -f "$CK/$BASE_CK" ] || die "run7' checkpoint missing: $CK/$BASE_CK"
61
+ EXTRA="base_c=$BASE_CK"
62
+ say "registered base_c = $BASE_CK (run7', corrected cache)"
63
+
64
+ ARMB_CK=$(ls -t $CK/blumodelcp_run${ARMB_RUN}_step_*.ckpt 2>/dev/null | head -1)
65
+ if [ -n "$ARMB_CK" ]; then
66
+ # all four ZeRO-1 shards must be present or the load is silently partial
67
+ n=$(ls checkpoints_bluscriptcp/rank_*/"$(basename "$ARMB_CK")" 2>/dev/null | wc -l)
68
+ if [ "$n" -ge 4 ]; then
69
+ EXTRA="$EXTRA armB_c=$(basename "$ARMB_CK")"
70
+ say "registered armB_c = $(basename "$ARMB_CK") (all 4 shards present)"
71
+ else
72
+ say "SKIP armB_c: only $n/4 rank shards for $(basename "$ARMB_CK")"
73
+ fi
74
+ else
75
+ say "SKIP armB_c: no run${ARMB_RUN} checkpoint"
76
+ fi
77
+
78
+ MODELS=$(echo $EXTRA | tr ' ' '\n' | cut -d= -f1 | tr '\n' ' ')
79
+ say "models: $MODELS"
80
+
81
+ # ---- 3. the sweep ----------------------------------------------------------
82
+ # YARN_ORIG=4096 is MATCHED here: these weights were trained under it.
83
+ for LEN in $LENS; do
84
+ say "eval PROMPT_LEN=$LEN N=$N tasks: $TASKS"
85
+ PY=$PY OUT=newck_len_$LEN TASKS="$TASKS" CKPTS="$MODELS" N=$N \
86
+ PROMPT_LEN=$LEN MAX_NEW=24 T=16384 DEPTHS="0.0,0.25,0.5,0.75,1.0" \
87
+ YARN_ORIG=4096 GPUS=0,1,2,3 JOBS_PER_GPU=2 BF16=1 GREEDY=1 \
88
+ CKPT_EXTRA="$EXTRA" ./run_longeval.sh >> "$L/eval_$LEN.log" 2>&1 \
89
+ || say " WARN: eval at $LEN returned nonzero (see $L/eval_$LEN.log)"
90
+ # report as we go, so a partial sweep is still usable
91
+ if [ -f "newck_len_$LEN/summary.csv" ]; then
92
+ say " -> $(grep -c . newck_len_$LEN/summary.csv) rows in newck_len_$LEN/summary.csv"
93
+ else
94
+ say " -> NO summary.csv at $LEN"
95
+ fi
96
+ done
97
+
98
+ say "EVAL DONE"
99
+ for LEN in $LENS; do
100
+ [ -f "newck_len_$LEN/summary.csv" ] && say " newck_len_$LEN/summary.csv OK" \
101
+ || say " newck_len_$LEN MISSING"
102
+ done