From 836c2a11e161b8b371b0ba049475becffa2b8665 Mon Sep 17 00:00:00 2001 From: hugypufy Date: Fri, 23 Oct 2026 00:20:32 +0100 Subject: [PATCH] night tooling persisted (chain2 with --draft, lanes, gsm8k/conc harnesses, watchdog, dashboard); runbook: all three FTs complete, eval-chain resume steps --- REMAINING.md | 57 +++++++++++++++++++++++-------------- scripts/night/chain2.sh | 17 +++++++++++ scripts/night/conc.py | 13 +++++++++ scripts/night/eval-lane3.sh | 16 +++++++++++ scripts/night/gsm8k1.py | 30 +++++++++++++++++++ scripts/night/lanes.tsv | 3 ++ scripts/night/watch-lane.sh | 29 +++++++++++++++++++ 7 files changed, 144 insertions(+), 21 deletions(-) create mode 100755 scripts/night/chain2.sh create mode 100644 scripts/night/conc.py create mode 100755 scripts/night/eval-lane3.sh create mode 100644 scripts/night/gsm8k1.py create mode 100644 scripts/night/lanes.tsv create mode 100755 scripts/night/watch-lane.sh diff --git a/REMAINING.md b/REMAINING.md index 1e7f67c2..146d1540 100644 --- a/REMAINING.md +++ b/REMAINING.md @@ -1,30 +1,45 @@ # M2XFP ("MXFP4v2") on radiance — work record + resume runbook -_Updated: 2026-10-21 12:46 — HOST SHUTDOWN at user request. Three fine-tunes were interrupted mid-run and resume automatically._ +_Updated: 2026-10-23 00:25 — ALL THREE FINE-TUNES COMPLETE (400/400). Eval chain in flight; safe to power off anytime — resume below._ -## WHERE THE FINE-TUNES STOPPED (12:45) -| Run | Files | Meaning | -|---|---|---| -| MAIN (FOLD=kernel, seed 0) | **118/400** | layers 0–18 TRAINED (layer 18 landed 12:41 — the 13-hour blocker is solved) | -| EXACT (FOLD=exact) | 31/400 | layers 0–4 trained | -| SEED1 (seed 1) | 31/400 | layers 0–4 trained | -Resume is automatic and lossless (per-layer .pt files); each restart re-pays ~10–15 min capture + replay of finished layers (~2 min/layer). +## STATE (2026-10-23 00:25) — training DONE, evaluation in flight +| Run | Train | Convert (HF ckpt at ~/models) | Pack+KL | +|---|---|---|---| +| MAIN | ✅ 400/400 | ✅ Qwen3.8-27B-PARO-M2XFP4-FT | in flight / redo if power lost | +| EXACT (FOLD=exact) | ✅ 400/400 | ✅/finishing …-FT-EXACT | pending | +| SEED1 | ✅ 400/400 | ✅/finishing …-FT-SEED1 | pending | +Night scripts persisted at `scripts/night/` (chain2.sh, lanes.tsv, gsm8k1.py, conc.py, ft-live.sh). /tmp copies die on reboot — use the persisted ones. -## RESUME AFTER BOOT (in order) +## RESUME TOMORROW (after boot, in order) ```bash -cd /home/zee/code/llm && task stop-llama-swap # it cold-starts vLLM onto GPUs at boot -docker rm -f paro_stage2 paro_s2_exact paro_s2_seed1 2>/dev/null # stale names block relaunch -cd /home/zee/code/vllm/ggz14/paroquant -FORCE=1 PARO_HIP_VISIBLE=1 FT_EPOCHS=1 PARO_ROT_KERNEL=1 setsid nohup ./stage2-m2xfp4.sh finetune >> /tmp/ft-full.log 2>&1 & -FORCE=1 PARO_HIP_VISIBLE=0 FT_EPOCHS=1 PARO_ROT_KERNEL=1 M2XFP4_FOLD=exact PARO_NAME=paro_s2_exact \ - FT_RESULTS=/media/zee/ai/paro-out-ft-m2xfp4-exact OUT=Qwen3.8-27B-PARO-M2XFP4-FT-EXACT setsid nohup ./stage2-m2xfp4.sh finetune >> /tmp/ft-exact.log 2>&1 & -FORCE=1 PARO_HIP_VISIBLE=3 FT_EPOCHS=1 PARO_ROT_KERNEL=1 PARO_SEED=1 PARO_NAME=paro_s2_seed1 \ - FT_RESULTS=/media/zee/ai/paro-out-ft-m2xfp4-seed1 OUT=Qwen3.8-27B-PARO-M2XFP4-FT-SEED1 setsid nohup ./stage2-m2xfp4.sh finetune >> /tmp/ft-seed1.log 2>&1 & -setsid nohup /tmp/ft-watch9.sh >/dev/null 2>&1 & # watchdog (needs /tmp scripts — see below if wiped) -setsid nohup /tmp/ft-pipeline.sh >/dev/null 2>&1 & # auto convert→pack→serve→KL at 400 files +cd /home/zee/code/llm && task stop-llama-swap +# packs + KL for all three (idempotent; skips nothing, ~25 min/lane; one GPU each — hip2/4/0 are fine, hip3=W6600 never): +R=/home/zee/orca/workspaces/radiance/m2xfp +setsid nohup $R/scripts/night/chain2.sh MAIN 2 skip > /tmp/chain-M.log 2>&1 & # convert already done -> skip +setsid nohup $R/scripts/night/chain2.sh EXACT 4 skip > /tmp/chain-E.log 2>&1 & # skip IF its convert finished, else drop 'skip' +setsid nohup $R/scripts/night/chain2.sh SEED1 0 skip > /tmp/chain-S.log 2>&1 & ``` -Watch: `watch -n 10 -c /tmp/ft-live.sh` (all three runs, files %, ALIVE/STALLED). -If /tmp scripts were wiped by the reboot, they are small: watchdog = poll files+loglines+logbytes+reads every 2 min, restart on 15 min frozen (45 min during the silent initial capture); pipeline = wait for /home/zee/models/Qwen3.8-27B-PARO-M2XFP4-FT/config.json → pack → serve :39475 GPU0 → KL vs kld-bf16. +NOTE: chain2.sh's pack step needs `--draft /home/zee/models/hf/Qwen3.8-27B-DFlash2` added (edit the persisted copy first — the DF2 recipe's blk.64 = drafter needs it; discovered 00:20). Then read the three `/home/zee/models/rad/kld-{MAIN,EXACT,SEED1}-vs-bf16.json`, pick the lowest mean KL (baselines: RTN 0.0348, AWQ 0.0599), and for the winner run: df2 acceptance test, 30–60 min abort soak, GSM8K (scripts/night/gsm8k1.py against a serve of the winner container, port 39476, host binary pinned hip2). RTN GSM8K 200 = 92.5 %, conc 16× = 608 tok/s (the bars to beat/confirm). + +## RESUME AFTER BOOT (in order) — v2, crash-aware +```bash +cd /home/zee/code/llm && task stop-llama-swap # cold-starts vLLM onto GPUs at boot +docker rm -f paro_s2_MAIN paro_s2_EXACT paro_s2_SEED1 2>/dev/null +mkdir -p /tmp/night # /tmp is tmpfs — tooling must be recreated after every boot +cd /home/zee/code/vllm/ggz14/paroquant +# launch STAGGERED (90s apart — simultaneous 52G mmaps storm amdgpu SVM): +FORCE=1 PARO_HIP_VISIBLE=0 FT_EPOCHS=1 PARO_ROT_KERNEL=1 PARO_NAME=paro_s2_MAIN FT_RESULTS=/media/zee/ai/paro-out-ft-m2xfp4 OUT=Qwen3.8-27B-PARO-M2XFP4-FT setsid nohup ./stage2-m2xfp4.sh finetune > /tmp/ft-MAIN.log 2>&1 & +# (+90s) same + PARO_HIP_VISIBLE=1 M2XFP4_FOLD=exact PARO_NAME=paro_s2_EXACT FT_RESULTS=/media/zee/ai/paro-out-ft-m2xfp4-exact OUT=Qwen3.8-27B-PARO-M2XFP4-FT-EXACT > /tmp/ft-EXACT.log +# (+180s) same + PARO_HIP_VISIBLE=2 PARO_SEED=1 PARO_NAME=paro_s2_SEED1 FT_RESULTS=/media/zee/ai/paro-out-ft-m2xfp4-seed1 OUT=Qwen3.8-27B-PARO-M2XFP4-FT-SEED1 > /tmp/ft-SEED1.log +# watchdogs: recreate /tmp/night/watch-lane.sh (frozen-progress, phase-aware) + lanes.tsv; run one per lane +``` +Watch: `watch -n 10 -c /tmp/ft-live.sh` (files %, bar, ETA, tripwire count, RAM). + +## CRASH 2026-10-22 14:24 — amdgpu SVM workqueue lockup +Hard freeze, no OOM (0 hits), no GPU reset, no clean shutdown. Last kernel line: `workqueue: svm_range_restore_work [amdgpu] hogged CPU for >10000us 19 times`. Trigger: 3 concurrent torch FT processes (52 G mmap each) on the now-5-GPU box + a 4th radiance process probing devices. Mitigations in force: staggered lane starts; NO host radiance serve while lanes run (converts/serves go through docker with an explicit HIP pin); no 52 G pre-fault `cat`; kernel tripwire armed on `svm_range_restore_work|soft lockup`. If it recurs: drop to 2 lanes (SEED1 is the sacrificial one — MAIN + EXACT carry the quality story). + +## GPU PREFERENCE (user, 2026-10-22 20:55) +**hip2 = 0000:2c:00.0 is the newest R9700 — prefer it for the heaviest training/compute lanes** on any future cold start or lane restart (current run keeps its placement mid-flight; a move re-pays ~1 h capture+replay). Order for new lanes: hip2 first, then hip4, hip1, hip0. hip3 = W6600, never. ## ROOT CAUSES FOUND TODAY (all evidence-backed — do not re-litigate) 1. **GPU wedges → driver resets** = LACT **−100 mV undervolt** under sustained load. Fixed by user at 11:00 (all R9700s 0 offset / 0 clock offset / 250 W). Zero resets since, across 3 concurrent FTs. **Do not re-undervolt while training.** diff --git a/scripts/night/chain2.sh b/scripts/night/chain2.sh new file mode 100755 index 00000000..07fb6df7 --- /dev/null +++ b/scripts/night/chain2.sh @@ -0,0 +1,17 @@ +#!/bin/bash +NAME=$1; HIP=$2; SKIP_CONV=$3 +IFS=$'\t' read -r _n _h DIR OUT EXTRA <<< "$(grep -P "^$NAME\t" /tmp/night/lanes.tsv)" +LOG=/tmp/night/cpk-$NAME.log +R=/home/zee/orca/workspaces/radiance/m2xfp +if [ "$SKIP_CONV" != "skip" ]; then + echo "$(date -Is) $NAME convert start (hip$HIP)" >> $LOG + cd /home/zee/code/vllm/ggz14/paroquant || exit 1 + env FORCE=1 PARO_HIP_VISIBLE=$HIP PARO_NAME=paro_cnv_$NAME FT_RESULTS=$DIR OUT=$OUT $EXTRA ./stage2-m2xfp4.sh convert >> $LOG 2>&1 || { echo "$(date -Is) $NAME CONVERT FAILED" >> $LOG; exit 1; } +fi +echo "$(date -Is) $NAME pack start" >> $LOG +cd $R || exit 1 +PATH=$R/build-r4d/bin:$PATH python3 tools/rad_pack_m2xfp4.py /home/zee/models/$OUT --home $R/build-r4d/radiance_home --recipe data/recipes/q38-27b-paro-m2xfp4-df2.recipe --draft /home/zee/models/hf/Qwen3.8-27B-DFlash2 -o /media/zee/ai/radiance/containers/q38-27b-m2xfp4-ft-$NAME.rad >> $LOG 2>&1 || { echo "$(date -Is) $NAME PACK FAILED" >> $LOG; exit 1; } +echo "$(date -Is) $NAME kld start" >> $LOG +cd $R/build-r4d || exit 1 +HIP_VISIBLE_DEVICES=$HIP GPU_MAX_ALLOC_PERCENT=100 GPU_MAX_HEAP_SIZE=100 ./bin/radiance --model /media/zee/ai/radiance/containers/q38-27b-m2xfp4-ft-$NAME.rad --radiance-home radiance_home --kld-ref /home/zee/models/rad/kld-bf16 --kld-out /home/zee/models/rad/kld-$NAME-vs-bf16.json >> $LOG 2>&1 +echo "$(date -Is) $NAME CHAIN DONE rc=$?" >> $LOG diff --git a/scripts/night/conc.py b/scripts/night/conc.py new file mode 100644 index 00000000..a25b34b1 --- /dev/null +++ b/scripts/night/conc.py @@ -0,0 +1,13 @@ +import json, sys, time, urllib.request, threading +PORT=int(sys.argv[1]) +def one(out): + body=json.dumps({"model":"qwen35","messages":[{"role":"user","content":"Write a detailed essay about the history of computing, covering many decades."}],"max_tokens":256,"temperature":0.7,"stream":False}).encode() + t0=time.time() + r=urllib.request.urlopen(urllib.request.Request(f"http://127.0.0.1:{PORT}/v1/chat/completions",data=body,headers={"Content-Type":"application/json"}),timeout=600).read() + out.append(json.loads(r)["usage"]["completion_tokens"]/(time.time()-t0)) +for c in (1,4,8,16): + out=[]; th=[threading.Thread(target=one,args=(out,)) for _ in range(c)] + t0=time.time() + for t in th: t.start() + for t in th: t.join() + print(f"conc={c}: {sum(out):.1f} tok/s aggregate ({time.time()-t0:.0f}s)") diff --git a/scripts/night/eval-lane3.sh b/scripts/night/eval-lane3.sh new file mode 100755 index 00000000..5cffc9b4 --- /dev/null +++ b/scripts/night/eval-lane3.sh @@ -0,0 +1,16 @@ +#!/bin/bash +LOG=/tmp/night/eval.log +cd /home/zee/orca/workspaces/radiance/m2xfp/build-r4d +pkill -f 'bin/radianc[e].*39476' 2>/dev/null; sleep 2 +HIP_VISIBLE_DEVICES=2 GPU_MAX_ALLOC_PERCENT=100 GPU_MAX_HEAP_SIZE=100 nohup ./bin/radiance \ + --model /media/zee/ai/radiance/containers/q38-27b-m2xfp4.rad \ + --radiance-home radiance_home --host 127.0.0.1 --port 39476 \ + --max-num-seqs 16 --max-model-len 16384 > /tmp/night/eval-serve.log 2>&1 & +SPID=$! +for i in $(seq 1 180); do curl -sf :39476/health >/dev/null 2>&1 && break; sleep 5; done +curl -sf :39476/health >/dev/null 2>&1 || { echo "$(date -Is) SERVE FAILED (host)" >> $LOG; exit 1; } +echo "$(date -Is) healthy (host, hip2)" >> $LOG +python3 /tmp/night/gsm8k1.py 200 39476 /home/zee/models/rad/gsm8k-m2xfp4-rtn.json >> $LOG 2>&1 +python3 /tmp/night/conc.py 39476 >> $LOG 2>&1 +kill $SPID 2>/dev/null +echo "$(date -Is) EVAL DONE (hip2 free)" >> $LOG diff --git a/scripts/night/gsm8k1.py b/scripts/night/gsm8k1.py new file mode 100644 index 00000000..2a2f6cdf --- /dev/null +++ b/scripts/night/gsm8k1.py @@ -0,0 +1,30 @@ +import json, re, sys, urllib.request +from concurrent.futures import ThreadPoolExecutor +N=int(sys.argv[1]); PORT=int(sys.argv[2]); OUT=sys.argv[3] +items=json.load(open("/home/zee/models/calib/gsm8k/test.json"))[:N] +PROMPT=("Solve this maths problem step by step. End with exactly: The answer is \n\nProblem: %s") +def norm(a): + a=a.replace(",","").replace("$","").strip() + try: return float(a) + except: return None +def ask(q): + body=json.dumps({"model":"qwen35","messages":[{"role":"user","content":PROMPT%q}], + "max_tokens":700,"temperature":0,"reasoning_effort":"none"}).encode() + r=urllib.request.urlopen(urllib.request.Request(f"http://127.0.0.1:{PORT}/v1/chat/completions",data=body, + headers={"Content-Type":"application/json"}),timeout=600).read() + return json.loads(r)["choices"][0]["message"].get("content") or "" +def extract(t): + m=re.findall(r"answer is\s*\$?([-\d][\d,\.]*)", t, re.I) + if m: return norm(m[-1]) + m=re.findall(r"([-\d][\d,\.]*)\s*$", t.strip()) + return norm(m[-1]) if m else None +res={} +def one(i): + q=items[i]["q"]; g=norm(items[i]["a"]) + try: t=ask(q) + except Exception: res[i]=(False,g,None,"ERR"); return + p=extract(t); res[i]=(p is not None and g is not None and abs(p-g)<1e-6, g, p, t) +with ThreadPoolExecutor(max_workers=8) as ex: list(ex.map(one, range(len(items)))) +c=sum(1 for v in res.values() if v[0]) +print(f"GSM8K {N}: {c}/{len(res)} = {100*c/len(res):.1f}%") +json.dump({str(k):v[:3] for k,v in res.items()},open(OUT,"w")) diff --git a/scripts/night/lanes.tsv b/scripts/night/lanes.tsv new file mode 100644 index 00000000..5d3d2865 --- /dev/null +++ b/scripts/night/lanes.tsv @@ -0,0 +1,3 @@ +MAIN 4 /media/zee/ai/paro-out-ft-m2xfp4 Qwen3.8-27B-PARO-M2XFP4-FT +EXACT 1 /media/zee/ai/paro-out-ft-m2xfp4-exact Qwen3.8-27B-PARO-M2XFP4-FT-EXACT M2XFP4_FOLD=exact +SEED1 0 /media/zee/ai/paro-out-ft-m2xfp4-seed1 Qwen3.8-27B-PARO-M2XFP4-FT-SEED1 PARO_SEED=1 diff --git a/scripts/night/watch-lane.sh b/scripts/night/watch-lane.sh new file mode 100755 index 00000000..00186cd2 --- /dev/null +++ b/scripts/night/watch-lane.sh @@ -0,0 +1,29 @@ +#!/bin/bash +NAME=$1; CTR=paro_s2_$NAME +IFS=$'\t' read -r _name HIP DIR OUT EXTRA <<< "$(grep -P "^$NAME\t" /tmp/night/lanes.tsv)" +LOG=/tmp/night/watch-$NAME.log; : >> $LOG +last=""; since=$(date +%s); up=0 +while :; do + n=$(ls $DIR/Qwen3.8-27B-fp16/*.pt 2>/dev/null | wc -l) + lb=$(docker logs $CTR 2>&1 | wc -c) + io=$(docker exec $CTR sh -c 'awk "/^rchar/{print \$2}" /proc/1/io' 2>/dev/null) + fp="$n:$lb:${io:-0}"; now=$(date +%s) + [ "$fp" != "$last" ] && { last=$fp; since=$now; } + cap=$(docker logs $CTR 2>&1 | grep -ac "Capturing original"); opt=$(docker logs $CTR 2>&1 | grep -ac "Optimizing layer") + echo "$(date -Is) $NAME files=$n idle=$(( (now-since)/60 ))m" >> $LOG + [ "$n" -ge 400 ] && { echo "$(date -Is) $NAME COMPLETE" >> $LOG; break; } + docker ps --filter name=$CTR --format '{{.ID}}' | grep -q . && up=1 + if [ "$up" = 0 ] && [ $(( now - since )) -lt 420 ]; then sleep 60; continue; fi + if ! docker ps --filter name=$CTR --format '{{.ID}}' | grep -q .; then + echo "$(date -Is) $NAME gone -> relaunch" >> $LOG + else + thresh=15; [ "$cap" = "0" ] && [ "$opt" = "0" ] && thresh=45 + if [ $(( (now-since)/60 )) -lt $thresh ]; then sleep 90; continue; fi + docker exec $CTR /src/.pyspy/bin/py-spy dump --pid 1 > /tmp/ft-hang-$NAME-$(date +%H%M%S).txt 2>&1 + echo "$(date -Is) $NAME FROZEN -> dump+relaunch" >> $LOG + docker rm -f $CTR >/dev/null 2>&1; sleep 8 + fi + cd /home/zee/code/vllm/ggz14/paroquant && env FORCE=1 PARO_HIP_VISIBLE=$HIP FT_EPOCHS=1 PARO_ROT_KERNEL=1 $EXTRA \ + PARO_NAME=$CTR FT_RESULTS=$DIR OUT=$OUT setsid nohup ./stage2-m2xfp4.sh finetune >> /tmp/ft-$NAME.log 2>&1 < /dev/null & + sleep 300 +done