From fb5630bcfa7347c6c9f9df8ba988233aaf0b1593 Mon Sep 17 00:00:00 2001 From: Maximilian Schmidt <maximilian.schmidt@ims.uni-stuttgart.de> Date: Thu, 18 Jan 2024 13:02:56 +0100 Subject: [PATCH] Fix evolutions of current iteration not being accumulated --- main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 4344fbe..60d86b3 100644 --- a/main.py +++ b/main.py @@ -250,9 +250,11 @@ def run_episode(evo_alg_str: str): if evo_alg_str == "de": # DE needs best prompt for evolution best_prompt_current_evolution = max(range(N), key=lambda i: S[t - 1][i]) + + # keep track of evolutions of current iteration + new_evolutions = [] + new_evolutions_scores = [] for i in trange(N, desc="N", leave=False): - new_evolutions = [] - new_evolutions_scores = [] # for both GA and DE we start with two parent prompts pr1, pr2 = selection(P[t - 1], S[t - 1]) @@ -302,7 +304,6 @@ def run_episode(evo_alg_str: str): # p∗ ↠argmaxp∈PT f(p, D) p = max(range(N), key=lambda i: S[T][i]) logger.info(f"Best prompt: {P[T][p]}") - print(P[p]) # We pick the prompt with the highest score on the development set and report its score on the testset. test_D = load_dataset("SetFit/sst2", split="test") -- GitLab