From 6a634ce217b2351d16a9dec1afcdd2f30482a188 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Grie=C3=9Fhaber?= <griesshaber@hdm-stuttgart.de> Date: Wed, 13 Mar 2024 07:54:35 +0100 Subject: [PATCH] add run options to snapshot --- main.py | 11 ++++++++++- utils.py | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 0eca741..13e4280 100644 --- a/main.py +++ b/main.py @@ -249,7 +249,16 @@ def run_episode(evo_alg_str: str, debug: bool = False): # store new generation P.append([prompt.id for prompt in population]) - save_snapshot(all_prompts, family_tree, P, T, N, task, evolution_model) + save_snapshot( + all_prompts, + family_tree, + P, + T, + N, + task, + evolution_model, + options.__dict__, + ) # Line 8: Return the best prompt, p∗, among the final population PT : # p∗ ↠argmaxp∈PT f(p, D) p = all_prompts[max(P[-1], key=lambda prompt_id: all_prompts[prompt_id].score)] diff --git a/utils.py b/utils.py index 1039e49..8814591 100644 --- a/utils.py +++ b/utils.py @@ -129,6 +129,7 @@ def save_snapshot( N: int, task, model: Llama2 | OpenAI, + run_options: dict[str, Any], ): import json @@ -147,6 +148,7 @@ def save_snapshot( "metric": task.metric_name, }, "model": {"name": model.__class__.__name__}, + "run_options": run_options, }, f, indent=4, -- GitLab