AsianPlayer/TriDrive / code /eval /run_warning_head_gaze.sh
AsianPlayer's picture
download
raw
4.84 kB
#!/usr/bin/env bash
# cwm3/eval/run_warning_head_gaze.sh — the learned warning head with the GAZE-CHAIN features (coordinator request 2026-09-12; gaze/robustness agent), CPU only.
# bash eval/run_warning_head_gaze.sh ["0 1 2"] [n_boot_train=1000] [n_boot_eval=2000]
# Per seed k: (1) eval/predict_u0_rows.py — the U0 +chain+face run `U0_kin_can_noK_s<k>_kcv2_clip8_ln_gzfc` scored on the joint run's TRAIN label rows;
# (2) train/train_warning_head.py --run I1_all_minus_road2drv_s<k>_final --demand P --feature-sets current --extra-features dwell,face,gaze --w-suffix _dwfcgz
# (same device-grouped 5-fold CV / hp grid / labels as the `_dwfc` reference heads); (3) eval/merge_w_layouts.py _dwfc + _dwfcgz -> _gzmerged (bit-identical copies).
# Then ONE warning_gold item `cwm3_final_gaze` (unchanged cwm2/eval/warning_gold.py via eval/warning_head_eval.py, 509 gold rows), the per-regime report with the
# pre-stated kill rule (eval/warning_head_regime_report.py: adopt only if Δ vs cur+dwell+face CI excl. 0 on >= 2/3 seeds in engaged OR pooled) and the equal-load
# operating points (eval/operating_points.py --loads dms_matched,same_recall,low10) -> results/tables/warning_head_final_gaze.md. Memory gate: MemAvailable >= 18 GB
# before every step (the 2026-09-12 00:01 OOM incident). Idempotent. Every row is labelled "gaze validation pending" by eval/finish_warning_head_gaze.py.
set -u
cd "$(dirname "$0")/.."
PY=python
export OMP_NUM_THREADS=4 MKL_NUM_THREADS=4
SEEDS="${1:-0 1 2}"; NBT="${2:-1000}"; NBE="${3:-2000}"
gate() { until [ "$(awk '/MemAvailable/{print int($2/1024/1024)}' /proc/meminfo)" -ge 18 ]; do echo "[$(date +%H:%M:%S)] memory gate closed"; sleep 30; done; }
have_w() { for d in $(ls -d results/warning_head/$1_* 2>/dev/null); do $PY -c "import json,sys; d=json.load(open('$d/selected.json')); sys.exit(0 if d.get('w_suffix')=='$2' else 1)" 2>/dev/null && return 0; done; return 1; }
RUNS=()
for s in $SEEDS; do
R=I1_all_minus_road2drv_s${s}_final; U=U0_kin_can_noK_s${s}_kcv2_clip8_ln_gzfc; RUNS+=("$R")
[[ -f results/runs/$U/PRED_DONE && -f results/runs/$R/label_rows.npz ]] || { echo "skip seed $s ($U or $R/label_rows.npz missing)"; continue; }
if [[ ! -f results/runs/$U/pred_gaze_engaged_train_labelrows.npz ]]; then
gate; echo "[$(date +%H:%M:%S)] == predict_u0_rows $U"
$PY eval/predict_u0_rows.py --run $U --rows-from results/runs/$R/label_rows.npz 2>&1 | grep -E "pred_gaze|DONE|Error|Traceback|File \"" | cut -c1-200
fi
if have_w "$R" "_dwfcgz"; then echo "have warning head _dwfcgz for $R"; else
gate; echo "[$(date +%H:%M:%S)] == train_warning_head $R (+dwell,face,gaze)"
$PY train/train_warning_head.py --run "$R" --demand P --n-boot "$NBT" --feature-sets current --extra-features dwell,face,gaze --w-suffix _dwfcgz 2>&1 | grep -E "DONE|Error|Traceback|File \"|selected|gold clean_test AUROC|gaze run|train labels" | cut -c1-220
fi
[[ -f results/runs/W_${R}_dwfc/pred_layout_manual_test.npz ]] || { echo "reference W_${R}_dwfc layout missing"; continue; }
$PY eval/merge_w_layouts.py --run "$R" --suffixes _dwfc _dwfcgz --out-suffix _gzmerged 2>&1 | grep -E "wrote|have|Error|Traceback" | cut -c1-160
done
COL=W_learned_curhgb_t15_w10_n979dwfcgz; REF=W_learned_curhgb_t15_w10_n979dwfc
gate; echo "[$(date +%H:%M:%S)] == warning_head_eval --item cwm3_final_gaze"
$PY eval/warning_head_eval.py --runs "${RUNS[@]}" --item cwm3_final_gaze --n-boot "$NBE" --w-suffix _gzmerged --dir-suffixes _dwfc _dwfcgz --headline $COL --out-name warning_head_final_gaze.md \
--feature-label "current + dwell + face (the warning-head agent's reference heads, warning_head_final_ext.md) — GAZE VALIDATION PENDING applies to every gaze row" 2>&1 | grep -E "Verdict|B4|B5|written|Error|Traceback|File \"" | head -20
gate; echo "[$(date +%H:%M:%S)] == regime report"
$PY eval/warning_head_regime_report.py --item cwm3_final_gaze --cols $REF $COL W_learned_cursel_t15_w10_n979dwfc W_learned_cursel_t15_w10_n979dwfcgz \
--pairs "gaze_beyond_dwell_face:${COL}-${REF}" --ensemble-cols $COL $REF --n-boot "$NBE" --out results/tables/warning_head_final_gaze.md \
--title "Gaze-chain warning head (cur+dwell+face+gaze) vs the cur+dwell+face reference — per-regime strata, paired effect, 3-seed ensemble — GAZE VALIDATION PENDING" 2>&1 | grep -E "appended|written|Error|Traceback|File \"" | head
gate; echo "[$(date +%H:%M:%S)] == operating points"
WR=(); for s in $SEEDS; do WR+=("W_I1_all_minus_road2drv_s${s}_final_dwfcgz"); done
$PY eval/operating_points.py --item final_gaze_dwfcgz --w-runs "${WR[@]}" --seeds $SEEDS --col $COL --label "HGB(current+dwell+face+gaze)" --loads dms_matched,same_recall,low10 --n-boot "$NBT" 2>&1 | grep -E "appended|written|Error|Traceback|File \"|EQUAL|verdict" | head
$PY eval/finish_warning_head_gaze.py 2>&1 | tail -3
echo WH_GAZE_DONE

Xet Storage Details

Size:
4.84 kB
·
Xet hash:
377ceedee054885611a7b4d423b6d2fa7ba897bd3ef16d0e8789b609a4585d8d

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.