| |
| """Download all eval script parts from Hub, combine, and execute.""" |
| import os, sys, tempfile |
|
|
| |
| 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)") |
|
|
| |
| with open(combined) as f: |
| code = compile(f.read(), combined, "exec") |
| exec(code) |
|
|