Upload scripts/vb_diag.sh with huggingface_hub
Browse files- scripts/vb_diag.sh +62 -0
scripts/vb_diag.sh
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# =============================================================================
|
| 3 |
+
# THE DIAGNOSTIC: is val_backward ~0 because the model cannot do backward
|
| 4 |
+
# lookup AT ALL, or only because it cannot do it at LONG context?
|
| 5 |
+
#
|
| 6 |
+
# fails at 1k AND 32k -> missing circuit (anti-induction). Reverse-training
|
| 7 |
+
# data is the right lever, and it can be trained SHORT
|
| 8 |
+
# and cheap.
|
| 9 |
+
# fine at 1k, dies long -> retrieval-RANGE problem. Reverse training will not
|
| 10 |
+
# touch it and the 4-hour experiment is not worth running.
|
| 11 |
+
#
|
| 12 |
+
# niah_single runs alongside as the forward control at every length: an induction
|
| 13 |
+
# head does match-and-copy ([.. A B .. A] -> B), which is exactly niah_single.
|
| 14 |
+
# val_backward asks for the mirror (find B, emit the preceding A). Measuring both
|
| 15 |
+
# at the same length isolates the forward/backward asymmetry from raw difficulty.
|
| 16 |
+
#
|
| 17 |
+
# Scale is held at the model's best-known config per length so we are not
|
| 18 |
+
# re-measuring the config effect: x4 at 1k/4k, x8 at 8k, x16 at 16k.
|
| 19 |
+
# =============================================================================
|
| 20 |
+
set -uo pipefail
|
| 21 |
+
cd "$(dirname "$0")"
|
| 22 |
+
export PATH=/root/Adhi/BluTrain/envv/bin:$PATH
|
| 23 |
+
source /root/Adhi/BluTrain/envv/bin/activate 2>/dev/null
|
| 24 |
+
L=vb_logs; mkdir -p "$L"; M="$L/master.log"
|
| 25 |
+
say(){ echo "[$(date -u +%H:%M:%S)] $*" | tee -a "$M" >&2; }
|
| 26 |
+
die(){ say "FATAL: $*"; exit 1; }
|
| 27 |
+
EXE=./build/bluscriptCP_exec
|
| 28 |
+
HAY=Data_Loader/Data/b2_8192_16384/val_shard_00000.bin
|
| 29 |
+
CK=checkpoints_bluscriptcp/rank_0
|
| 30 |
+
[ -x "$EXE" ] || die "$EXE not built"
|
| 31 |
+
grep -q 'CP_FUSED_ROPE=1' build/objects/.cp_rope_flags || die "binary lacks split kernels"
|
| 32 |
+
[ "$(stat -c%s "$HAY")" = 199754694 ] || die "haystack differs from prior evals"
|
| 33 |
+
[ -s "$CK/p1final.ckpt" ] && [ -s "$CK/varybatch.ckpt" ] || die "checkpoints missing"
|
| 34 |
+
A680="CP_N_EMBD=1536 CP_N_LAYER=24 CP_N_HEAD=12 CP_N_KVHEAD=4 CP_FFN=4096 CP_WEIGHT_TYING=1"
|
| 35 |
+
EX="p1final=p1final.ckpt base680=varybatch.ckpt"
|
| 36 |
+
|
| 37 |
+
run(){ # T SCALE PL
|
| 38 |
+
local T=$1 S=$2 PL=$3
|
| 39 |
+
local O="vb_len${PL}"
|
| 40 |
+
[ $((S*4096)) -eq $T ] || { say "YaRN invariant $S*4096 != $T"; return 1; }
|
| 41 |
+
[ -s "$O/summary.csv" ] && [ "$(wc -l < "$O/summary.csv")" -gt 1 ] && {
|
| 42 |
+
say " len $PL cached"; return 0; }
|
| 43 |
+
say " len $PL (T=$T x$S -> virtual $((PL/S))) [val_backward + niah_single]"
|
| 44 |
+
A1B="$A680" HAY="$HAY" GEN_DATA_ROOT="Data_Loader/Data/evalsrc" \
|
| 45 |
+
CKPT_EXTRA="$EX" CKPTS="p1final base680" TASKS="val_backward niah_single" N=100 \
|
| 46 |
+
T=$T YARN=$S YARN_ORIG=4096 PROMPT_LEN=$PL GPUS=0 NP=1 OUT="$O" \
|
| 47 |
+
./run_longeval.sh >> "$L/ev_${PL}.log" 2>&1
|
| 48 |
+
if [ -s "$O/summary.csv" ] && [ "$(wc -l < "$O/summary.csv")" -gt 1 ]; then
|
| 49 |
+
say " $(head -1 $O/summary.csv)"; tail -n +2 "$O/summary.csv"|sed 's/^/ /'|tee -a "$M" >&2
|
| 50 |
+
else say " FAILED"; grep -ahA2 'what()' "$O"/gen/*.log 2>/dev/null|head -4|tee -a "$M" >&2; fi
|
| 51 |
+
}
|
| 52 |
+
say "=== val_backward diagnostic: circuit deficit or range problem? ==="
|
| 53 |
+
run 16384 4 1024
|
| 54 |
+
run 16384 4 4096
|
| 55 |
+
run 32768 8 8192
|
| 56 |
+
run 65536 16 16360
|
| 57 |
+
say "=== SUMMARY (cols: base680, p1final) ==="
|
| 58 |
+
for PL in 1024 4096 8192 16360; do
|
| 59 |
+
f="vb_len${PL}/summary.csv"
|
| 60 |
+
[ -f "$f" ] && say " len $PL $(head -1 $f) | $(tail -n +2 $f | tr '\n' ' ')"
|
| 61 |
+
done
|
| 62 |
+
say "DONE"
|