Datasets:
Upload permutation-groups.py with huggingface_hub
Browse files- permutation-groups.py +10 -18
permutation-groups.py
CHANGED
|
@@ -174,27 +174,19 @@ class PermutationGroups(datasets.GeneratorBasedBuilder):
|
|
| 174 |
|
| 175 |
def _generate_examples(self, filepaths, split):
|
| 176 |
# Load the Arrow files and yield examples
|
| 177 |
-
import pyarrow as pa
|
| 178 |
-
|
| 179 |
# Handle both single filepath and list of filepaths
|
| 180 |
if isinstance(filepaths, str):
|
| 181 |
filepaths = [filepaths]
|
| 182 |
|
| 183 |
example_id = 0
|
| 184 |
for filepath in filepaths:
|
| 185 |
-
#
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
for idx, row in df.iterrows():
|
| 196 |
-
yield example_id, {
|
| 197 |
-
"input_sequence": row["input_sequence"],
|
| 198 |
-
"target": row["target"],
|
| 199 |
-
}
|
| 200 |
-
example_id += 1
|
|
|
|
| 174 |
|
| 175 |
def _generate_examples(self, filepaths, split):
|
| 176 |
# Load the Arrow files and yield examples
|
|
|
|
|
|
|
| 177 |
# Handle both single filepath and list of filepaths
|
| 178 |
if isinstance(filepaths, str):
|
| 179 |
filepaths = [filepaths]
|
| 180 |
|
| 181 |
example_id = 0
|
| 182 |
for filepath in filepaths:
|
| 183 |
+
# Load the arrow file using datasets library
|
| 184 |
+
dataset = datasets.Dataset.from_file(filepath)
|
| 185 |
+
|
| 186 |
+
# Yield each row as an example
|
| 187 |
+
for row in dataset:
|
| 188 |
+
yield example_id, {
|
| 189 |
+
"input_sequence": row["input_sequence"],
|
| 190 |
+
"target": row["target"],
|
| 191 |
+
}
|
| 192 |
+
example_id += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|