From 0b2de1e129e29e9c4738a46f0a9171fd1b3475ee Mon Sep 17 00:00:00 2001 From: Xisen-Wang Date: Tue, 24 Sep 2024 06:43:27 +0000 Subject: [PATCH 1/2] use fixed name in model costeer to enable cache --- rdagent/components/coder/model_coder/model.py | 1 + rdagent/utils/env.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/rdagent/components/coder/model_coder/model.py b/rdagent/components/coder/model_coder/model.py index eca3b432..bb0ad212 100644 --- a/rdagent/components/coder/model_coder/model.py +++ b/rdagent/components/coder/model_coder/model.py @@ -115,6 +115,7 @@ def execute( dump_file_names=["execution_feedback_str.pkl", "execution_model_output.pkl"], local_path=str(self.workspace_path), env={}, + code_dump_file_py_name="model_test" ) if results is None: raise RuntimeError(f"Error in running the model code: {log}") diff --git a/rdagent/utils/env.py b/rdagent/utils/env.py index 7c43d743..46beb176 100644 --- a/rdagent/utils/env.py +++ b/rdagent/utils/env.py @@ -327,11 +327,12 @@ def dump_python_code_run_and_get_results( local_path: str | None = None, env: dict | None = None, running_extra_volume: dict | None = None, + code_dump_file_py_name: Optional[str] = None ): """ Dump the code into the local path and run the code. """ - random_file_name = f"{uuid.uuid4()}.py" + random_file_name = f"{uuid.uuid4()}.py" if code_dump_file_py_name is None else f"{code_dump_file_py_name}.py" with open(os.path.join(local_path, random_file_name), "w") as f: f.write(code) entry = f"python {random_file_name}" From c71a7062fe10e5a51a13e13277aea54f12d10db6 Mon Sep 17 00:00:00 2001 From: Xisen-Wang Date: Tue, 24 Sep 2024 06:45:38 +0000 Subject: [PATCH 2/2] fix ci --- rdagent/components/coder/model_coder/model.py | 2 +- rdagent/utils/env.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rdagent/components/coder/model_coder/model.py b/rdagent/components/coder/model_coder/model.py index bb0ad212..a8f700e9 100644 --- a/rdagent/components/coder/model_coder/model.py +++ b/rdagent/components/coder/model_coder/model.py @@ -115,7 +115,7 @@ def execute( dump_file_names=["execution_feedback_str.pkl", "execution_model_output.pkl"], local_path=str(self.workspace_path), env={}, - code_dump_file_py_name="model_test" + code_dump_file_py_name="model_test", ) if results is None: raise RuntimeError(f"Error in running the model code: {log}") diff --git a/rdagent/utils/env.py b/rdagent/utils/env.py index 46beb176..815dfcde 100644 --- a/rdagent/utils/env.py +++ b/rdagent/utils/env.py @@ -327,7 +327,7 @@ def dump_python_code_run_and_get_results( local_path: str | None = None, env: dict | None = None, running_extra_volume: dict | None = None, - code_dump_file_py_name: Optional[str] = None + code_dump_file_py_name: Optional[str] = None, ): """ Dump the code into the local path and run the code.