Upload scripts/ruler_full.sh with huggingface_hub
Browse files- scripts/ruler_full.sh +69 -0
scripts/ruler_full.sh
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# =============================================================================
|
| 3 |
+
# FULL RULER: 13 tasks x 5 lengths, t64 (+ optional controls).
|
| 4 |
+
#
|
| 5 |
+
# TWO OPTIMISATIONS over the first attempt:
|
| 6 |
+
# 1. MINIMUM T PER LENGTH. The rotation angle is (position/scale)*omega -- T is
|
| 7 |
+
# not in the formula, it only sizes the RoPE/KV allocation. The first run
|
| 8 |
+
# used T=131,072 to evaluate a 32,744-token prompt and paid 49 GB for it.
|
| 9 |
+
# T = next power of two >= prompt_len gives IDENTICAL angles at a quarter of
|
| 10 |
+
# the memory. (SCALE*ORIG==CP_T is a TRAINING requirement -- it keeps the
|
| 11 |
+
# full virtual range during training -- and is free to break at eval.)
|
| 12 |
+
# 2. CONCURRENCY. Batch-1 decode under-uses the card; bench_conc.sh measures
|
| 13 |
+
# the real speedup rather than trusting the header's "~1.8x at 2/GPU".
|
| 14 |
+
#
|
| 15 |
+
# SCALE = T/1024 puts the last token near virtual 1,000 at every length, which
|
| 16 |
+
# is the empirically best band (measured 2026-09-16: virtual ~1k scores 88-92).
|
| 17 |
+
#
|
| 18 |
+
# CAVEAT: these are OUR implementations of RULER's tasks, not the official
|
| 19 |
+
# generators. Numbers are internally comparable across our models but NOT
|
| 20 |
+
# directly comparable to published RULER scores.
|
| 21 |
+
# =============================================================================
|
| 22 |
+
set -uo pipefail
|
| 23 |
+
cd "$(dirname "$0")"
|
| 24 |
+
export PATH=/root/Adhi/BluTrain/envv/bin:$PATH
|
| 25 |
+
source /root/Adhi/BluTrain/envv/bin/activate 2>/dev/null
|
| 26 |
+
L=rulerfull_logs; mkdir -p "$L"; M="$L/master.log"
|
| 27 |
+
say(){ echo "[$(date -u +%H:%M:%S)] $*" | tee -a "$M" >&2; }
|
| 28 |
+
die(){ say "FATAL: $*"; exit 1; }
|
| 29 |
+
HAY=Data_Loader/Data/b2_8192_16384/val_shard_00000.bin
|
| 30 |
+
CK=checkpoints_bluscriptcp/rank_0
|
| 31 |
+
[ -x ./build/bluscriptCP_exec ] || die "binary missing"
|
| 32 |
+
[ "$(stat -c%s "$HAY")" = 199754694 ] || die "haystack differs from prior evals"
|
| 33 |
+
A680="CP_N_EMBD=1536 CP_N_LAYER=24 CP_N_HEAD=12 CP_N_KVHEAD=4 CP_FFN=4096 CP_WEIGHT_TYING=1"
|
| 34 |
+
J=${J:-4}
|
| 35 |
+
MODELS=${MODELS:-"t64"}
|
| 36 |
+
TASKS_ALL="niah_single niah_single_1 niah_single_3 niah_multikey niah_multikey_2 niah_multikey_3 \
|
| 37 |
+
niah_multivalue niah_multiquery vt cwe fwe qa_1 qa_2"
|
| 38 |
+
# prompt_len : T : SCALE (T = min power of 2 >= len; SCALE = T/1024 -> virtual ~1k)
|
| 39 |
+
CFG="4096:8192:4 8192:16384:8 16360:16384:16 32744:32768:32 65512:65536:64"
|
| 40 |
+
|
| 41 |
+
say "=== FULL RULER: 13 tasks x 5 lengths, JOBS_PER_GPU=$J, models: $MODELS ==="
|
| 42 |
+
for m in $MODELS; do
|
| 43 |
+
f="$CK/${m}.ckpt"; [ -s "$f" ] || die "$m checkpoint missing"
|
| 44 |
+
for c in $CFG; do
|
| 45 |
+
PL=${c%%:*}; rest=${c#*:}; T=${rest%%:*}; S=${rest##*:}
|
| 46 |
+
O="rf_${m}_${PL}"
|
| 47 |
+
if [ -s "$O/summary.csv" ] && [ "$(wc -l < "$O/summary.csv")" -gt 1 ]; then
|
| 48 |
+
say " $m @ $PL cached"; continue; fi
|
| 49 |
+
say " $m @ $PL (T=$T x$S -> virtual $((PL/S))) 13 tasks"
|
| 50 |
+
t0=$(date +%s)
|
| 51 |
+
A1B="$A680" HAY="$HAY" GEN_DATA_ROOT="Data_Loader/Data/evalsrc" \
|
| 52 |
+
CKPT_EXTRA="$m=${m}.ckpt" CKPTS="$m" TASKS="$TASKS_ALL" N=100 \
|
| 53 |
+
T=$T YARN=$S YARN_ORIG=4096 PROMPT_LEN=$PL GPUS=0 NP=1 JOBS_PER_GPU=$J OUT="$O" \
|
| 54 |
+
./run_longeval.sh >> "$L/${m}_${PL}.log" 2>&1
|
| 55 |
+
say " $(( ($(date +%s)-t0)/60 )) min"
|
| 56 |
+
if [ -s "$O/summary.csv" ]; then tail -n +2 "$O/summary.csv" | sed 's/^/ /' | tee -a "$M" >&2
|
| 57 |
+
else say " NO SUMMARY -- see $L/${m}_${PL}.log"; fi
|
| 58 |
+
done
|
| 59 |
+
done
|
| 60 |
+
say "=== RULER TABLE (rows=task, cols=length) ==="
|
| 61 |
+
{ printf "%-18s" "task"; for c in $CFG; do printf "%8s" "${c%%:*}"; done; echo; } | tee -a "$M"
|
| 62 |
+
for t in $TASKS_ALL; do
|
| 63 |
+
printf "%-18s" "$t"
|
| 64 |
+
for c in $CFG; do
|
| 65 |
+
PL=${c%%:*}; v=$(grep -h "^${t}," rf_t64_${PL}/summary.csv 2>/dev/null | cut -d, -f2)
|
| 66 |
+
printf "%8s" "${v:-.}"
|
| 67 |
+
done; echo
|
| 68 |
+
done | tee -a "$M"
|
| 69 |
+
say "RULER FULL DONE"
|