Upload scripts/decide_l3.sh with huggingface_hub
Browse files- scripts/decide_l3.sh +62 -0
scripts/decide_l3.sh
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# =============================================================================
|
| 3 |
+
# decide_l3.sh -- the decision gate: does training on documents LONGER than the
|
| 4 |
+
# 16,384 window help, or only on documents that FIT inside it?
|
| 5 |
+
#
|
| 6 |
+
# l1 b1 4-8k docs fit inside the window
|
| 7 |
+
# l2 b2 8-16k docs fit (at the boundary)
|
| 8 |
+
# l3 b3 16-32k docs EXCEED the window -> trained on truncated slices
|
| 9 |
+
# armA_c flux, median 826 -- the control
|
| 10 |
+
#
|
| 11 |
+
# If l3 <= l2, truncated long documents add nothing and the right move is to
|
| 12 |
+
# EXTEND the window (16k -> 32k/64k) before feeding longer data. If l3 > l2,
|
| 13 |
+
# truncation still carries signal and more length is worth buying.
|
| 14 |
+
#
|
| 15 |
+
# SCOPE: niah_single only, at 4096/8192/16360. The doc-length effect was
|
| 16 |
+
# resolvable at 8k and 16k and not at 1-4k, so those are the decisive cells;
|
| 17 |
+
# 4096 is kept for the trend. val_backward is omitted -- it has sat at 0-4%
|
| 18 |
+
# (chance ~2.9%) in every arm measured, so it would double the cost for nothing.
|
| 19 |
+
#
|
| 20 |
+
# HAYSTACK CAVEAT, stated up front: b2's val shard is the filler, which is
|
| 21 |
+
# IN-DISTRIBUTION for l2 and out-of-distribution for l1/l3/armA_c. That biases
|
| 22 |
+
# the comparison IN L2's FAVOUR -- exactly the arm l3 is being measured against.
|
| 23 |
+
# So "l3 beats l2" would be robust, while "l3 loses to l2" is ambiguous and
|
| 24 |
+
# needs the b3-val cross-check (cross_check_l3.sh) before it can be believed.
|
| 25 |
+
# =============================================================================
|
| 26 |
+
set -uo pipefail
|
| 27 |
+
cd "$(dirname "$0")"
|
| 28 |
+
ROOT="$(cd ../.. && pwd)"
|
| 29 |
+
export LD_LIBRARY_PATH="$ROOT/Tensor-Implementations/lib:$ROOT/Profiler/lib:${LD_LIBRARY_PATH:-}"
|
| 30 |
+
export OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
|
| 31 |
+
PY=/root/Adhi/BluTrain/envv/bin/python
|
| 32 |
+
CK=checkpoints_bluscriptcp/rank_0
|
| 33 |
+
LOG=decide_logs; mkdir -p "$LOG"
|
| 34 |
+
M="$LOG/master.log"
|
| 35 |
+
say(){ echo "[$(date -u +%H:%M:%S)] $*" | tee -a "$M" >&2; }
|
| 36 |
+
|
| 37 |
+
$PY -c "import tiktoken" 2>/dev/null || { say "FATAL tiktoken missing"; exit 1; }
|
| 38 |
+
|
| 39 |
+
EXTRA="armA_c=blumodelcp_run28_step_400.ckpt \
|
| 40 |
+
l1=lenbucket_l1_blumodelcp_run1_step_400.ckpt \
|
| 41 |
+
l2=lenbucket_l2_blumodelcp_run2_step_400.ckpt \
|
| 42 |
+
l3=blumodelcp_run1_step_400.ckpt"
|
| 43 |
+
for kv in $EXTRA; do
|
| 44 |
+
[ -f "$CK/${kv#*=}" ] || { say "FATAL missing $CK/${kv#*=}"; exit 1; }
|
| 45 |
+
done
|
| 46 |
+
MODELS="armA_c l1 l2 l3"
|
| 47 |
+
say "=== l3 decision eval ==="
|
| 48 |
+
say "models: $MODELS haystack: b2val (in-distribution for l2 -- biased toward l2)"
|
| 49 |
+
|
| 50 |
+
for LEN in 4096 8192 16360; do
|
| 51 |
+
say "PROMPT_LEN=$LEN niah_single N=100"
|
| 52 |
+
GEN_DATA_ROOT=lendata/b3_16384_32768 \
|
| 53 |
+
HAY="$PWD/lendata/haystack/b2val_haystack.bin" \
|
| 54 |
+
PY=$PY OUT=decide_len_$LEN TASKS="niah_single" CKPTS="$MODELS" N=100 \
|
| 55 |
+
PROMPT_LEN=$LEN MAX_NEW=24 T=16384 DEPTHS="0.0,0.25,0.5,0.75,1.0" \
|
| 56 |
+
YARN_ORIG=4096 GPUS=0,1 JOBS_PER_GPU=2 BF16=1 GREEDY=1 \
|
| 57 |
+
CKPT_EXTRA="$EXTRA" ./run_longeval.sh >> "$LOG/eval_$LEN.log" 2>&1 \
|
| 58 |
+
|| say " WARN nonzero at $LEN"
|
| 59 |
+
[ -s "decide_len_$LEN/summary.csv" ] && say " -> $(sed -n 1p decide_len_$LEN/summary.csv) / $(sed -n 2p decide_len_$LEN/summary.csv)" \
|
| 60 |
+
|| say " -> NO RESULT at $LEN"
|
| 61 |
+
done
|
| 62 |
+
say "=== DECISION EVAL DONE ==="
|