Upload scripts/p1_eval32k.sh with huggingface_hub
Browse files- scripts/p1_eval32k.sh +76 -0
scripts/p1_eval32k.sh
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# =============================================================================
|
| 3 |
+
# The question: does the 680M's advantage survive at 32k, and does phase-1
|
| 4 |
+
# training add anything there?
|
| 5 |
+
#
|
| 6 |
+
# Evaluates BOTH models -- base680 (untrained, zero-shot YaRN) and p1final
|
| 7 |
+
# (1200 steps) -- at 8,192 / 16,360 / 32,744 under a T=32,768 window.
|
| 8 |
+
#
|
| 9 |
+
# base680 is the control. Phase 1 is the run that taught us why: without the
|
| 10 |
+
# untrained baseline, 77 and 42 look like results instead of noise.
|
| 11 |
+
#
|
| 12 |
+
# YaRN: SCALE=8 x ORIG_MAXPOS=4096 = 32,768. ORIG stays at the model's ORIGINAL
|
| 13 |
+
# pretrain length (4096) and only SCALE rises -- build_rope_cache is rebuilt from
|
| 14 |
+
# base theta every run so SCALE never composes, and find_dim() does not take
|
| 15 |
+
# scale, so holding ORIG fixed keeps the interpolated dims at [14,32] exactly as
|
| 16 |
+
# at 16k. Re-basing to 2 x 16384 would satisfy SCALE*ORIG==CP_T but freeze
|
| 17 |
+
# interpolation and push the far end to virtual position 16,384.
|
| 18 |
+
#
|
| 19 |
+
# CAVEAT ON COMPARING TO PHASE 1: phase 1 measured 84 @8192 / 40 @16360 under a
|
| 20 |
+
# T=16,384 cache (SCALE=4). These runs use a T=32,768 cache (SCALE=8), so the
|
| 21 |
+
# 8k/16k numbers here are NOT directly comparable to those -- the cache changed,
|
| 22 |
+
# not just the prompt length. What IS valid is base680 vs p1final within this
|
| 23 |
+
# run, which is the actual question.
|
| 24 |
+
# =============================================================================
|
| 25 |
+
set -uo pipefail
|
| 26 |
+
cd "$(dirname "$0")"
|
| 27 |
+
export PATH=/root/Adhi/BluTrain/envv/bin:$PATH
|
| 28 |
+
source /root/Adhi/BluTrain/envv/bin/activate 2>/dev/null
|
| 29 |
+
L=e32k_logs; mkdir -p "$L"; M="$L/master.log"
|
| 30 |
+
say(){ echo "[$(date -u +%H:%M:%S)] $*" | tee -a "$M" >&2; }
|
| 31 |
+
die(){ say "FATAL: $*"; exit 1; }
|
| 32 |
+
|
| 33 |
+
EXE=./build/bluscriptCP_exec
|
| 34 |
+
HAY=Data_Loader/Data/b2_8192_16384/val_shard_00000.bin
|
| 35 |
+
CK=checkpoints_bluscriptcp/rank_0
|
| 36 |
+
T=32768; ORIG=4096; SCALE=8
|
| 37 |
+
[ $((SCALE*ORIG)) -eq $T ] || die "YaRN invariant: $SCALE*$ORIG != $T"
|
| 38 |
+
[ -x "$EXE" ] || die "$EXE not built"
|
| 39 |
+
S=build/objects/.cp_rope_flags
|
| 40 |
+
grep -q 'CP_FUSED_ROPE=1' "$S" && grep -q 'CP_ATTN_SPLIT=1' "$S" || die "binary lacks split kernels ($(cat $S))"
|
| 41 |
+
[ -f "$HAY" ] || die "haystack missing"
|
| 42 |
+
[ "$(stat -c%s "$HAY")" = 199754694 ] || die "haystack is NOT the file phase 1 used (size $(stat -c%s "$HAY"))"
|
| 43 |
+
[ -f "$CK/blumodelcp_run12_step_1200.ckpt" ] || die "p1final missing"
|
| 44 |
+
[ -f "$CK/varybatch.ckpt" ] || ln -sf "$PWD/checkpoints_680m/rank_0/varybatch.ckpt" "$CK/varybatch.ckpt"
|
| 45 |
+
[ -s "$CK/varybatch.ckpt" ] || die "varybatch missing"
|
| 46 |
+
ls Data_Loader/Data/evalsrc/train_shard_*.bin >/dev/null 2>&1 || die "no train split for the loader"
|
| 47 |
+
python -c "import tiktoken" 2>/dev/null || die "tiktoken missing"
|
| 48 |
+
|
| 49 |
+
A1B_680="CP_N_EMBD=1536 CP_N_LAYER=24 CP_N_HEAD=12 CP_N_KVHEAD=4 CP_FFN=4096 CP_WEIGHT_TYING=1"
|
| 50 |
+
say "=== 680M @ 32k window: base680 (control) vs p1final ==="
|
| 51 |
+
say "YaRN SCALE=$SCALE ORIG=$ORIG -> $((SCALE*ORIG)) == CP_T=$T"
|
| 52 |
+
say "haystack $(stat -c%s "$HAY") B -- same file phase 1 used"
|
| 53 |
+
|
| 54 |
+
for PL in 8192 16360 32744; do
|
| 55 |
+
O="e32k_len${PL}"
|
| 56 |
+
if [ -s "$O/summary.csv" ] && [ "$(wc -l < "$O/summary.csv")" -gt 1 ]; then
|
| 57 |
+
say "len $PL already done: $(grep '^niah_single,' "$O/summary.csv")"; continue; fi
|
| 58 |
+
say "eval prompt_len=$PL (2 GPUs, 2 jobs)"
|
| 59 |
+
A1B="$A1B_680" HAY="$HAY" GEN_DATA_ROOT="Data_Loader/Data/evalsrc" \
|
| 60 |
+
CKPT_EXTRA="p1final=blumodelcp_run12_step_1200.ckpt base680=varybatch.ckpt" \
|
| 61 |
+
CKPTS="p1final base680" TASKS=niah_single N=100 \
|
| 62 |
+
T=$T YARN=$SCALE YARN_ORIG=$ORIG PROMPT_LEN=$PL GPUS=0,1 NP=1 OUT="$O" \
|
| 63 |
+
./run_longeval.sh >> "$L/eval_${PL}.log" 2>&1
|
| 64 |
+
if [ -s "$O/summary.csv" ] && [ "$(wc -l < "$O/summary.csv")" -gt 1 ]; then
|
| 65 |
+
say " len $PL -> $(head -1 $O/summary.csv) | $(grep '^niah_single,' $O/summary.csv)"
|
| 66 |
+
else
|
| 67 |
+
say " len $PL FAILED"; grep -ahA2 'what()' "$O"/gen/*.log 2>/dev/null | head -4 | tee -a "$M" >&2
|
| 68 |
+
fi
|
| 69 |
+
done
|
| 70 |
+
|
| 71 |
+
say "=== RESULTS (niah_single, N=100, T=$T, YaRN ${SCALE}x${ORIG}) ==="
|
| 72 |
+
for PL in 8192 16360 32744; do
|
| 73 |
+
f="e32k_len${PL}/summary.csv"
|
| 74 |
+
[ -f "$f" ] && say " len $PL $(head -1 $f) -> $(grep '^niah_single,' $f)"
|
| 75 |
+
done
|
| 76 |
+
say "DONE"
|