#!/bin/bash # db overnight, continuing after the missing-camera fetch of train (pid $1, still running). gpu_hold.py grabs the GPU # the moment it is free (other jobs are never stopped) and keeps it between our stages; each of our GPU processes takes # it over itself right before allocating (gpu_take.take_gpu). encode -> S1 -> submission -> S2 + S3 -> submissions. cd /home/db/ThuongBui/localization/vlr PY=/home/db/miniforge3/envs/locnet/bin/python D=/mnt/10TB_HDD/nuReasoning/vlr BASE=$D/data/submission_base_G2_selA_ep05.json FETCH_PID=$1 hold() { # start a holder unless one is alive [ -f /tmp/vlr_gpu_hold.pid ] && kill -0 "$(cat /tmp/vlr_gpu_hold.pid)" 2>/dev/null && return rm -f /tmp/vlr_gpu_held /tmp/vlr_gpu_release nohup $PY gpu_hold.py 9000 >> gpu_hold.log 2>&1 & sleep 1 } hold $PY vlr_encode_local.py --splits val test --min-free 9000 > encode_local.log 2>&1 hold grep -q ENCODE_DONE encode_local.log || { echo "encode val/test failed"; exit 1; } while kill -0 $FETCH_PID 2>/dev/null; do sleep 30; done $PY vlr_encode_local.py --splits train --min-free 9000 > encode_local_train.log 2>&1 hold grep -q ENCODE_DONE encode_local_train.log || { echo "encode train failed"; exit 1; } $PY vlr_fetch_side.py --splits val train --delete > fetch_side_delete.log 2>&1 $PY vlr_s1.py --name s1_full --cache $D/cache --data $D/data --epochs 10 --batch 8 --export > s1_full.log 2>&1 hold test -f runs/s1_full/test_answers.json || { echo "S1 failed"; exit 1; } $PY vlr_submit.py --base $BASE --answers runs/s1_full/test_answers.json --out $D/submissions/submission_vlr_s1.json > submit.log 2>&1 $PY vlr_s1.py --name s23_full --model plan --init runs/s1_full/best.pt --ego-fut $D/data/ego_fut.pkl --cache $D/cache \ --data $D/data --epochs 6 --batch 8 --lr 1e-4 --export > s23_full.log 2>&1 test -f runs/s23_full/test_traj.json || { echo "S2+S3 failed"; exit 1; } $PY vlr_submit.py --base $BASE --answers runs/s23_full/test_answers.json --out $D/submissions/submission_vlr_s2.json >> submit.log 2>&1 $PY vlr_submit.py --base $BASE --answers runs/s23_full/test_answers.json --traj runs/s23_full/test_traj.json \ --out $D/submissions/submission_vlr_s23.json >> submit.log 2>&1 echo CHAIN_DONE