File size: 2,497 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
#!/bin/bash
# db, after chain_data.sh: the joint model (vlr_joint.py), one model for VQA and planning, from the S2 checkpoint.
# train = old train + old 227 val + supplement keyframes (8 cameras); val = official validation 1,000 clips.
# Answers and trajectories come from the same (final-epoch) checkpoint. Critical-component labels: annotation text only.
cd /home/db/ThuongBui/localization/vlr
ulimit -n "$(ulimit -Hn)" 2>/dev/null
PY=/home/db/miniforge3/envs/locnet/bin/python
D=/mnt/10TB_HDD/nuReasoning/vlr
BASE=$D/data/submission_base_G2_selA_ep05.json      # only to copy the format (clip list, question ids) once
hold() {
    [ -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
}
echo "$(date +%T) test clips without a question: records + latents (every test clip needs a VLR trajectory)"
[ -f $D/data/submission_template.json ] || $PY vlr_submit.py --make-template $BASE --out $D/data/submission_template.json
$PY vlr_build_hub.py --kind test --root /mnt/10TB_HDD/nuReasoning/data/test || exit 1
hold
$PY vlr_encode_local.py --splits test_extra > encode_test_extra.log 2>&1 &
EP=$!
until grep -q "reserved" encode_test_extra.log 2>/dev/null || ! kill -0 $EP 2>/dev/null; do sleep 1; done
hold                                         # pre-armed (no CUDA context): grabs the GPU the moment the encoder frees it,
wait $EP                                     # and keeps it while the critical-component labels run on the CPU
tail -2 encode_test_extra.log
echo "$(date +%T) critical-component labels"
$PY vlr_crit_labels.py --splits train val val_off train_supp --workers 3 > crit_labels.log 2>&1 || { echo "crit labels failed"; exit 1; }
cat crit_labels.log
echo "$(date +%T) joint training"
hold
$PY vlr_s1.py --name joint_r1 --model joint --init runs/s23_full/best.pt --ego-fut $D/data/ego_fut_v2.pkl \
    --train-split train,val,train_supp --val-split val_off --cache $D/cache --data $D/data \
    --epochs 8 --batch 8 --lr 1e-4 --export > joint_r1.log 2>&1
test -f runs/joint_r1/test_traj.json || { echo "joint training failed"; tail -20 joint_r1.log; exit 1; }
$PY vlr_submit.py --template $D/data/submission_template.json --answers runs/joint_r1/test_answers.json \
    --traj runs/joint_r1/test_traj.json --run joint_r1 --out $D/submissions/submission_vlr_joint_r1.json > submit_joint.log 2>&1
cat submit_joint.log
echo TRAIN_DONE