Skip to content

Commit 75f4429

Browse files
authored
add arc agi 2 (#642)
* add arc agi 2 * add arc agi 2 * add arc agi 2
1 parent f3639c6 commit 75f4429

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

src/lighteval/tasks/default_prompts.py

+51
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,57 @@ def apps(line, task_name: str = None):
9090
)
9191

9292

93+
def arc_agi_2(line, task_name: str = None):
94+
# query from: https://github.com/arcprize/model_baseline/blob/main/src/prompts/system_prompt.txt
95+
def convert_2d_list_to_string(list_of_lists: list[list[int]]) -> str:
96+
"""
97+
Convert a list of lists to a string
98+
"""
99+
100+
string_list = ""
101+
102+
for row in list_of_lists:
103+
string_list += json.dumps(row) + "\n"
104+
105+
return string_list
106+
107+
query = """You are participating in a puzzle solving competition. You are an expert at solving puzzles.
108+
109+
Below is a list of input and output pairs with a pattern. Your goal is to identify the pattern or transformation in the training examples that maps the input to the output, then apply that pattern to the test input to give a final output.
110+
111+
Respond in the format of the training output examples
112+
113+
--Training Examples--
114+
{training_examples}
115+
--End of Training Examples--
116+
117+
--Test Input--
118+
{test_input}
119+
--End of Test Input--
120+
121+
Your response:""".strip()
122+
123+
training_pairs = line["fewshots"]
124+
training_examples = ""
125+
for i, pair in enumerate(training_pairs):
126+
training_examples += f"--Example {i}-- \n\n INPUT: \n\n"
127+
training_examples += convert_2d_list_to_string(pair["input"]) + "\n\n"
128+
training_examples += "OUTPUT: \n\n"
129+
training_examples += convert_2d_list_to_string(pair["output"]) + "\n\n"
130+
131+
test_input = convert_2d_list_to_string(line["question"][0]["input"])
132+
133+
gold = str(line["question"][0]["output"])
134+
query = query.format(training_examples=training_examples, test_input=test_input)
135+
136+
return Doc(
137+
task_name=task_name,
138+
query=query,
139+
choices=[gold],
140+
gold_index=0,
141+
)
142+
143+
93144
def arc(line, task_name: str = None):
94145
return Doc(
95146
task_name=task_name,

src/lighteval/tasks/default_tasks.py

+16
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,22 @@
442442
trust_dataset=True,
443443
version=0,
444444
)
445+
arc_agi_2 = LightevalTaskConfig(
446+
name="arc_agi_2",
447+
suite=["lighteval"],
448+
prompt_function=prompt.arc_agi_2,
449+
hf_repo="arc-agi-community/arc-agi-2",
450+
hf_subset="default",
451+
hf_avail_splits=["train", "test"],
452+
evaluation_splits=["test"],
453+
few_shots_split=None,
454+
few_shots_select=None,
455+
generation_size=2048,
456+
metric=[Metrics.exact_match],
457+
stop_sequence=None,
458+
trust_dataset=False,
459+
version=0,
460+
)
445461
arc_c_letters_original = LightevalTaskConfig(
446462
name="arc:c:letters",
447463
suite=["original", "arc"],

0 commit comments

Comments
 (0)