File size: 919 Bytes
74841c5
 
e22f616
 
 
 
 
 
 
74841c5
 
 
 
 
 
 
 
 
 
e22f616
74841c5
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/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)