From 4573d63800097446b7f6175c59617c243b4e47c4 Mon Sep 17 00:00:00 2001 From: Andrei Fajardo Date: Sat, 21 Sep 2024 02:23:45 -0400 Subject: [PATCH] clean up --- .../workflows/arc_task_solver.py | 7 +++--- arc_finetuning_st/workflows/prompts.py | 22 ------------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/arc_finetuning_st/workflows/arc_task_solver.py b/arc_finetuning_st/workflows/arc_task_solver.py index 28e205e..a888e19 100644 --- a/arc_finetuning_st/workflows/arc_task_solver.py +++ b/arc_finetuning_st/workflows/arc_task_solver.py @@ -54,8 +54,7 @@ def __init__(self, llm: LLM, max_attempts: int = 3, **kwargs: Any) -> None: self.llm = llm self._max_attempts = max_attempts - @staticmethod - def _format_past_attempt(attempt: Attempt, attempt_num: int) -> str: + def _format_past_attempt(self, attempt: Attempt, attempt_num: int) -> str: return past_attempt_template.format( past_attempt_number=attempt_num, past_predicted_output=str(attempt.prediction), @@ -90,7 +89,7 @@ def format_train_example(train_pair: Dict) -> str: # update past predictions prompt_vars = await ctx.get("prompt_vars") formatted_past_attempts = [ - ARCTaskSolverWorkflow._format_past_attempt(a, ix + 1) + self._format_past_attempt(a, ix + 1) for ix, a in enumerate(attempts) ] prompt_vars.update( @@ -159,7 +158,7 @@ async def reflection(self, ctx: Context, ev: EvaluationEvent) -> StopEvent: if not ev.passing: prompt_vars = await ctx.get("prompt_vars") formatted_past_attempts = [ - ARCTaskSolverWorkflow._format_past_attempt(a, ix + 1) + self._format_past_attempt(a, ix + 1) for ix, a in enumerate(attempts) ] prompt_vars.update( diff --git a/arc_finetuning_st/workflows/prompts.py b/arc_finetuning_st/workflows/prompts.py index 1cacd9d..8012047 100644 --- a/arc_finetuning_st/workflows/prompts.py +++ b/arc_finetuning_st/workflows/prompts.py @@ -67,25 +67,3 @@ Return your response in JSON format given above. DO NOT RETURN markdown code.""" ) - -FINETUNING_DATASET_EXAMPLE_TEMPLATE = """You are a bot that is very good at solving puzzles. Below is a list of input and output pairs that share a -common pattern. The TEST INPUT also shares this common pattern, and you've previously predicted the output for it. -The predicted output was found to be incorrect and a critique has been articulated offering a potential -reason as to why it may have been a flawed prediction. - -Your task now to create a new prediction that corrects from the previous attempts. Use the last attempt and critique. - -EXAMPLES: -{examples} - -TEST INPUT: -{test_input} - -PAST ATTEMPTS: -{past_attempts} - -Return your response in JSON format given above. DO NOT RETURN markdown code. - -OUTPUT: -{output} -"""