changed datasets to have the first operand as the subset
Browse files
numerical_reasoning.py → numerical_reasoning_arithmetic.py
RENAMED
|
@@ -35,53 +35,31 @@ _HOMEPAGE = ""
|
|
| 35 |
# TODO: Add the licence for the dataset here if you can find it
|
| 36 |
_LICENSE = ""
|
| 37 |
|
| 38 |
-
|
| 39 |
-
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
| 40 |
-
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
| 41 |
-
_URLS = {
|
| 42 |
-
"first_domain": "https://huggingface.co/great-new-dataset-first_domain.zip",
|
| 43 |
-
"second_domain": "https://huggingface.co/great-new-dataset-second_domain.zip",
|
| 44 |
-
}
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
# TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
|
| 48 |
-
class NumericalReasoning(datasets.GeneratorBasedBuilder):
|
| 49 |
"""TODO: Short description of my dataset."""
|
| 50 |
|
| 51 |
VERSION = datasets.Version("0.1.0")
|
| 52 |
|
| 53 |
BUILDER_CONFIGS = [
|
| 54 |
-
datasets.BuilderConfig(
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
datasets.BuilderConfig(name="convert_week_day", version=VERSION, description="x minutes equals y seconds"),
|
| 60 |
-
datasets.BuilderConfig(name="convert_month_week", version=VERSION, description="x months equals y weeks"),
|
| 61 |
-
datasets.BuilderConfig(name="convert_year_month", version=VERSION, description="x years equals y months"),
|
| 62 |
-
datasets.BuilderConfig(name="convert_decade_year", version=VERSION, description="x decades equals y years"),
|
| 63 |
]
|
| 64 |
|
| 65 |
DEFAULT_CONFIG_NAME = "multiplication"
|
| 66 |
|
| 67 |
def _info(self):
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
features = datasets.Features(
|
| 78 |
-
{
|
| 79 |
-
"x": datasets.Value("int32"),
|
| 80 |
-
"x_time_unit": datasets.Value("string"),
|
| 81 |
-
"y": datasets.Value("int32"),
|
| 82 |
-
"y_time_unit": datasets.Value("string"),
|
| 83 |
-
}
|
| 84 |
-
)
|
| 85 |
return datasets.DatasetInfo(
|
| 86 |
description=_DESCRIPTION,
|
| 87 |
features=features,
|
|
@@ -102,67 +80,13 @@ class NumericalReasoning(datasets.GeneratorBasedBuilder):
|
|
| 102 |
|
| 103 |
def _generate_examples(self, split):
|
| 104 |
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
for
|
| 108 |
-
|
| 109 |
-
key += 1
|
| 110 |
-
yield key, {
|
| 111 |
-
"x1": x1,
|
| 112 |
-
"x2": x2,
|
| 113 |
-
"y": x1*x2,
|
| 114 |
-
}
|
| 115 |
-
|
| 116 |
-
elif self.config.name == "addition":
|
| 117 |
-
key = 0
|
| 118 |
-
for x1 in range(0,100):
|
| 119 |
-
for x2 in range(1,51):
|
| 120 |
-
key += 1
|
| 121 |
-
yield key, {
|
| 122 |
-
"x1": x1,
|
| 123 |
-
"x2": x2,
|
| 124 |
-
"y": x1+x2,
|
| 125 |
-
}
|
| 126 |
-
else:
|
| 127 |
-
if "min_sec" in self.config.name:
|
| 128 |
-
x_time_unit = "minutes"
|
| 129 |
-
y_time_unit = "seconds"
|
| 130 |
-
multiplier = 60
|
| 131 |
-
|
| 132 |
-
elif "hour_min" in self.config.name:
|
| 133 |
-
x_time_unit = "hours"
|
| 134 |
-
y_time_unit = "minutes"
|
| 135 |
-
multiplier = 60
|
| 136 |
-
|
| 137 |
-
elif "day_hour" in self.config.name:
|
| 138 |
-
x_time_unit = "days"
|
| 139 |
-
y_time_unit = "hours"
|
| 140 |
-
multiplier = 24
|
| 141 |
-
|
| 142 |
-
elif "week_day" in self.config.name:
|
| 143 |
-
x_time_unit = "weeks"
|
| 144 |
-
y_time_unit = "days"
|
| 145 |
-
multiplier = 7
|
| 146 |
-
|
| 147 |
-
elif "month_week" in self.config.name:
|
| 148 |
-
x_time_unit = "months"
|
| 149 |
-
y_time_unit = "weeks"
|
| 150 |
-
multiplier = 30
|
| 151 |
-
|
| 152 |
-
elif "year_month" in self.config.name:
|
| 153 |
-
x_time_unit = "years"
|
| 154 |
-
y_time_unit = "months"
|
| 155 |
-
multiplier = 12
|
| 156 |
-
|
| 157 |
-
elif "decade_year" in self.config.name:
|
| 158 |
-
x_time_unit = "decades"
|
| 159 |
-
y_time_unit = "years"
|
| 160 |
-
multiplier = 10
|
| 161 |
-
|
| 162 |
-
for key, x in enumerate(range(0, 100)):
|
| 163 |
yield key, {
|
| 164 |
-
"
|
| 165 |
-
"
|
| 166 |
-
"
|
| 167 |
-
"
|
| 168 |
}
|
|
|
|
| 35 |
# TODO: Add the licence for the dataset here if you can find it
|
| 36 |
_LICENSE = ""
|
| 37 |
|
| 38 |
+
class NumericalReasoningArithmetic(datasets.GeneratorBasedBuilder):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
"""TODO: Short description of my dataset."""
|
| 40 |
|
| 41 |
VERSION = datasets.Version("0.1.0")
|
| 42 |
|
| 43 |
BUILDER_CONFIGS = [
|
| 44 |
+
datasets.BuilderConfig(
|
| 45 |
+
name="{}".format(num),
|
| 46 |
+
version=VERSION,
|
| 47 |
+
description="Task with {} as the first operand".format(num)) \
|
| 48 |
+
for num in range(0,100)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
]
|
| 50 |
|
| 51 |
DEFAULT_CONFIG_NAME = "multiplication"
|
| 52 |
|
| 53 |
def _info(self):
|
| 54 |
+
features = datasets.Features(
|
| 55 |
+
{
|
| 56 |
+
"x1": datasets.Value("string"),
|
| 57 |
+
"x2": datasets.Value("string"),
|
| 58 |
+
"y_mul": datasets.Value("int32"),
|
| 59 |
+
"y_add": datasets.Value("int32"),
|
| 60 |
+
}
|
| 61 |
+
)
|
| 62 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
return datasets.DatasetInfo(
|
| 64 |
description=_DESCRIPTION,
|
| 65 |
features=features,
|
|
|
|
| 80 |
|
| 81 |
def _generate_examples(self, split):
|
| 82 |
|
| 83 |
+
key = 0
|
| 84 |
+
for x1 in range(0,100):
|
| 85 |
+
for x2 in range(1,51):
|
| 86 |
+
key += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
yield key, {
|
| 88 |
+
"x1": x1,
|
| 89 |
+
"x2": x2,
|
| 90 |
+
"y_mul": x1*x2,
|
| 91 |
+
"y_add": x1+x2,
|
| 92 |
}
|