Skip to content

Commit 4896c67

Browse files
committed
use shared code folder for all gaia tasks
1 parent 0a43a8d commit 4896c67

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

scripts/run_gaia.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99

1010
if __name__ == "__main__":
1111
study = make_study(
12-
benchmark=GaiaBenchmark(split="validation", level="1"),
12+
benchmark=GaiaBenchmark(split="validation", level="1"), # type: ignore
1313
agent_args=TapeAgentArgs("gaia_agent"),
1414
comment="Gaia eval",
1515
logging_level=logging.INFO,
1616
logging_level_stdout=logging.INFO,
1717
)
18-
# study.exp_args_list = study.exp_args_list[:1]
18+
# study.exp_args_list = study.exp_args_list[:3]
19+
# study.run(n_jobs=1, n_relaunch=1, parallel_backend="sequential")
1920
study.run(n_jobs=8, n_relaunch=1, parallel_backend="ray")

src/agentlab/benchmarks/gaia.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,19 @@ def make_env(self, exp_dir: str | Path, action_mapping=None) -> GaiaGym:
8989
return env
9090

9191
def init_code_sandbox(self, exp_dir: str) -> None:
92-
code_path = os.path.join(exp_dir, "code")
92+
# Use a common code directory for all tasks in the experiment, which is mounted in the container
93+
root_exp_dir = Path(exp_dir).parent
94+
code_path = os.path.join(root_exp_dir, "shared_code")
9395
os.makedirs(code_path, exist_ok=True)
94-
container_name = f"gaia_code_{self.task['task_id'][:8]}"
96+
97+
container_name = "gaia_code_shared"
9598
os.environ["COMPUTER_CONTAINER_NAME"] = container_name
99+
100+
# symlink task code to the shared code directory
101+
task_code_path = os.path.join(exp_dir, "code")
102+
if not os.path.exists(task_code_path):
103+
os.symlink(code_path, task_code_path)
104+
96105
ContainerExecutor(container_name=container_name, work_dir=code_path, no_deps=True)
97106

98107

0 commit comments

Comments
 (0)