File size: 2,307 Bytes
cfa2024
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
# db overnight, continuing chain_db.sh: the missing-camera fetch of train is already running (pid $1). gpu_hold.py grabs
# the GPU the moment it is free (other jobs are never stopped) and keeps it between our stages; every GPU stage releases
# it right before starting. 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() { rm -f /tmp/vlr_gpu_release; nohup $PY gpu_hold.py 9000 >> gpu_hold.log 2>&1 & HOLD=$!; }
release() { touch /tmp/vlr_gpu_release; while kill -0 $HOLD 2>/dev/null; do sleep .2; done; rm -f /tmp/vlr_gpu_release; }

rm -f /tmp/vlr_gpu_held /tmp/vlr_gpu_release
hold
until [ -f /tmp/vlr_gpu_held ]; do sleep 1; done                 # the GPU is ours
release
$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
release
$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

release
$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

release
$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