agent-cost-optimizer / eval /launcher.py
narcolepticchicken's picture
Upload eval/launcher.py
e22f616 verified
#!/usr/bin/env python3
"""Download all eval script parts from Hub, combine, and execute."""
import os, sys, tempfile
# Create working directory
workdir = tempfile.mkdtemp()
os.environ["WORKDIR"] = workdir
print(f"Working directory: {workdir}")
from huggingface_hub import hf_hub_download
REPO = "narcolepticchicken/agent-cost-optimizer"
parts = [
"eval/run_bert_eval_full.py",
"eval/eval_bert_partB.py",
"eval/eval_bert_partC.py",
"eval/eval_bert_partD.py",
]
combined = os.path.join(workdir, "eval_bert_combined.py")
with open(combined, "w") as out:
for part in parts:
path = hf_hub_download(REPO, part)
with open(path) as f:
out.write(f.read())
out.write("\n\n")
print(f"Combined script: {combined} ({os.path.getsize(combined)} bytes)")
# Execute the combined script
with open(combined) as f:
code = compile(f.read(), combined, "exec")
exec(code)