Upload fork_launch.sh with huggingface_hub
Browse files- fork_launch.sh +52 -0
fork_launch.sh
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# fork_launch.sh — RB4 branching: resume v1_muon @280k and continue on a given data-dir.
|
| 3 |
+
# Reads arch+recipe from ckpt["config"]; supplies matched training hyperparams (batch/lr/opt).
|
| 4 |
+
# fresh-resume-arcmix (2sigma-seed) and fork-B (arcmix+edu) MUST share batch/recipe (this script).
|
| 5 |
+
#
|
| 6 |
+
# Usage: bash fork_launch.sh <DATA_DIR> <OUT_DIR> <HF_SUBDIR> <SEED>
|
| 7 |
+
# DATA_DIR : dir containing train.bin + val.bin (uint16)
|
| 8 |
+
# OUT_DIR : run dir; ckpt.pt (=ckpt_280k) placed here for --resume
|
| 9 |
+
# HF_SUBDIR: HF subdir under SlayerLab/gollem-v5-ckpts for autopush (e.g. forkA_arcmix_seed7)
|
| 10 |
+
# SEED : rng seed
|
| 11 |
+
set -euo pipefail
|
| 12 |
+
DATA_DIR="$1"; OUT="$2"; HFSUB="$3"; SEED="${4:-1337}"
|
| 13 |
+
export HF_HUB_ENABLE_HF_TRANSFER=0
|
| 14 |
+
export HF_TOKEN="$(cat ~/.cache/huggingface/token)"
|
| 15 |
+
|
| 16 |
+
echo "=== fork_launch: DATA_DIR=$DATA_DIR OUT=$OUT HFSUB=$HFSUB SEED=$SEED ==="
|
| 17 |
+
mkdir -p "$OUT"
|
| 18 |
+
# resume ckpt must be at $OUT/ckpt.pt
|
| 19 |
+
if [ ! -f "$OUT/ckpt.pt" ]; then echo "!! missing $OUT/ckpt.pt (branch-point)"; exit 1; fi
|
| 20 |
+
|
| 21 |
+
# read arch+recipe from ckpt config
|
| 22 |
+
CFG="$(python - "$OUT/ckpt.pt" <<'PY'
|
| 23 |
+
import sys, torch
|
| 24 |
+
c = torch.load(sys.argv[1], map_location="cpu")["config"]
|
| 25 |
+
s = (f"--n-layer {c['n_layer']} --n-embd {c['n_embd']} --n-head {c['n_head']} "
|
| 26 |
+
f"--block {c['block']} --vocab {c['vocab']} --norm {c['norm']} --pos {c['pos']} "
|
| 27 |
+
f"--rope-theta {c['rope_theta']} --ffn {c['ffn']} --ffn-mult {c['ffn_mult']}")
|
| 28 |
+
if c.get("value_residual"): s += " --value-residual"
|
| 29 |
+
if c.get("qk_norm"): s += " --qk-norm"
|
| 30 |
+
print(s)
|
| 31 |
+
PY
|
| 32 |
+
)"
|
| 33 |
+
echo "CKPT-CONFIG: $CFG"
|
| 34 |
+
|
| 35 |
+
# v1 recipe training hyperparams (matched across forks); batch=32 (5090-safe, ~33k tok/step)
|
| 36 |
+
nohup python -u train_gpt_ref.py \
|
| 37 |
+
--data-dir "$DATA_DIR" --out-dir "$OUT" \
|
| 38 |
+
$CFG \
|
| 39 |
+
--batch 32 --steps 400000 --lr 6e-4 --min-lr 6e-5 --warmup 2000 --wd 0.1 \
|
| 40 |
+
--optimizer muon --muon-lr 0.02 --dtype uint16 --seed "$SEED" \
|
| 41 |
+
--ckpt-every 20000 --eval-every 999999 --log-every 200 \
|
| 42 |
+
--events-jsonl "$OUT/events.jsonl" --compile --resume \
|
| 43 |
+
> "$OUT/train.log" 2>&1 &
|
| 44 |
+
TRAIN_PID=$!
|
| 45 |
+
echo "TRAIN-PID=$TRAIN_PID (log: $OUT/train.log)"
|
| 46 |
+
|
| 47 |
+
# autopush ckpts to HF as they land (ckpt.pt is a FILE, not dir)
|
| 48 |
+
sleep 5
|
| 49 |
+
nohup python -u ckpt_autopush.py "$OUT/train.log" "$OUT/ckpt.pt" "$HFSUB" \
|
| 50 |
+
> "$OUT/autopush.log" 2>&1 &
|
| 51 |
+
echo "AUTOPUSH-PID=$! (HF subdir: $HFSUB)"
|
| 52 |
+
echo "=== launched. tail -f $OUT/train.log ==="
|