Skip to content
Snippets Groups Projects
Commit ba4a1c7a authored by Max Kimmich's avatar Max Kimmich
Browse files

Fix prompt update for DE (keep best prompt from basic or evolution)

parent 02af6b47
No related branches found
No related tags found
No related merge requests found
......@@ -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])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment