Upload eval/launcher.py
Browse files- eval/launcher.py +27 -0
eval/launcher.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Download all eval script parts from Hub, combine, and execute."""
|
| 3 |
+
import os, sys
|
| 4 |
+
from huggingface_hub import hf_hub_download
|
| 5 |
+
|
| 6 |
+
REPO = "narcolepticchicken/agent-cost-optimizer"
|
| 7 |
+
parts = [
|
| 8 |
+
"eval/run_bert_eval_full.py",
|
| 9 |
+
"eval/eval_bert_partB.py",
|
| 10 |
+
"eval/eval_bert_partC.py",
|
| 11 |
+
"eval/eval_bert_partD.py",
|
| 12 |
+
]
|
| 13 |
+
|
| 14 |
+
combined = "/app/eval_bert_combined.py"
|
| 15 |
+
with open(combined, "w") as out:
|
| 16 |
+
for part in parts:
|
| 17 |
+
path = hf_hub_download(REPO, part)
|
| 18 |
+
with open(path) as f:
|
| 19 |
+
out.write(f.read())
|
| 20 |
+
out.write("\n\n")
|
| 21 |
+
|
| 22 |
+
print(f"Combined script: {combined} ({os.path.getsize(combined)} bytes)")
|
| 23 |
+
|
| 24 |
+
# Execute the combined script
|
| 25 |
+
with open(combined) as f:
|
| 26 |
+
code = compile(f.read(), combined, "exec")
|
| 27 |
+
exec(code)
|