unparallelled commited on
Commit
f827ec2
·
verified ·
1 Parent(s): ca421d1

Upload scripts/e128k.sh with huggingface_hub

Browse files
Files changed (1) hide show
  1. scripts/e128k.sh +46 -0
scripts/e128k.sh ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # T=131,072 / YaRN 32 x 4096. A PRE-REGISTERED test of the virtual-position model.
3
+ #
4
+ # Hypothesis: score is governed by where the last token lands inside the 4,096
5
+ # range the model was pretrained on (real position / scale), not by token count.
6
+ #
7
+ # PREDICTIONS, written before the run:
8
+ # 4,096 tok -> virtual 128 : 92-99 (was 92 at x16)
9
+ # 32,744 tok -> virtual 1,023 : 85-92 (was 54 at x16) <- the big one
10
+ # 65,512 tok -> virtual 2,047 : 45-55 (was 32 at x16)
11
+ # If 32,744 does NOT jump from 54 into the 80s, the virtual-position model is
12
+ # wrong and the gains so far were something else.
13
+ set -uo pipefail
14
+ cd "$(dirname "$0")"
15
+ export PATH=/root/Adhi/BluTrain/envv/bin:$PATH
16
+ source /root/Adhi/BluTrain/envv/bin/activate 2>/dev/null
17
+ L=e128k_logs; mkdir -p "$L"; M="$L/master.log"
18
+ say(){ echo "[$(date -u +%H:%M:%S)] $*" | tee -a "$M" >&2; }
19
+ T=131072; SCALE=32; ORIG=4096
20
+ [ $((SCALE*ORIG)) -eq $T ] || { say "FATAL YaRN invariant"; exit 1; }
21
+ HAY=Data_Loader/Data/b2_8192_16384/val_shard_00000.bin
22
+ [ "$(stat -c%s "$HAY")" = 199754694 ] || { say "FATAL haystack differs"; exit 1; }
23
+ 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"
24
+ say "=== T=$T YaRN ${SCALE}x${ORIG} -- predictions: 4096->92-99, 32744->85-92, 65512->45-55 ==="
25
+ for PL in 4096 32744 65512; do
26
+ O="e128k_len${PL}"
27
+ [ -s "$O/summary.csv" ] && [ "$(wc -l < "$O/summary.csv")" -gt 1 ] && {
28
+ say " len $PL cached: $(grep '^niah_single,' $O/summary.csv)"; continue; }
29
+ say "eval prompt_len=$PL (virtual $((PL/SCALE)))"
30
+ A1B="$A1B_680" HAY="$HAY" GEN_DATA_ROOT="Data_Loader/Data/evalsrc" \
31
+ CKPT_EXTRA="p1final=blumodelcp_run12_step_1200.ckpt base680=varybatch.ckpt" \
32
+ CKPTS="p1final base680" TASKS=niah_single N=100 \
33
+ T=$T YARN=$SCALE YARN_ORIG=$ORIG PROMPT_LEN=$PL GPUS=0,1 NP=1 OUT="$O" \
34
+ ./run_longeval.sh >> "$L/eval_${PL}.log" 2>&1
35
+ if [ -s "$O/summary.csv" ] && [ "$(wc -l < "$O/summary.csv")" -gt 1 ]; then
36
+ say " len $PL (virtual $((PL/SCALE))) -> $(head -1 $O/summary.csv) | $(grep '^niah_single,' $O/summary.csv)"
37
+ else
38
+ say " len $PL FAILED"; grep -ahA2 'what()\|out of memory' "$O"/gen/*.log 2>/dev/null|head -4|tee -a "$M" >&2
39
+ fi
40
+ done
41
+ say "=== RESULTS T=$T (cols base680,p1final) ==="
42
+ for PL in 4096 32744 65512; do
43
+ f="e128k_len${PL}/summary.csv"
44
+ [ -f "$f" ] && say " len $PL virtual $((PL/SCALE)) $(grep '^niah_single,' $f)"
45
+ done
46
+ say "DONE"