Fraser-Greenlee
commited on
Commit
•
4f829c4
1
Parent(s):
2a5c16e
load test
Browse files- program_synthesis.py +14 -1
program_synthesis.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
"""Program Synthesis dataset from dreamcoder. https://github.com/ellisk42/ec"""
|
2 |
from random import choice, shuffle
|
3 |
import datasets
|
|
|
4 |
|
5 |
from dreamcoder.domains.text.makeTextTasks import makeTasks as textMakeTasks
|
6 |
from dreamcoder.domains.list.main import main as listMakeTasks
|
@@ -89,7 +90,19 @@ class ProgramSynthesis(datasets.GeneratorBasedBuilder):
|
|
89 |
def _generate_examples(self, split):
|
90 |
if split == 'test':
|
91 |
# TODO read from: test.list.csv, test.text.csv
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
task_samples = {
|
95 |
'text': infIterator(textMakeTasks),
|
|
|
1 |
"""Program Synthesis dataset from dreamcoder. https://github.com/ellisk42/ec"""
|
2 |
from random import choice, shuffle
|
3 |
import datasets
|
4 |
+
import pandas as pd
|
5 |
|
6 |
from dreamcoder.domains.text.makeTextTasks import makeTasks as textMakeTasks
|
7 |
from dreamcoder.domains.list.main import main as listMakeTasks
|
|
|
90 |
def _generate_examples(self, split):
|
91 |
if split == 'test':
|
92 |
# TODO read from: test.list.csv, test.text.csv
|
93 |
+
df_list = pd.read_csv('test.list.csv')
|
94 |
+
df_text = pd.read_csv('test.text.csv')
|
95 |
+
if self.config.name == 'all':
|
96 |
+
df = pd.concat(df_list, df_text)
|
97 |
+
elif self.config.name == 'list':
|
98 |
+
df = df_list
|
99 |
+
elif self.config.name == 'text':
|
100 |
+
df = df_text
|
101 |
+
else:
|
102 |
+
raise Exception('Bad Config')
|
103 |
+
for i, row in df.iterrows():
|
104 |
+
yield i, row
|
105 |
+
return
|
106 |
|
107 |
task_samples = {
|
108 |
'text': infIterator(textMakeTasks),
|