anhtld commited on
Commit
76a5bda
·
verified ·
1 Parent(s): 46b3f45

Auto-sync: 2026-06-26 07:52:27 (part 2)

Browse files
scripts/slurm/monitor_h16_training.sbatch ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ #SBATCH --job-name=monitor_h16_correct
3
+ #SBATCH --account=def-yalda
4
+ #SBATCH --time=12:00:00
5
+ #SBATCH --cpus-per-task=1
6
+ #SBATCH --mem=2G
7
+ #SBATCH --output=logs/monitor_h16_correct_%j.out
8
+ #SBATCH --error=logs/monitor_h16_correct_%j.err
9
+
10
+ # Monitor DoVLAModel h=16 training (14763330) → eval → paper
11
+ # CORRECTED: Now watches DoVLAModel (rollout-capable) not DoVLAHybrid
12
+
13
+ set -euo pipefail
14
+
15
+ TRAIN_JOB_ID=14763330
16
+ PROJECT_DIR="/lustre09/project/6037638/knguy52/vla"
17
+ PYTHON="$PROJECT_DIR/.venv/bin/python"
18
+
19
+ cd "$PROJECT_DIR"
20
+
21
+ echo "=== Monitor for DoVLAModel h=16 Training ==="
22
+ echo "Training job: $TRAIN_JOB_ID"
23
+ echo "Start: $(date)"
24
+ echo ""
25
+
26
+ # Function to check if all array tasks completed
27
+ check_training_complete() {
28
+ local states=$(sacct -j $1 --format=State --noheader 2>/dev/null | grep -v "^$")
29
+ local total=$(echo "$states" | wc -l)
30
+ local completed=$(echo "$states" | grep -c "COMPLETED" || true)
31
+
32
+ if [ "$total" -ge 3 ] && [ "$completed" -eq 3 ]; then
33
+ echo "COMPLETED"
34
+ elif echo "$states" | grep -q "FAILED\|CANCELLED\|TIMEOUT"; then
35
+ echo "FAILED"
36
+ else
37
+ echo "RUNNING"
38
+ fi
39
+ }
40
+
41
+ # Wait for training to complete
42
+ while true; do
43
+ STATUS=$(check_training_complete $TRAIN_JOB_ID)
44
+ echo "[$(date +'%H:%M:%S')] Training status: $STATUS"
45
+
46
+ if [ "$STATUS" = "COMPLETED" ]; then
47
+ echo ""
48
+ echo "✅ Training completed! Verifying checkpoints..."
49
+ echo ""
50
+
51
+ # Verify checkpoints have model_config (rollout-compatible)
52
+ $PYTHON << 'PYEOF'
53
+ import torch
54
+ from pathlib import Path
55
+
56
+ run_dir = Path("/scratch/knguy52/dovla/experiments/dovla_h16_rollout_runs")
57
+ seeds = [0, 1, 2]
58
+ checkpoints_ok = []
59
+
60
+ for seed in seeds:
61
+ ckpt_path = run_dir / f"seed_{seed}" / "best.pt"
62
+ if not ckpt_path.exists():
63
+ print(f"❌ Checkpoint missing: seed {seed}")
64
+ continue
65
+
66
+ ckpt = torch.load(ckpt_path, map_location='cpu', weights_only=False)
67
+ has_model_config = 'model_config' in ckpt
68
+
69
+ print(f"Seed {seed}: {'✅' if has_model_config else '❌'} model_config present")
70
+
71
+ if has_model_config:
72
+ checkpoints_ok.append(seed)
73
+
74
+ if len(checkpoints_ok) == 3:
75
+ print("")
76
+ print("✅ All 3 checkpoints are rollout-compatible (have model_config)")
77
+ print(" Ready for online evaluation")
78
+ Path("results/.trigger_h16_evaluation").touch()
79
+ else:
80
+ print("")
81
+ print(f"⚠️ Only {len(checkpoints_ok)}/3 checkpoints OK")
82
+ exit(1)
83
+ PYEOF
84
+
85
+ # Submit evaluation if triggered
86
+ if [ -f "results/.trigger_h16_evaluation" ]; then
87
+ echo ""
88
+ echo "Submitting online rollout evaluation..."
89
+
90
+ # Update eval sbatch to use correct checkpoints
91
+ sed -i 's|h16_policy_runs|dovla_h16_rollout_runs|g' scripts/slurm/eval_h16_rollout.sbatch
92
+
93
+ EVAL_JOB=$(sbatch scripts/slurm/eval_h16_rollout.sbatch | awk '{print $4}')
94
+ echo "Submitted eval job: $EVAL_JOB"
95
+
96
+ # Submit monitor for eval results
97
+ sed "s/EVAL_JOB_ID=.*/EVAL_JOB_ID=$EVAL_JOB/" scripts/slurm/monitor_eval.sbatch | \
98
+ sbatch --job-name=monitor_eval_h16
99
+
100
+ echo "✅ Evaluation and monitoring pipeline launched"
101
+ fi
102
+
103
+ echo ""
104
+ echo "=== Training Monitor Complete ==="
105
+ exit 0
106
+
107
+ elif [ "$STATUS" = "FAILED" ]; then
108
+ echo ""
109
+ echo "❌ Training failed"
110
+ sacct -j $TRAIN_JOB_ID --format=JobID,State,ExitCode,Reason
111
+ exit 1
112
+ fi
113
+
114
+ # Sleep 10 minutes before next check
115
+ sleep 600
116
+ done