Update markushgrapher-datasets.py
Browse files
markushgrapher-datasets.py
CHANGED
|
@@ -73,11 +73,12 @@ class MarkushGrapherDataset(GeneratorBasedBuilder):
|
|
| 73 |
raise ValueError(f"Unsupported config: {self.config.name}")
|
| 74 |
|
| 75 |
def _split_generators(self, dl_manager):
|
| 76 |
-
|
|
|
|
| 77 |
|
| 78 |
splits = []
|
| 79 |
for split in ["train", "test"]:
|
| 80 |
-
split_path = os.path.join(
|
| 81 |
if os.path.exists(split_path):
|
| 82 |
splits.append(SplitGenerator(
|
| 83 |
name=Split.TRAIN if split == "train" else Split.TEST,
|
|
@@ -92,9 +93,8 @@ class MarkushGrapherDataset(GeneratorBasedBuilder):
|
|
| 92 |
for f in files:
|
| 93 |
if f.endswith(".arrow"):
|
| 94 |
arrow_files.append(os.path.join(root, f))
|
| 95 |
-
|
| 96 |
-
|
| 97 |
for file in arrow_files:
|
| 98 |
-
dataset = Dataset.from_file(file)
|
| 99 |
for i, row in enumerate(dataset):
|
| 100 |
yield f"{file}_{i}", row
|
|
|
|
| 73 |
raise ValueError(f"Unsupported config: {self.config.name}")
|
| 74 |
|
| 75 |
def _split_generators(self, dl_manager):
|
| 76 |
+
base_dir = dl_manager.download_and_extract("") # Download the full repo root
|
| 77 |
+
config_path = os.path.join(base_dir, self.config.name)
|
| 78 |
|
| 79 |
splits = []
|
| 80 |
for split in ["train", "test"]:
|
| 81 |
+
split_path = os.path.join(config_path, split)
|
| 82 |
if os.path.exists(split_path):
|
| 83 |
splits.append(SplitGenerator(
|
| 84 |
name=Split.TRAIN if split == "train" else Split.TEST,
|
|
|
|
| 93 |
for f in files:
|
| 94 |
if f.endswith(".arrow"):
|
| 95 |
arrow_files.append(os.path.join(root, f))
|
| 96 |
+
|
|
|
|
| 97 |
for file in arrow_files:
|
| 98 |
+
dataset = datasets.Dataset.from_file(file)
|
| 99 |
for i, row in enumerate(dataset):
|
| 100 |
yield f"{file}_{i}", row
|