Upload scripts/run_ruler.sh with huggingface_hub
Browse files- scripts/run_ruler.sh +79 -0
scripts/run_ruler.sh
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# =============================================================================
|
| 3 |
+
# Full RULER (13 tasks, 4 categories) on the 680M long-context models.
|
| 4 |
+
#
|
| 5 |
+
# PARALLELISM: run_longeval.sh fans out over (checkpoint x task) pairs. Passing
|
| 6 |
+
# ONE task at a time gives 3 jobs for 8 GPUs -- which is what happened on
|
| 7 |
+
# 2026-09-17 and left 5 cards idle per length. Passing ALL 13 tasks in a single
|
| 8 |
+
# invocation gives 13 x models jobs per length and fills the box.
|
| 9 |
+
#
|
| 10 |
+
# RULER's 13:
|
| 11 |
+
# retrieval niah_single{,_1,_3} niah_multikey{,_2,_3} multivalue multiquery
|
| 12 |
+
# multi-hop vt
|
| 13 |
+
# aggregation cwe fwe
|
| 14 |
+
# QA qa_1 (SQuAD) qa_2 (HotpotQA)
|
| 15 |
+
#
|
| 16 |
+
# N: RULER publishes at 500/task. We use 100 by default for internal
|
| 17 |
+
# comparability with every prior result in this project; set N=500 for numbers
|
| 18 |
+
# comparable to the published RULER leaderboard (5x the time).
|
| 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 |
+
|
| 25 |
+
RULER="niah_single niah_single_1 niah_single_3 niah_multikey niah_multikey_2 \
|
| 26 |
+
niah_multikey_3 niah_multivalue niah_multiquery vt cwe fwe qa_1 qa_2"
|
| 27 |
+
LENS=${LENS:-"4096 8192 16384 32744 65512"}
|
| 28 |
+
N=${N:-100}
|
| 29 |
+
GPUS=${GPUS:-0,1,2,3,4,5,6,7}
|
| 30 |
+
A680="CP_N_EMBD=1536 CP_N_LAYER=24 CP_N_HEAD=12 CP_N_KVHEAD=4 CP_FFN=4096 CP_WEIGHT_TYING=1"
|
| 31 |
+
HAY=${HAY:-Data_Loader/Data/b2_8192_16384/val_shard_00000.bin}
|
| 32 |
+
CK=checkpoints_bluscriptcp/rank_0
|
| 33 |
+
EXTRA=${EXTRA:-"t64=t64.ckpt p1final=p1final.ckpt base680=varybatch.ckpt"}
|
| 34 |
+
MODELS=${MODELS:-"t64 p1final base680"}
|
| 35 |
+
L=ruler_logs; mkdir -p "$L"; M="$L/master.log"
|
| 36 |
+
say(){ echo "[$(date -u +%H:%M:%S)] $*" | tee -a "$M" >&2; }
|
| 37 |
+
die(){ say "FATAL: $*"; exit 1; }
|
| 38 |
+
|
| 39 |
+
[ -x ./build/bluscriptCP_exec ] || die "binary not built"
|
| 40 |
+
grep -q 'CP_FUSED_ROPE=1' build/objects/.cp_rope_flags && \
|
| 41 |
+
grep -q 'CP_ATTN_SPLIT=1' build/objects/.cp_rope_flags || die "binary lacks split kernels"
|
| 42 |
+
[ -f "$HAY" ] || die "haystack missing: $HAY"
|
| 43 |
+
[ "$(stat -c%s "$HAY")" = 199754694 ] || die "haystack is NOT the file every prior eval used"
|
| 44 |
+
for f in Tests/bluscriptcp/qa_data/squad_val.parquet Tests/bluscriptcp/qa_data/hotpot_val.parquet; do
|
| 45 |
+
[ -f "$f" ] || die "QA data missing: $f (qa_1/qa_2 cannot run)"; done
|
| 46 |
+
python -c "import pyarrow" 2>/dev/null || die "pyarrow missing (needed by qa_1/qa_2)"
|
| 47 |
+
for m in $MODELS; do
|
| 48 |
+
f=$(echo "$EXTRA" | tr ' ' '\n' | grep "^$m=" | cut -d= -f2)
|
| 49 |
+
[ -f "$CK/$f" ] || die "checkpoint for '$m' missing: $CK/$f"
|
| 50 |
+
done
|
| 51 |
+
|
| 52 |
+
say "=== FULL RULER: 13 tasks x $(echo $MODELS|wc -w) models x $(echo $LENS|wc -w) lengths, N=$N ==="
|
| 53 |
+
say "models: $MODELS"
|
| 54 |
+
say "jobs per length: $(( 13 * $(echo $MODELS|wc -w) )) across $(echo $GPUS|tr ',' ' '|wc -w) GPUs"
|
| 55 |
+
|
| 56 |
+
for PL in $LENS; do
|
| 57 |
+
O="ruler_len${PL}"
|
| 58 |
+
if [ -s "$O/summary.csv" ] && [ "$(wc -l < "$O/summary.csv")" -gt 1 ]; then
|
| 59 |
+
say "len $PL cached ($(( $(wc -l < "$O/summary.csv") - 1 )) task rows)"; continue; fi
|
| 60 |
+
# YaRN: scale must land content near virtual 1,000-2,000. SCALE=64/ORIG=4096
|
| 61 |
+
# (T=262,144) is the best config measured on these models; it beats the
|
| 62 |
+
# as-trained config by +57pp at 65,512.
|
| 63 |
+
say "len $PL (T=262144 x64 -> virtual $((PL/64)))"
|
| 64 |
+
A1B="$A680" HAY="$HAY" GEN_DATA_ROOT="${GEN_DATA_ROOT:-Data_Loader/Data/evalsrc}" \
|
| 65 |
+
CKPT_EXTRA="$EXTRA" CKPTS="$MODELS" TASKS="$RULER" N=$N \
|
| 66 |
+
T=262144 YARN=64 YARN_ORIG=4096 PROMPT_LEN=$PL GPUS="$GPUS" NP=1 OUT="$O" \
|
| 67 |
+
./run_longeval.sh >> "$L/len_${PL}.log" 2>&1
|
| 68 |
+
if [ -s "$O/summary.csv" ] && [ "$(wc -l < "$O/summary.csv")" -gt 1 ]; then
|
| 69 |
+
say " done: $(( $(wc -l < "$O/summary.csv") - 1 ))/13 tasks scored"
|
| 70 |
+
tail -n +2 "$O/summary.csv" | sed 's/^/ /' | tee -a "$M" >&2
|
| 71 |
+
else
|
| 72 |
+
say " FAILED at len $PL"; grep -ahA2 'what()' "$O"/gen/*.log 2>/dev/null | head -4 | tee -a "$M" >&2
|
| 73 |
+
fi
|
| 74 |
+
done
|
| 75 |
+
say "=== RULER COMPLETE ==="
|
| 76 |
+
for PL in $LENS; do
|
| 77 |
+
f="ruler_len${PL}/summary.csv"
|
| 78 |
+
[ -f "$f" ] && { say "len $PL:"; cat "$f" | sed 's/^/ /' | tee -a "$M" >&2; }
|
| 79 |
+
done
|