Upload eval/run_bert_eval_launcher.py
Browse files
eval/run_bert_eval_launcher.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Download eval script parts from Hub, combine, and run."""
|
| 3 |
+
import os, subprocess
|
| 4 |
+
from huggingface_hub import hf_hub_download
|
| 5 |
+
|
| 6 |
+
REPO = "narcolepticchicken/agent-cost-optimizer"
|
| 7 |
+
parts = ["eval/run_bert_eval_full.py", "eval/eval_bert_partB.py", "eval/eval_bert_partC.py", "eval/eval_bert_partD.py"]
|
| 8 |
+
|
| 9 |
+
combined = "/app/eval_bert_combined.py"
|
| 10 |
+
with open(combined, "w") as out:
|
| 11 |
+
for part in parts:
|
| 12 |
+
path = hf_hub_download(REPO, part)
|
| 13 |
+
with open(path) as f:
|
| 14 |
+
out.write(f.read())
|
| 15 |
+
out.write("\n\n")
|
| 16 |
+
|
| 17 |
+
print(f"Combined script: {combined}")
|
| 18 |
+
print(f"Size: {os.path.getsize(combined)} bytes")
|
| 19 |
+
|
| 20 |
+
# Run it
|
| 21 |
+
import subprocess, sys
|
| 22 |
+
result = subprocess.run([sys.executable, combined], capture_output=False)
|
| 23 |
+
sys.exit(result.returncode)
|