narcolepticchicken commited on
Commit
b4ef67e
·
verified ·
1 Parent(s): e4dac20

Upload eval_launcher_v3.py

Browse files
Files changed (1) hide show
  1. eval_launcher_v3.py +60 -0
eval_launcher_v3.py ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Eval launcher — checks for all 3 trained models then runs full evaluation.
2
+
3
+ Usage: python eval_launcher_v3.py
4
+ """
5
+
6
+ import sys, time, json
7
+ from huggingface_hub import HfApi, list_repo_refs
8
+
9
+ HUB = "narcolepticchicken"
10
+ REQUIRED = [
11
+ f"{HUB}/speculative-proposer-v3-1.7b",
12
+ f"{HUB}/speculative-verifier-v3-4b",
13
+ f"{HUB}/speculative-proposer-v3-8b",
14
+ ]
15
+ MAX_WAIT = 7200 # 2 hours
16
+
17
+
18
+ def model_has_weights(repo_id):
19
+ """Check if model has adapter weights pushed."""
20
+ try:
21
+ refs = list_repo_refs(repo_id)
22
+ api = HfApi()
23
+ files = api.list_repo_files(repo_id)
24
+ has_adapter = any("adapter_model" in f for f in files)
25
+ return has_adapter
26
+ except Exception:
27
+ return False
28
+
29
+
30
+ def wait_for_models():
31
+ """Poll until all 3 models have weights."""
32
+ start = time.time()
33
+ while time.time() - start < MAX_WAIT:
34
+ missing = [m for m in REQUIRED if not model_has_weights(m)]
35
+ if not missing:
36
+ return True
37
+ elapsed = time.time() - start
38
+ print(f"[{elapsed:.0f}s] Waiting for: {missing}")
39
+ time.sleep(60)
40
+ print("TIMEOUT: models not ready after 2h")
41
+ return False
42
+
43
+
44
+ if __name__ == "__main__":
45
+ print("Checking models...")
46
+ for m in REQUIRED:
47
+ ok = model_has_weights(m)
48
+ print(f" {m}: {'✓' if ok else '✗ MISSING'}")
49
+
50
+ all_ready = all(model_has_weights(m) for m in REQUIRED)
51
+
52
+ if not all_ready:
53
+ print("\nWaiting for training to complete...")
54
+ if not wait_for_models():
55
+ sys.exit(1)
56
+
57
+ print("\nAll models ready! Launching evaluation...")
58
+
59
+ # Run the eval
60
+ exec(open("eval_runner_v3.py").read())