File size: 1,893 Bytes
430d13c
 
 
 
 
 
 
 
 
 
 
 
 
76eacb1
 
430d13c
 
 
 
 
 
 
 
5f867e3
430d13c
5f867e3
430d13c
 
 
 
 
 
df6fa5a
 
430d13c
 
 
 
 
 
 
 
 
 
 
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
35
36
37
38
39
40
41
42
43
44
45
46
"""Write the arena submission body from the live /schema answer and the task list."""

import argparse
import json
import sys
from pathlib import Path
from urllib.request import urlopen

sys.path.insert(0, str(Path(__file__).resolve().parents[1]))

from workbench.tasks import TASK_IDS  # noqa: E402

LIMITS = {"split": "train", "reset_wall_s": 180, "rollout_wall_s": 1800, "verifier_wall_s": 120,
          "tool_wall_s": 120, "tool_calls_total": 64, "completion_tokens": 32768,
          "context_tokens": 32768, "memory_gib": 4, "cpu_floor_vcpus": 1, "workspace_gib": 2}


def main():
    p = argparse.ArgumentParser()
    p.add_argument("--url", default="http://127.0.0.1:18000")
    p.add_argument("--image", required=True)
    p.add_argument("--id", default="analyst-workbench-v1")
    p.add_argument("--out", default="submission.json")
    p.add_argument("--tasks", default="", help="comma-separated task ids (default: every family at level 1)")
    a = p.parse_args()
    tasks = a.tasks.split(",") if a.tasks else TASK_IDS
    schema = json.load(urlopen(a.url + "/schema"))
    body = {
        "submission_id": a.id,
        "name": "Analyst Workbench",
        "image": a.image,
        "schema": {"action": schema["action"], "observation": schema["observation"]},
        "tasks": [dict(LIMITS, task_id=t, **({"verifier_wall_s": 300} if t.startswith("swe-repo-") else {}))
                  for t in tasks],
        "example_actions": [{"tool": "ls"}, {"tool": "submit", "answer": ""}],
        "finish_action": {"tool": "submit", "answer": ""},
        "dataset": "ajinkyamulay/analyst-workbench",
        "source": "https://huggingface.co/datasets/ajinkyamulay/analyst-workbench/tree/main/source",
    }
    Path(a.out).write_text(json.dumps(body, indent=2) + "\n")
    print(f"wrote {a.out}: {len(body['tasks'])} tasks, image {a.image}")


if __name__ == "__main__":
    main()