From d66c04511577cb9419136d91569444d6a9edab2d Mon Sep 17 00:00:00 2001 From: XianBW <36835909+XianBW@users.noreply.github.com> Date: Tue, 18 Mar 2025 15:59:34 +0800 Subject: [PATCH] fix: add check when retrying gen model codes (#699) * add check when retrying gen model codes * fix CI --- rdagent/components/coder/data_science/model/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rdagent/components/coder/data_science/model/__init__.py b/rdagent/components/coder/data_science/model/__init__.py index 2cbb0eda..69e588cb 100644 --- a/rdagent/components/coder/data_science/model/__init__.py +++ b/rdagent/components/coder/data_science/model/__init__.py @@ -90,12 +90,17 @@ class ModelMultiProcessEvolvingStrategy(MultiProcessEvolvingStrategy): ) # 3. post process to align file name to the task name + # we assumpt batch_edit only contains one model file update. batch_edit = { (f"{target_task.name}.py" if value != "__DEL__" and key != f"{target_task.name}.py" else key): value for key, value in batch_edit.items() } user_prompt = user_prompt + "\nPlease avoid generating same code to former code!" + # TODO: besides same code problem, we should also consider other problems lead to retry. + if f"{target_task.name}.py" not in batch_edit: + continue + if batch_edit and max(len(i.encode("utf-8")) for i in batch_edit.keys()) > 255: continue