Upload scripts/e_short.sh with huggingface_hub
Browse files- scripts/e_short.sh +40 -0
scripts/e_short.sh
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Does the wider cache COST anything at short context?
|
| 3 |
+
# retrain_corrected_cache.sh measured a prior cache switch going 75 -> 14-33 at
|
| 4 |
+
# ~4k while improving 1k and 16k. My 32k-cache result only covered 8k/16k/32k,
|
| 5 |
+
# so the regime where the known regression lives is UNMEASURED. This runs
|
| 6 |
+
# 1,024 and 4,096 under BOTH caches for both models.
|
| 7 |
+
set -uo pipefail
|
| 8 |
+
cd "$(dirname "$0")"
|
| 9 |
+
export PATH=/root/Adhi/BluTrain/envv/bin:$PATH
|
| 10 |
+
source /root/Adhi/BluTrain/envv/bin/activate 2>/dev/null
|
| 11 |
+
L=eshort_logs; mkdir -p "$L"; M="$L/master.log"
|
| 12 |
+
say(){ echo "[$(date -u +%H:%M:%S)] $*" | tee -a "$M" >&2; }
|
| 13 |
+
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"
|
| 14 |
+
HAY=Data_Loader/Data/b2_8192_16384/val_shard_00000.bin
|
| 15 |
+
run(){ # T SCALE PL tag
|
| 16 |
+
local T=$1 S=$2 PL=$3 TAG=$4
|
| 17 |
+
local O="eshort_${TAG}_len${PL}"
|
| 18 |
+
[ $((S*4096)) -eq $T ] || { say "YaRN invariant broken: $S*4096 != $T"; return 1; }
|
| 19 |
+
[ -s "$O/summary.csv" ] && [ "$(wc -l < "$O/summary.csv")" -gt 1 ] && {
|
| 20 |
+
say " $TAG len $PL cached: $(grep '^niah_single,' $O/summary.csv)"; return 0; }
|
| 21 |
+
A1B="$A1B_680" HAY="$HAY" GEN_DATA_ROOT="Data_Loader/Data/evalsrc" \
|
| 22 |
+
CKPT_EXTRA="p1final=blumodelcp_run12_step_1200.ckpt base680=varybatch.ckpt" \
|
| 23 |
+
CKPTS="p1final base680" TASKS=niah_single N=100 \
|
| 24 |
+
T=$T YARN=$S YARN_ORIG=4096 PROMPT_LEN=$PL GPUS=0,1 NP=1 OUT="$O" \
|
| 25 |
+
./run_longeval.sh >> "$L/${TAG}_${PL}.log" 2>&1
|
| 26 |
+
if [ -s "$O/summary.csv" ] && [ "$(wc -l < "$O/summary.csv")" -gt 1 ]; then
|
| 27 |
+
say " $TAG len $PL -> $(head -1 $O/summary.csv) | $(grep '^niah_single,' $O/summary.csv)"
|
| 28 |
+
else say " $TAG len $PL FAILED"; grep -ahA2 'what()' "$O"/gen/*.log 2>/dev/null|head -3|tee -a "$M" >&2; fi
|
| 29 |
+
}
|
| 30 |
+
say "=== short-context cost of the wider cache ==="
|
| 31 |
+
for PL in 1024 4096; do
|
| 32 |
+
run 16384 4 $PL cache16k
|
| 33 |
+
run 32768 8 $PL cache32k
|
| 34 |
+
done
|
| 35 |
+
say "=== SHORT-CONTEXT RESULTS (cols: base680,p1final) ==="
|
| 36 |
+
for PL in 1024 4096; do for TAG in cache16k cache32k; do
|
| 37 |
+
f="eshort_${TAG}_len${PL}/summary.csv"
|
| 38 |
+
[ -f "$f" ] && say " len $PL $TAG $(head -1 $f) -> $(grep '^niah_single,' $f)"
|
| 39 |
+
done; done
|
| 40 |
+
say "DONE"
|