From ba4a1c7addac95596330cf38c93611f4ab02c8ea Mon Sep 17 00:00:00 2001 From: Maximilian Schmidt <maximilian.schmidt@ims.uni-stuttgart.de> Date: Tue, 23 Jan 2024 12:09:13 +0100 Subject: [PATCH] Fix prompt update for DE (keep best prompt from basic or evolution) --- main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 206e1f4..5697ec2 100644 --- a/main.py +++ b/main.py @@ -275,10 +275,10 @@ def run_episode(evo_alg_str: str): # for DE we keep the evolved prompt if it is better than the basic prompt, and use the basic prompt otherwise population, population_scores = list( zip( - [ - new_prompt + *[ + (new_prompt, new_prompt_score) if new_prompt_score > current_prompt_score - else current_prompt + else (current_prompt, current_prompt_score) for current_prompt, current_prompt_score, new_prompt, new_prompt_score in zip( population, population_scores, P[t], S[t] ) @@ -288,7 +288,7 @@ def run_episode(evo_alg_str: str): save_snapshot(family_tree, P, S, T, N) save_genealogy(family_tree, P, S, T) - save_family_tree_visualization(family_tree, P, S, T+1) + save_family_tree_visualization(family_tree, P, S, T + 1) # Line 8: Return the best prompt, p∗, among the final population PT : # p∗ ↠argmaxp∈PT f(p, D) p = max(range(N), key=lambda i: S[T][i]) -- GitLab