IoTProber commited on
Commit
5be8261
·
verified ·
1 Parent(s): db78ff3

Bench harness scripts (rebuttal regeneration tooling; kept off the code repository)

Browse files
evaluation/bench_100/prewarm_local.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ """Pre-warm LOCAL retrieval caches for the bench samples while the external
3
+ LLM channels are down (local retrieval is pure local-embedding cosine — no
4
+ API calls). After this, the post-restart workers quick_resume past the local
5
+ layer and spend their scarce LLM quota only on community/reasoning/decision.
6
+
7
+ Usage: CUDA_VISIBLE_DEVICES=$G python evaluation/bench_100/prewarm_local.py --worker $G
8
+ """
9
+
10
+ import argparse
11
+ import os
12
+ import sys
13
+
14
+ REPO = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
15
+ sys.path.insert(0, os.path.join(REPO, "agent"))
16
+ sys.path.insert(0, REPO)
17
+ sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) # evaluation/, where run_bench_100.py lives
18
+
19
+ from run_bench_100 import pop_type, restore_test_csv, swap_test_csv # noqa: E402
20
+
21
+
22
+ def run_type_local(t):
23
+ from agent import IdentificationAgent
24
+ swap_test_csv(t)
25
+ try:
26
+ agent = IdentificationAgent(llm="GLM", gpu=0)
27
+ # decompose OFF on purpose: it needs an external LLM and falls back to
28
+ # defaults anyway; community/reasoning are the LLM consumers we skip.
29
+ agent.run_retrieval(whether_decompose=False, whether_local=True,
30
+ whether_community=False, whether_reasoning=False,
31
+ devices=[t], top_k=5, quick_resume=True)
32
+ print(f"[prewarm] {t} local done", flush=True)
33
+ finally:
34
+ restore_test_csv(t)
35
+
36
+
37
+ if __name__ == "__main__":
38
+ p = argparse.ArgumentParser()
39
+ p.add_argument("--worker", type=int, default=0)
40
+ a = p.parse_args()
41
+ while True:
42
+ t = pop_type()
43
+ if t is None:
44
+ print("queue empty, prewarm worker exiting", flush=True)
45
+ break
46
+ try:
47
+ run_type_local(t)
48
+ except Exception as exc: # noqa: BLE001
49
+ print(f"[prewarm] {t} FAILED: {type(exc).__name__}: {str(exc)[:150]}",
50
+ flush=True)
51
+ restore_test_csv(t)