mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-27 23:47:46 +00:00
feat: add improve_mode to MultiProcessEvolvingStrategy for selective task implementation (#1273)
This commit is contained in:
@@ -21,9 +21,10 @@ from rdagent.core.utils import multiprocessing_wrapper
|
||||
class MultiProcessEvolvingStrategy(EvolvingStrategy):
|
||||
KEY_CHANGE_SUMMARY = "__change_summary__" # Optional key for the summary of the change of evolving subjects
|
||||
|
||||
def __init__(self, scen: Scenario, settings: CoSTEERSettings):
|
||||
def __init__(self, scen: Scenario, settings: CoSTEERSettings, improve_mode: bool = False):
|
||||
super().__init__(scen)
|
||||
self.settings = settings
|
||||
self.improve_mode = improve_mode # improve mode means we only implement the task which has failed before. The main diff is the first loop will not implement all tasks.
|
||||
|
||||
@abstractmethod
|
||||
def implement_one_task(
|
||||
@@ -93,6 +94,7 @@ class MultiProcessEvolvingStrategy(EvolvingStrategy):
|
||||
elif (
|
||||
target_task_desc not in queried_knowledge.success_task_to_knowledge_dict
|
||||
and target_task_desc not in queried_knowledge.failed_task_info_set
|
||||
and not (self.improve_mode and last_feedback[index] is None)
|
||||
):
|
||||
to_be_finished_task_index.append(index)
|
||||
|
||||
|
||||
@@ -48,11 +48,6 @@ class DSRunnerMultiProcessEvolvingStrategy(MultiProcessEvolvingStrategy):
|
||||
workspace: FBWorkspace | None = None,
|
||||
prev_task_feedback: CoSTEERSingleFeedback | None = None,
|
||||
) -> dict[str, str]:
|
||||
|
||||
if prev_task_feedback is None:
|
||||
# if no prev_task_feedback, it is the first loop; we do not make any changes and goto evaluators directly.
|
||||
return {}
|
||||
|
||||
# Get evolving history
|
||||
task_info = target_task.get_task_information()
|
||||
queried_former_failed_knowledge = (
|
||||
@@ -157,7 +152,7 @@ class DSCoSTEERRunner(CoSTEER):
|
||||
single_evaluator=eval_l, scen=scen
|
||||
) # Please specify whether you agree running your eva in parallel or not
|
||||
settings = DSRunnerCoSTEERSettings()
|
||||
es = DSRunnerMultiProcessEvolvingStrategy(scen=scen, settings=settings)
|
||||
es = DSRunnerMultiProcessEvolvingStrategy(scen=scen, settings=settings, improve_mode=True)
|
||||
|
||||
# In runner, we don't need very big loops, so we set max_loop to runner_max_loop
|
||||
super().__init__(
|
||||
|
||||
Reference in New Issue
Block a user