Upload scripts/mixcont_h100.sh with huggingface_hub
Browse files- scripts/mixcont_h100.sh +128 -0
scripts/mixcont_h100.sh
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# =============================================================================
|
| 3 |
+
# Continue the mixed-corpus 64k run to a FULL b5 EPOCH. 8x H100, cp=8 dp=1.
|
| 4 |
+
#
|
| 5 |
+
# THE QUESTION
|
| 6 |
+
# mix64k reached step 1200 with retrieval INTACT (83/70/50/31 vs the parent's
|
| 7 |
+
# 67/65/52/29) where 100% b5 had collapsed to 45/17/2/1. But it had only seen
|
| 8 |
+
# 39% of b5. This run carries it to 100% of b5 inside the mix, so the model
|
| 9 |
+
# sees the SAME 0.866 B of long-document data that destroyed cont64k -- just
|
| 10 |
+
# interleaved with b3/b1. If it holds, MIXTURE is the mechanism. If it
|
| 11 |
+
# collapses, EXPOSURE was.
|
| 12 |
+
#
|
| 13 |
+
# THE DATA IS A VERIFIED CONTINUATION, NOT A RESTART
|
| 14 |
+
# CP_INIT_FROM bypasses skip_batches (bluscriptCP.cpp:2047), so the loader
|
| 15 |
+
# would otherwise replay from token 0. mixcont was built with --skip-tokens
|
| 16 |
+
# 629,342,677 -- the EXACT stream position mix50's loader held at step 1200,
|
| 17 |
+
# including the 197,077 tokens of shard tails the loader discards. The
|
| 18 |
+
# junction was checked byte-for-byte against a no-skip reference build.
|
| 19 |
+
#
|
| 20 |
+
# WHY cp=8 AND NOT cp=4 dp=2
|
| 21 |
+
# These are H100 80GB, not the H200s of the last run. 16,384 tok/rank
|
| 22 |
+
# MEASURED 105.6 GB and will not fit. cp=8 halves it to 8,192 tok/rank
|
| 23 |
+
# (~70 GB) at a measured 7.81 s/step.
|
| 24 |
+
#
|
| 25 |
+
# CHECKPOINT POLICY (ckpt_shipper.sh runs alongside)
|
| 26 |
+
# FULL resumable (8 ranks, .ckpt + .zero_g1) at the eval steps and the final;
|
| 27 |
+
# rank_0 only elsewhere; every upload byte-verified against HF before the
|
| 28 |
+
# local copy is freed. Keeping everything would need 647 GB on a 193 GB disk.
|
| 29 |
+
# =============================================================================
|
| 30 |
+
set -uo pipefail
|
| 31 |
+
cd "$(dirname "$0")"
|
| 32 |
+
ROOT="$(cd ../.. && pwd)"
|
| 33 |
+
export LD_LIBRARY_PATH="$ROOT/Tensor-Implementations/lib:$ROOT/Profiler/lib:${LD_LIBRARY_PATH:-}"
|
| 34 |
+
export OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
|
| 35 |
+
export PATH=/usr/local/cuda/bin:$PATH
|
| 36 |
+
|
| 37 |
+
PY=/root/Adhi/BluTrain/envv/bin/python
|
| 38 |
+
HF=/root/Adhi/BluTrain/envv/bin/hf
|
| 39 |
+
EXE=./build/bluscriptCP_exec
|
| 40 |
+
CK=checkpoints_bluscriptcp/rank_0
|
| 41 |
+
LOG=mixcont_logs; mkdir -p "$LOG"
|
| 42 |
+
M="$LOG/master.log"
|
| 43 |
+
REPO=unparallelled/BluScriptCP
|
| 44 |
+
|
| 45 |
+
T=65536; NP=8; CPSZ=8; GPUS=0,1,2,3,4,5,6,7 # dp = 1
|
| 46 |
+
ORIG=32768; SCALE=2
|
| 47 |
+
BASE_STEP=1200 # where the parent checkpoint sits
|
| 48 |
+
NEW=${NEW:-2100} # 2102 usable; 2100 keeps FREQ alignment
|
| 49 |
+
STEPS=$(( BASE_STEP + NEW )) # 3300 global, for reporting only
|
| 50 |
+
WARM=100; TAIL=2; FREQ=200; KEEP=2
|
| 51 |
+
# CP_INIT_FROM restarts the step counter at 0, so the trainer sees max_steps=NEW
|
| 52 |
+
# and its checkpoints are numbered LOCALLY (200..2100). STABLE must therefore be
|
| 53 |
+
# computed against NEW, not the global 3300 -- against 3300 the guard at
|
| 54 |
+
# bluscriptCP.cpp:1006 (warmup+stable >= max_steps-1) would kill the run.
|
| 55 |
+
STABLE=$(( NEW - WARM - TAIL ))
|
| 56 |
+
GB=524288
|
| 57 |
+
DATA=Data_Loader/Data/mixcont
|
| 58 |
+
PARENT="$CK/mix64k_step1200.ckpt"; PARENT_SZ=3750897182
|
| 59 |
+
HAY="$PWD/Data_Loader/Data/b2_8192_16384/val_shard_00000.bin"
|
| 60 |
+
EVALS_GLOBAL=${EVALS_GLOBAL:-"2000 2600 3300"}
|
| 61 |
+
# local = global - BASE_STEP, because checkpoints are named locally
|
| 62 |
+
EVALS=""; for g in $EVALS_GLOBAL; do EVALS="$EVALS $(( g - 1200 ))"; done; EVALS=${EVALS# }
|
| 63 |
+
|
| 64 |
+
say(){ echo "[$(date -u +%H:%M:%S)] $*" | tee -a "$M" >&2; }
|
| 65 |
+
die(){ say "FATAL: $*"; exit 1; }
|
| 66 |
+
|
| 67 |
+
# ---------------------------------------------------------------- preflight --
|
| 68 |
+
$PY -c "import tiktoken" 2>/dev/null || die "tiktoken missing (eval would score nothing, silently)"
|
| 69 |
+
[ -x "$EXE" ] || die "$EXE not built"
|
| 70 |
+
S=build/objects/.cp_rope_flags
|
| 71 |
+
grep -q 'CP_FUSED_ROPE=1' "$S" 2>/dev/null && grep -q 'CP_ATTN_SPLIT=1' "$S" || \
|
| 72 |
+
die "binary lacks the split kernels ($(cat "$S" 2>/dev/null)); CP_ATTN_FUSION=split throws at the first forward"
|
| 73 |
+
[ -f "$PARENT" ] || die "parent missing: $PARENT"
|
| 74 |
+
[ "$(stat -c%s "$PARENT")" = "$PARENT_SZ" ] || die "parent wrong size"
|
| 75 |
+
[ -f "$HAY" ] || die "haystack missing"
|
| 76 |
+
[ -d "$DATA" ] || die "$DATA missing"
|
| 77 |
+
[ $((SCALE*ORIG)) -eq $T ] || die "YaRN invariant"
|
| 78 |
+
U=$(awk '/^usable_steps/{print $2}' "$DATA/MANIFEST.txt")
|
| 79 |
+
[ "$NEW" -le "$U" ] || die "NEW=$NEW exceeds usable_steps=$U -- the loader would WRAP silently"
|
| 80 |
+
[ $(( WARM + STABLE )) -lt $(( NEW - 1 )) ] || die "illegal WSD: $WARM+$STABLE >= $NEW-1"
|
| 81 |
+
FREEG=$(df -BG --output=avail / | tail -1 | tr -dc 0-9)
|
| 82 |
+
[ "$FREEG" -ge 110 ] || die "only ${FREEG} GB free; need ~110"
|
| 83 |
+
|
| 84 |
+
say "=== mix -> FULL b5 EPOCH (8x H100, cp=$CPSZ dp=$((NP/CPSZ))) ==="
|
| 85 |
+
say "parent: mix64k step $BASE_STEP (83/70/50/31), weights-only via CP_INIT_FROM"
|
| 86 |
+
say "data: $DATA -- continuation from stream offset 629,342,677 (junction verified)"
|
| 87 |
+
say " b5 reaches 100% of its split in this run"
|
| 88 |
+
say "steps: $BASE_STEP -> $STEPS ($NEW new, $U usable)"
|
| 89 |
+
say "WSD: warmup $WARM, stable $STABLE, tail $TAIL"
|
| 90 |
+
say "evals: global $EVALS_GLOBAL = local $EVALS (full resumable at these)"
|
| 91 |
+
say "disk: ${FREEG} GB free"
|
| 92 |
+
|
| 93 |
+
ARCH="CP_N_EMBD=1536 CP_N_LAYER=36 CP_N_HEAD=12 CP_N_KVHEAD=4 CP_FFN=4096 CP_WEIGHT_TYING=0"
|
| 94 |
+
BASE="CP_SIZE=$CPSZ CP_ATTN_MODE=ring CP_ATTN_FUSION=split CP_T=$T \
|
| 95 |
+
YARN_SCALE=$SCALE YARN_ORIG_MAXPOS=$ORIG \
|
| 96 |
+
CP_ZERO=1 CP_ZERO_V2=1 CP_ZERO_SYMMETRIC=1 CP_BF16=1 CP_OPTIMIZER=muon \
|
| 97 |
+
CP_WARMUP=$WARM CP_REWARMUP=$WARM CP_REWARMUP_PEAK=0.3 \
|
| 98 |
+
CP_STABLE=$STABLE CP_CKPT=1 CP_CKPT_FREQ=$FREQ CP_CKPT_KEEP=$KEEP"
|
| 99 |
+
|
| 100 |
+
# ------------------------------------------------------------------- probe ---
|
| 101 |
+
if [ ! -f "$LOG/probe.ok" ]; then
|
| 102 |
+
say "PHASE 1: 3-step probe (8,192 tok/rank; expect ~70 GB of 81.5)"
|
| 103 |
+
env $ARCH $BASE CP_STABLE=0 CP_CKPT=0 \
|
| 104 |
+
CP_INIT_FROM="$PWD/$PARENT" CP_DATA_ROOT="$PWD/$DATA" \
|
| 105 |
+
CP_B=1 CP_GLOBAL_BATCH=$(( T * NP / CPSZ )) CP_MAX_STEPS=3 \
|
| 106 |
+
CUDA_VISIBLE_DEVICES=$GPUS mpirun --allow-run-as-root -np $NP "$EXE" \
|
| 107 |
+
> "$LOG/probe.log" 2>&1
|
| 108 |
+
RC=$?
|
| 109 |
+
grep -qaiE 'out of memory|bad_alloc' "$LOG/probe.log" && { say "PROBE OOM at cp=$CPSZ"; exit 1; }
|
| 110 |
+
grep -qaE 'terminate called|std::runtime_error|Signal: Aborted' "$LOG/probe.log" && {
|
| 111 |
+
say "PROBE CRASHED:"; grep -aA1 'terminate called' "$LOG/probe.log" | grep -a 'what()' | head -1 >&2; exit 1; }
|
| 112 |
+
N=$(grep -acE '^step +[0-9]+ \|' "$LOG/probe.log"); P=$(grep -aoE 'mem: [0-9]+MB' "$LOG/probe.log" | tail -1)
|
| 113 |
+
[ "$RC" -eq 0 ] && [ "$N" -ge 1 ] && [ -n "$P" ] || { say "PROBE FAILED (rc=$RC steps=$N peak='$P')"; tail -15 "$LOG/probe.log" >&2; exit 1; }
|
| 114 |
+
say "PROBE OK: $N steps, peak $P"; touch "$LOG/probe.ok"
|
| 115 |
+
fi
|
| 116 |
+
|
| 117 |
+
# ---- one continuous run; the shipper handles checkpoints, evals come after ---
|
| 118 |
+
say "PHASE 2: training $BASE_STEP -> $STEPS"
|
| 119 |
+
env $ARCH $BASE CP_INIT_FROM="$PWD/$PARENT" CP_CKPT_NEW_RUN=1 CP_DATA_ROOT="$PWD/$DATA" \
|
| 120 |
+
CP_B=1 CP_GLOBAL_BATCH=$GB CP_MAX_STEPS=$NEW \
|
| 121 |
+
CUDA_VISIBLE_DEVICES=$GPUS mpirun --allow-run-as-root -np $NP "$EXE" \
|
| 122 |
+
>> "$LOG/train.log" 2>&1
|
| 123 |
+
grep -qaiE 'out of memory|bad_alloc' "$LOG/train.log" && die "OOM"
|
| 124 |
+
RN=$(grep -aoE 'CP_Training_log[0-9]+' "$LOG/train.log" | head -1 | grep -oE '[0-9]+')
|
| 125 |
+
[ -n "$RN" ] || die "no run number"; echo "$RN" > "$LOG/runnum"
|
| 126 |
+
say "training done, run $RN, $(grep -aE '^step ' "$LOG/train.log" | tail -1 | grep -oE 'loss: [0-9.]+')"
|
| 127 |
+
say " peak mem $(grep -aoE 'mem: [0-9]+MB' "$LOG/train.log" | tail -1)"
|
| 128 |
+
say "=== PHASE 2 COMPLETE -- finisher takes over for evals and upload ==="
|