Buckets:
| # Follow-up queue after the s42 result (EMA weights 89.90 / 88.93 vs raw 88.04 / 86.68). Runs after | |
| # outputs/stage1_v2/final_likeforlike.sh has finished; every step is skipped when its result exists, | |
| # so the script can be re-launched and continues where it stopped. | |
| # | |
| # s42more : three more stage-1 evals of s42 (EMA r3, raw r3, EMA r4): is EMA - raw = +2 real? ~1 h | |
| # speeddrop : speeddrop on top of the v2 s42 EMA stage 1: config/fastvlm_stage3_oracle.yaml + speed | |
| # dropout 0.3 (the original speeddrop recipe), plus weight EMA and the same held-out routes | |
| # as stage 1 -> outputs/fastvlm_stage3_speeddrop/s1v2_s42ema ~2 h | |
| # then three concurrent evals, oracle objects + SPEED_MASK_STALL_S=15 (reference: original | |
| # 91.53; repro2 88.45 / 88.59; old final policy through this path 92.07): EMA x2, raw x1 ~1 h | |
| # final : tracker_sp fine-tune (1 epoch, config/fastvlm_stage3_tracker.yaml + EMA) of that speeddrop's | |
| # EMA weights on the old machine's tracker bank, then three evals of its EMA weights with the | |
| # old machine's detector at 4 Hz, no speed mask. Same path as repro2_oldbank_final_r1..3 | |
| # (baseline recipe on this machine: 90.03 / 90.75 / 90.58) and nodetfold1_newenv_r1/r2 | |
| # (old policy: 91.18 / 91.58); target 91.47 / 91.49. ~40 min + 1 h | |
| # final_raw : three evals of that tracker_sp fine-tune's raw weights (epoch=000.ckpt), same detector path. ~1 h | |
| # s43 : stage-1 recipe v2, seed 43 (float64 EMA + the float32 replica that s42 saved) ~4 h | |
| # then evals (stage-1 settings): EMA x2 + raw x1, then raw x2 + EMA x1 ~2 h | |
| # | |
| # setsid nohup bash outputs/stage1_v2/queue2.sh > outputs/stage1_v2/queue2.stdout 2>&1 < /dev/null & | |
| # STEPS="s42more speeddrop final final_raw s43" (default) selects and orders the blocks. The script may be killed and | |
| # re-launched (e.g. with another order) at any time: running evals are waited for, not restarted, and a | |
| # running training is waited for before anything else starts. To stop the work itself: kill the script, | |
| # then the training (pkill -f train_fastvlm.py) or the evals (tmux kill-session -t <b2d220_...>). | |
| set -u | |
| cd /workspace/code/ConsDrive_v2_eval | |
| REPO=$PWD | |
| PY=/venv/fastvlm/bin/python | |
| STATE=outputs/stage1_v2 | |
| LOG=$STATE/chain.log | |
| B=eval_results/Bench2Drive | |
| STEPS=${STEPS:-"s42more speeddrop final final_raw s43"} | |
| export FASTVLM_SOURCE=/workspace/code/ml-fastvlm FASTVLM_CHECKPOINT=$REPO/pretrained/FastVLM-0.5B | |
| log() { echo "[$(date -u '+%F %T')] queue2: $*" | tee -a $LOG; } | |
| die() { log "FATAL: $*"; exit 1; } | |
| slots() { # eval index k, slot count n (two workers per slot); same GPU / CARLA rotation as reproduce_pipeline.sh | |
| local k=$1 n=$2 s="" j | |
| for ((j = 0; j < n; j++)); do s+="$(( (j + 2 * k) % 8 )):$(( (j + k) % 7 )) "; done | |
| echo "${s% }" | |
| } | |
| ds_of() { $PY -c "import json; d=json.load(open('$1/merged.json')); print(f\"DS {d['driving score']:.2f} SR {d['success rate']*100:.2f} n={d['eval num']}\")" 2>/dev/null; } | |
| merge_eval() { # merge a finished run (all 16 workers exited); returns 1 while it is incomplete | |
| local dir=$1 | |
| [ -f $dir/merged.json ] && return 0 | |
| [ "$(cat $dir/logs/w*.log 2>/dev/null | grep -c WORKER_EXIT)" -ge 16 ] || return 1 | |
| $PY merge_route_json.py -f $dir > /dev/null 2>&1 && [ -f $dir/merged.json ] | |
| } | |
| # run_evals "EXTRA_ENV" "name|run_dir|checkpoint" ... : at most 3 specs, run concurrently, blocks until all end | |
| run_evals() { | |
| local extra=$1; shift | |
| local k=0 spec name run_dir ckpt dir bad names=() | |
| [ $# -le 3 ] || die "run_evals: at most 3 concurrent evals (pid limit)" | |
| # evals that do not belong to this batch (another script's) finish first | |
| local own; own=$(printf '%s\n' "$@" | cut -d'|' -f1 | sed 's/^/^b2d220_/; s/$/_w/' | paste -sd'|') | |
| while tmux ls 2>/dev/null | grep '^b2d220_' | grep -qvE "$own"; do sleep 30; done | |
| for spec in "$@"; do | |
| IFS='|' read -r name run_dir ckpt <<< "$spec" | |
| dir=$B/$name | |
| names+=("$name") | |
| if tmux ls 2>/dev/null | grep -q "^b2d220_${name}_w"; then | |
| log "eval $name is already running, waiting for it" | |
| elif ! merge_eval $dir; then | |
| [ -f "$ckpt" ] || { log "eval $name: checkpoint $ckpt missing, skipped"; k=$((k + 1)); continue; } | |
| rm -rf $dir | |
| RUN_DIR=$run_dir CHECKPOINT=$ckpt RESULT_ROOT=$dir SLOTS="$(slots $k 8)" TAG=$name TRAJ_VIZ=0 \ | |
| PORT_BASE=$((20000 + 2000 * k)) TM_PORT_BASE=$((30000 + 2000 * k)) EXTRA_ENV="$extra" \ | |
| bash scripts/run_full220_fastvlm.sh >> $LOG 2>&1 || die "could not launch eval $name" | |
| log "eval $name launched ($(basename "$ckpt"))" | |
| fi | |
| k=$((k + 1)) | |
| done | |
| for name in "${names[@]}"; do | |
| while tmux ls 2>/dev/null | grep -q "^b2d220_${name}_w"; do sleep 60; done | |
| done | |
| for name in "${names[@]}"; do | |
| dir=$B/$name | |
| if merge_eval $dir; then | |
| bad=$(grep -l "out of memory\|can't start new thread\|Retry limit exceeded" $dir/logs/w*.log 2>/dev/null | wc -l) | |
| log "eval $name: $(ds_of $dir)$([ "$bad" -gt 0 ] && echo " WARNING: $bad worker logs with OOM / thread / retry-limit failures")" | |
| else | |
| log "eval $name: incomplete (fewer than 16 WORKER_EXIT lines), re-run the queue" | |
| fi | |
| done | |
| } | |
| # train NAME OUT FINAL_CKPT WRAPPER [VAR=value ...] -- [hydra overrides ...] (8 GPUs, resumable) | |
| train() { | |
| local name=$1 out=$2 final=$3 wrapper=$4; shift 4 | |
| local envs=() overrides=() rc | |
| while [ $# -gt 0 ] && [ "$1" != "--" ]; do envs+=("$1"); shift; done | |
| [ $# -gt 0 ] && shift | |
| overrides=("$@") | |
| if [ ! -f $out/TRAIN_DONE ] && [ -f "$final" ] && grep -q "max_epochs=[0-9]*. reached" $out/train.log 2>/dev/null; then | |
| date > $out/TRAIN_DONE # finished while the queue script was not running | |
| fi | |
| if [ -f $out/TRAIN_DONE ]; then log "$name: training already done"; return 0; fi | |
| while tmux ls 2>/dev/null | grep -q '^b2d220_'; do sleep 30; done # never train next to 220-route evals | |
| mkdir -p $out | |
| if [ -f $out/checkpoints/last.ckpt ] && [ ! -f "$final" ]; then | |
| log "$name: resuming from $out/checkpoints/last.ckpt" | |
| overrides+=("resume_checkpoint=$REPO/$out/checkpoints/last.ckpt") | |
| fi | |
| log "$name: training -> $out (${overrides[*]})" | |
| env "${envs[@]}" OUTPUT_DIR=$out bash $wrapper "${overrides[@]}" > /dev/null 2>&1 | |
| rc=$? | |
| echo "TRAIN_EXIT=$rc" >> $out/train.log | |
| [ $rc -eq 0 ] && [ -f "$final" ] || die "$name training failed (exit $rc); see $out/train.log" | |
| $PY - $out <<'PY' 2>&1 | tee -a $LOG | |
| import sys | |
| import pandas as pd | |
| m = pd.read_csv(f"{sys.argv[1]}/logs/metrics.csv") | |
| val = m.dropna(subset=["val/loss"]).groupby("epoch")["val/loss"].last() | |
| skips = m["train/nonfinite_skips"].max() if "train/nonfinite_skips" in m else float("nan") | |
| print(f"{sys.argv[1]}: held-out val/loss per epoch {[round(float(v), 3) for v in val]}, non-finite steps skipped {skips:.0f}") | |
| PY | |
| date > $out/TRAIN_DONE | |
| } | |
| # held_out_val RUN_DIR NAME CKPT ... : held-out loss of each checkpoint, one GPU each, in parallel (a few minutes) | |
| held_out_val() { | |
| local run_dir=$1 name=$2 g=0 ckpt; shift 2 | |
| mkdir -p $STATE/val | |
| for ckpt in "$@"; do | |
| [ -f "$ckpt" ] || continue | |
| CUDA_VISIBLE_DEVICES=$g VAL_OUT=$STATE/val/${name}_$g.json VAL_CKPTS="$ckpt" $PY $STATE/val_ckpts.py \ | |
| --config-path $REPO/$run_dir/.hydra --config-name config hydra.run.dir=/tmp/val_ckpts_${name}_$g hydra.output_subdir=null \ | |
| > $STATE/val/${name}_$g.log 2>&1 & | |
| g=$((g + 1)) | |
| done | |
| wait | |
| grep -h "^epoch=" $STATE/val/${name}_*.log | sed "s|^|$name held-out val: |" | tee -a $LOG | |
| } | |
| while pgrep -f "final_likeforlike.sh" > /dev/null; do sleep 30; done | |
| while pgrep -f "train_fastvlm.py|train_detector.py|train_stream_petr.py" > /dev/null; do sleep 30; done | |
| log "start: steps $STEPS" | |
| S1=outputs/fastvlm_stage1_v2 | |
| for step in $STEPS; do | |
| case $step in | |
| s42more) | |
| run_evals "" \ | |
| "s1v2_s42_ema_r3|$S1/s42|$REPO/$S1/s42/checkpoints/epoch=005_ema.ckpt" \ | |
| "s1v2_s42_raw_r3|$S1/s42|$REPO/$S1/s42/checkpoints/epoch=005.ckpt" \ | |
| "s1v2_s42_ema_r4|$S1/s42|$REPO/$S1/s42/checkpoints/epoch=005_ema.ckpt" | |
| ;; | |
| speeddrop) | |
| SD=outputs/fastvlm_stage3_speeddrop/s1v2_s42ema | |
| train "speeddrop on s42 EMA" $SD $SD/checkpoints/epoch=002.ckpt scripts/run_train_fastvlm_stage3.sh \ | |
| CONFIG_NAME=fastvlm_stage3_oracle "STAGE1_CHECKPOINT=$REPO/$S1/s42/checkpoints/epoch=005_ema.ckpt" -- \ | |
| seed=42 +model.speed_dropout_p=0.3 +ema_decay=0.9995 +data_module.holdout_split=100 | |
| [ -f $STATE/val/sd_s42ema_0.json ] || held_out_val $SD sd_s42ema "$REPO/$SD/checkpoints/epoch=002_ema.ckpt" "$REPO/$SD/checkpoints/epoch=002.ckpt" | |
| run_evals "OBJECT_SOURCE=oracle SPEED_MASK_STALL_S=15" \ | |
| "s1v2_s42ema_speeddrop_ema_mask15_r1|$SD|$REPO/$SD/checkpoints/epoch=002_ema.ckpt" \ | |
| "s1v2_s42ema_speeddrop_ema_mask15_r2|$SD|$REPO/$SD/checkpoints/epoch=002_ema.ckpt" \ | |
| "s1v2_s42ema_speeddrop_raw_mask15_r1|$SD|$REPO/$SD/checkpoints/epoch=002.ckpt" | |
| ;; | |
| final) | |
| SD=outputs/fastvlm_stage3_speeddrop/s1v2_s42ema | |
| FT=outputs/fastvlm_stage3_tracker_sp/s1v2_s42ema_oldbank | |
| [ -f $SD/checkpoints/epoch=002_ema.ckpt ] || die "final: $SD/checkpoints/epoch=002_ema.ckpt missing (run the speeddrop step first)" | |
| train "tracker_sp fine-tune of the s42-EMA speeddrop (old bank)" $FT $FT/checkpoints/epoch=000.ckpt scripts/run_train_fastvlm_stage3.sh \ | |
| CONFIG_NAME=fastvlm_stage3_tracker TRACKER_BANK_FOLDER=tracker_bank_sp "STAGE3_CHECKPOINT=$REPO/$SD/checkpoints/epoch=002_ema.ckpt" -- \ | |
| seed=42 +ema_decay=0.9995 +data_module.holdout_split=100 | |
| DET_ENV="OBJECT_SOURCE=detector DETECTOR_CKPT=$REPO/outputs/stream_petr/sp_direct_nodetfold1/last.pt DETECTOR_UPDATE_EVERY=5" | |
| run_evals "$DET_ENV" \ | |
| "s1v2_s42ema_final_ema_r1|$FT|$REPO/$FT/checkpoints/epoch=000_ema.ckpt" \ | |
| "s1v2_s42ema_final_ema_r2|$FT|$REPO/$FT/checkpoints/epoch=000_ema.ckpt" \ | |
| "s1v2_s42ema_final_ema_r3|$FT|$REPO/$FT/checkpoints/epoch=000_ema.ckpt" | |
| ;; | |
| final_raw) | |
| FT=outputs/fastvlm_stage3_tracker_sp/s1v2_s42ema_oldbank | |
| DET_ENV="OBJECT_SOURCE=detector DETECTOR_CKPT=$REPO/outputs/stream_petr/sp_direct_nodetfold1/last.pt DETECTOR_UPDATE_EVERY=5" | |
| run_evals "$DET_ENV" \ | |
| "s1v2_s42ema_final_raw_r1|$FT|$REPO/$FT/checkpoints/epoch=000.ckpt" \ | |
| "s1v2_s42ema_final_raw_r2|$FT|$REPO/$FT/checkpoints/epoch=000.ckpt" \ | |
| "s1v2_s42ema_final_raw_r3|$FT|$REPO/$FT/checkpoints/epoch=000.ckpt" | |
| ;; | |
| s43) | |
| S=$S1/s43 | |
| train "stage 1 v2 s43" $S $S/checkpoints/epoch=005.ckpt scripts/run_train_fastvlm_stage1.sh \ | |
| CONFIG_NAME=fastvlm_stage1_v2 -- seed=43 +ema_float32_replica=true | |
| [ -f $STATE/val/s43_0.json ] || held_out_val $S s43 "$REPO/$S/checkpoints/epoch=005_ema.ckpt" "$REPO/$S/checkpoints/epoch=005_ema32.ckpt" "$REPO/$S/checkpoints/epoch=005.ckpt" | |
| run_evals "" \ | |
| "s1v2_s43_ema_r1|$S|$REPO/$S/checkpoints/epoch=005_ema.ckpt" \ | |
| "s1v2_s43_ema_r2|$S|$REPO/$S/checkpoints/epoch=005_ema.ckpt" \ | |
| "s1v2_s43_raw_r1|$S|$REPO/$S/checkpoints/epoch=005.ckpt" | |
| run_evals "" \ | |
| "s1v2_s43_raw_r2|$S|$REPO/$S/checkpoints/epoch=005.ckpt" \ | |
| "s1v2_s43_ema_r3|$S|$REPO/$S/checkpoints/epoch=005_ema.ckpt" \ | |
| "s1v2_s43_raw_r3|$S|$REPO/$S/checkpoints/epoch=005.ckpt" | |
| ;; | |
| *) die "unknown step $step" ;; | |
| esac | |
| done | |
| log "done" | |
Xet Storage Details
- Size:
- 11.5 kB
- Xet hash:
- 61344e754ee0ce219be0db231684a8979159d90930fb3219c555ea7a54ca7c4e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.