anhtld commited on
Commit
617ea71
·
verified ·
1 Parent(s): dea85ca

Auto-sync: 2026-06-26 11:20:27

Browse files
scripts/slurm/monitor_eval_final.sbatch ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ #SBATCH --job-name=monitor_eval_final
3
+ #SBATCH --account=def-yalda
4
+ #SBATCH --time=08:00:00
5
+ #SBATCH --cpus-per-task=1
6
+ #SBATCH --mem=2G
7
+ #SBATCH --output=logs/monitor_eval_final_%j.out
8
+ #SBATCH --error=logs/monitor_eval_final_%j.err
9
+
10
+ # Monitor eval 14775756 → parse → assess → generate paper if warranted
11
+ # HONEST: Only claim what data supports
12
+
13
+ set -euo pipefail
14
+
15
+ EVAL_JOB_ID=14775756
16
+ PROJECT_DIR="/lustre09/project/6037638/knguy52/vla"
17
+ PYTHON="$PROJECT_DIR/.venv/bin/python"
18
+
19
+ cd "$PROJECT_DIR"
20
+
21
+ echo "=== Final Evaluation Monitor ==="
22
+ echo "Job: $EVAL_JOB_ID"
23
+ echo "Start: $(date)"
24
+ echo ""
25
+
26
+ check_eval_complete() {
27
+ local states=$(sacct -j $1 --format=State --noheader 2>/dev/null)
28
+ local completed=$(echo "$states" | grep -c "COMPLETED" || true)
29
+
30
+ if [ "$completed" -ge 3 ]; then
31
+ echo "COMPLETED"
32
+ elif echo "$states" | grep -q "FAILED\|CANCELLED\|TIMEOUT"; then
33
+ echo "FAILED"
34
+ else
35
+ echo "RUNNING"
36
+ fi
37
+ }
38
+
39
+ while true; do
40
+ STATUS=$(check_eval_complete $EVAL_JOB_ID)
41
+ echo "[$(date +'%H:%M:%S')] Eval status: $STATUS"
42
+
43
+ if [ "$STATUS" = "COMPLETED" ]; then
44
+ echo ""
45
+ echo "✅ Evaluation completed! Parsing results..."
46
+ echo ""
47
+
48
+ $PYTHON << 'PYEOF'
49
+ import json
50
+ from pathlib import Path
51
+ import statistics
52
+
53
+ results_dir = Path("/scratch/knguy52/dovla/experiments/dovla_h16_rollout_runs")
54
+ seeds = [0, 1, 2]
55
+ all_results = []
56
+
57
+ for seed in seeds:
58
+ result_file = results_dir / f"seed_{seed}" / "online_rollout.json"
59
+ if result_file.exists():
60
+ with open(result_file) as f:
61
+ data = json.load(f)
62
+ all_results.append({
63
+ 'seed': seed,
64
+ 'policy_success': data.get('policy_rollout_success_rate', 0),
65
+ 'per_task': data.get('per_task', {})
66
+ })
67
+
68
+ if not all_results:
69
+ print("❌ No results found!")
70
+ exit(1)
71
+
72
+ # Compute statistics
73
+ success_rates = [r['policy_success'] for r in all_results]
74
+ mean_success = statistics.mean(success_rates)
75
+ std_success = statistics.stdev(success_rates) if len(success_rates) > 1 else 0
76
+
77
+ baseline = 0.2967
78
+ oracle_h16 = 0.9476
79
+
80
+ print("="*60)
81
+ print("📊 HONEST EVALUATION RESULTS (DoVLAModel h=16)")
82
+ print("="*60)
83
+ print(f"Policy Success Rate: {mean_success:.2%} ± {std_success:.2%}")
84
+ print(f"Baseline (h=4): {baseline:.2%}")
85
+ print(f"Oracle (h=16): {oracle_h16:.2%}")
86
+ print("")
87
+ print(f"Absolute Gain: {(mean_success - baseline):+.2%}")
88
+ print(f"Relative Gain: {(mean_success / baseline):.2f}×")
89
+ print(f"% of Oracle Reached: {(mean_success / oracle_h16):.1%}")
90
+ print("")
91
+
92
+ # Per-task breakdown
93
+ print("Per-Task Breakdown:")
94
+ task_names = set()
95
+ for r in all_results:
96
+ task_names.update(r['per_task'].keys())
97
+
98
+ for task in sorted(task_names):
99
+ rates = [r['per_task'][task]['policy_rollout_success_rate']
100
+ for r in all_results if task in r['per_task']]
101
+ if rates:
102
+ mean_rate = statistics.mean(rates)
103
+ print(f" {task:25s} {mean_rate:6.2%}")
104
+
105
+ print("="*60)
106
+
107
+ # Save summary
108
+ summary = {
109
+ 'mean_success_rate': mean_success,
110
+ 'std_success_rate': std_success,
111
+ 'baseline': baseline,
112
+ 'oracle_h16': oracle_h16,
113
+ 'absolute_gain': mean_success - baseline,
114
+ 'relative_gain': mean_success / baseline,
115
+ 'oracle_fraction': mean_success / oracle_h16,
116
+ 'per_task_mean': {
117
+ task: statistics.mean([r['per_task'][task]['policy_rollout_success_rate']
118
+ for r in all_results if task in r['per_task']])
119
+ for task in task_names
120
+ },
121
+ 'seeds': all_results
122
+ }
123
+
124
+ summary_path = Path("results/h16_final_evaluation.json")
125
+ summary_path.parent.mkdir(parents=True, exist_ok=True)
126
+ with open(summary_path, 'w') as f:
127
+ json.dump(summary, f, indent=2)
128
+
129
+ print(f"Summary saved: {summary_path}")
130
+ print("")
131
+
132
+ # HONEST ASSESSMENT
133
+ print("="*60)
134
+ print("HONEST ASSESSMENT FOR PAPER")
135
+ print("="*60)
136
+
137
+ publishable = False
138
+ story = ""
139
+
140
+ if mean_success >= 0.50:
141
+ print("✅ STRONG RESULT (≥50%)")
142
+ print(" Paper story: 2× improvement, SOTA-competitive")
143
+ publishable = True
144
+ story = "strong"
145
+ elif mean_success >= 0.40:
146
+ print("✅ GOOD RESULT (40-50%)")
147
+ print(" Paper story: Significant improvement, horizon matters")
148
+ publishable = True
149
+ story = "good"
150
+ elif mean_success >= 0.35:
151
+ print("⚠️ MODEST RESULT (35-40%)")
152
+ print(" Paper story: Partial improvement, diagnostic value")
153
+ print(" Publishable but needs careful framing")
154
+ publishable = True
155
+ story = "modest"
156
+ else:
157
+ print("⚠️ BELOW EXPECTATIONS (<35%)")
158
+ print(" Gap between oracle (94%) and policy suggests:")
159
+ print(" - Longer horizons harder to predict accurately")
160
+ print(" - Or training/architecture mismatch")
161
+ print(" Still publishable as negative/diagnostic result")
162
+ publishable = True
163
+ story = "diagnostic"
164
+
165
+ print("")
166
+ print(f"Publishable: {publishable}")
167
+ print(f"Story angle: {story}")
168
+ print("")
169
+
170
+ # Save assessment
171
+ assessment = {
172
+ 'publishable': publishable,
173
+ 'story': story,
174
+ 'mean_success': mean_success,
175
+ 'expected_range': [0.35, 0.55],
176
+ 'in_range': 0.35 <= mean_success <= 0.55
177
+ }
178
+
179
+ Path("results/paper_assessment.json").write_text(json.dumps(assessment, indent=2))
180
+
181
+ if publishable:
182
+ print("✅ Triggering paper generation...")
183
+ Path("results/.trigger_paper_generation").touch()
184
+ else:
185
+ print("⚠️ Results need analysis before paper")
186
+
187
+ PYEOF
188
+
189
+ # Upload results
190
+ $PYTHON -c "
191
+ from huggingface_hub import upload_file
192
+ try:
193
+ upload_file(
194
+ path_or_fileobj='results/h16_final_evaluation.json',
195
+ path_in_repo='results/h16_final_evaluation.json',
196
+ repo_id='anhtld/vla',
197
+ commit_message='DoVLAModel h=16 evaluation results (honest measurement)'
198
+ )
199
+ print('✅ Results uploaded to HF')
200
+ except Exception as e:
201
+ print(f'⚠️ Upload: {e}')
202
+ "
203
+
204
+ echo ""
205
+ echo "=== Monitor Complete ==="
206
+ exit 0
207
+
208
+ elif [ "$STATUS" = "FAILED" ]; then
209
+ echo "❌ Evaluation failed"
210
+ sacct -j $EVAL_JOB_ID --format=JobID,State,ExitCode
211
+ exit 1
212
+ fi
213
+
214
+ # Check every 10 minutes
215
+ sleep 600
216
+ done