changed subset names
Browse files- numerical_reasoning.py +44 -25
numerical_reasoning.py
CHANGED
@@ -50,29 +50,27 @@ _URLS = {
|
|
50 |
|
51 |
|
52 |
# TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
|
53 |
-
class
|
54 |
"""TODO: Short description of my dataset."""
|
55 |
|
56 |
VERSION = datasets.Version("0.1.0")
|
57 |
|
58 |
BUILDER_CONFIGS = [
|
59 |
-
datasets.BuilderConfig(name="
|
60 |
-
datasets.BuilderConfig(name="
|
61 |
-
datasets.BuilderConfig(name="
|
62 |
-
datasets.BuilderConfig(name="
|
63 |
-
datasets.BuilderConfig(name="
|
64 |
-
datasets.BuilderConfig(name="
|
65 |
-
datasets.BuilderConfig(name="
|
66 |
-
datasets.BuilderConfig(name="
|
67 |
-
datasets.BuilderConfig(name="
|
68 |
-
datasets.BuilderConfig(name="time_unit_year_month", version=VERSION, description="x years equals y months"),
|
69 |
-
datasets.BuilderConfig(name="time_unit_decade_year", version=VERSION, description="x decades equals y years"),
|
70 |
]
|
71 |
|
72 |
-
DEFAULT_CONFIG_NAME = "
|
73 |
|
74 |
def _info(self):
|
75 |
-
if ("
|
76 |
features = datasets.Features(
|
77 |
{
|
78 |
"x1": datasets.Value("int32"),
|
@@ -83,9 +81,10 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
83 |
else:
|
84 |
features = datasets.Features(
|
85 |
{
|
86 |
-
"
|
87 |
-
"
|
88 |
"y": datasets.Value("int32")
|
|
|
89 |
}
|
90 |
)
|
91 |
return datasets.DatasetInfo(
|
@@ -109,7 +108,7 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
109 |
|
110 |
def _generate_examples(self, split):
|
111 |
|
112 |
-
if
|
113 |
key = 0
|
114 |
for x1 in range(0,100):
|
115 |
for x2 in range(1,51):
|
@@ -120,38 +119,58 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
120 |
"x2": x2,
|
121 |
"y": x1*x2,
|
122 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
else:
|
124 |
if "min_sec" in self.config.name:
|
125 |
-
|
|
|
126 |
multiplier = 60
|
127 |
|
128 |
elif "hour_min" in self.config.name:
|
129 |
-
|
|
|
130 |
multiplier = 60
|
131 |
|
132 |
elif "day_hour" in self.config.name:
|
133 |
-
|
|
|
134 |
multiplier = 24
|
135 |
|
136 |
elif "week_day" in self.config.name:
|
137 |
-
|
|
|
138 |
multiplier = 7
|
139 |
|
140 |
elif "month_week" in self.config.name:
|
141 |
-
|
|
|
142 |
multiplier = 30
|
143 |
|
144 |
elif "year_month" in self.config.name:
|
145 |
-
|
|
|
146 |
multiplier = 12
|
147 |
|
148 |
elif "decade_year" in self.config.name:
|
149 |
-
|
|
|
150 |
multiplier = 10
|
151 |
|
152 |
for key, x in enumerate(range(0, 100)):
|
153 |
yield key, {
|
154 |
"x": x,
|
155 |
-
"
|
156 |
"y": multiplier*x,
|
|
|
157 |
}
|
|
|
50 |
|
51 |
|
52 |
# TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
|
53 |
+
class NumericalReasoning(datasets.GeneratorBasedBuilder):
|
54 |
"""TODO: Short description of my dataset."""
|
55 |
|
56 |
VERSION = datasets.Version("0.1.0")
|
57 |
|
58 |
BUILDER_CONFIGS = [
|
59 |
+
datasets.BuilderConfig(name="multiplication", version=VERSION, description="x1 x x2 = y"),
|
60 |
+
datasets.BuilderConfig(name="addition", version=VERSION, description="x1 + x2 = y"),
|
61 |
+
datasets.BuilderConfig(name="convert_min_sec", version=VERSION, description="x minutes equals y seconds"),
|
62 |
+
datasets.BuilderConfig(name="convert_hour_min", version=VERSION, description="x hours equals y minutes"),
|
63 |
+
datasets.BuilderConfig(name="convert_day_hour", version=VERSION, description="x days equals y hours"),
|
64 |
+
datasets.BuilderConfig(name="convert_week_day", version=VERSION, description="x minutes equals y seconds"),
|
65 |
+
datasets.BuilderConfig(name="convert_month_week", version=VERSION, description="x months equals y weeks"),
|
66 |
+
datasets.BuilderConfig(name="convert_year_month", version=VERSION, description="x years equals y months"),
|
67 |
+
datasets.BuilderConfig(name="convert_decade_year", version=VERSION, description="x decades equals y years"),
|
|
|
|
|
68 |
]
|
69 |
|
70 |
+
DEFAULT_CONFIG_NAME = "multiplication" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
71 |
|
72 |
def _info(self):
|
73 |
+
if ("multiplication" in self.config.name) or ("addition" in self.config.name): # This is the name of the configuration selected in BUILDER_CONFIGS above
|
74 |
features = datasets.Features(
|
75 |
{
|
76 |
"x1": datasets.Value("int32"),
|
|
|
81 |
else:
|
82 |
features = datasets.Features(
|
83 |
{
|
84 |
+
"x": datasets.Value("int32"),
|
85 |
+
"x_time_unit": datasets.Value("string"),
|
86 |
"y": datasets.Value("int32")
|
87 |
+
"y_time_unit": datasets.Value("string"),
|
88 |
}
|
89 |
)
|
90 |
return datasets.DatasetInfo(
|
|
|
108 |
|
109 |
def _generate_examples(self, split):
|
110 |
|
111 |
+
if self.config.name == "multiplication":
|
112 |
key = 0
|
113 |
for x1 in range(0,100):
|
114 |
for x2 in range(1,51):
|
|
|
119 |
"x2": x2,
|
120 |
"y": x1*x2,
|
121 |
}
|
122 |
+
|
123 |
+
elif self.config.name == "addition":
|
124 |
+
key = 0
|
125 |
+
for x1 in range(0,100):
|
126 |
+
for x2 in range(1,51):
|
127 |
+
key += 1
|
128 |
+
# Yields examples as (key, example) tuples
|
129 |
+
yield key, {
|
130 |
+
"x1": x1,
|
131 |
+
"x2": x2,
|
132 |
+
"y": x1+x2,
|
133 |
+
}
|
134 |
else:
|
135 |
if "min_sec" in self.config.name:
|
136 |
+
x_time_unit = "minutes"
|
137 |
+
y_time_unit = "seconds"
|
138 |
multiplier = 60
|
139 |
|
140 |
elif "hour_min" in self.config.name:
|
141 |
+
x_time_unit = "hours"
|
142 |
+
y_time_unit = "minutes"
|
143 |
multiplier = 60
|
144 |
|
145 |
elif "day_hour" in self.config.name:
|
146 |
+
x_time_unit = "days"
|
147 |
+
y_time_unit = "hours"
|
148 |
multiplier = 24
|
149 |
|
150 |
elif "week_day" in self.config.name:
|
151 |
+
x_time_unit = "weeks"
|
152 |
+
y_time_unit = "days"
|
153 |
multiplier = 7
|
154 |
|
155 |
elif "month_week" in self.config.name:
|
156 |
+
x_time_unit = "months"
|
157 |
+
y_time_unit = "weeks"
|
158 |
multiplier = 30
|
159 |
|
160 |
elif "year_month" in self.config.name:
|
161 |
+
x_time_unit = "years"
|
162 |
+
y_time_unit = "months"
|
163 |
multiplier = 12
|
164 |
|
165 |
elif "decade_year" in self.config.name:
|
166 |
+
x_time_unit = "decades"
|
167 |
+
y_time_unit = "years"
|
168 |
multiplier = 10
|
169 |
|
170 |
for key, x in enumerate(range(0, 100)):
|
171 |
yield key, {
|
172 |
"x": x,
|
173 |
+
"x_time_unit": x_time_unit,
|
174 |
"y": multiplier*x,
|
175 |
+
"y_time_unit": y_time_unit,
|
176 |
}
|