missing
Browse files- ChessBot-Dataset.py +21 -21
ChessBot-Dataset.py
CHANGED
|
@@ -43,32 +43,32 @@ class ChessPGNDataset(GeneratorBasedBuilder):
|
|
| 43 |
})
|
| 44 |
)
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
|
| 58 |
|
| 59 |
-
|
| 60 |
-
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
|
| 73 |
def _generate_examples(self, shards):
|
| 74 |
import chess.pgn
|
|
|
|
| 43 |
})
|
| 44 |
)
|
| 45 |
|
| 46 |
+
def _split_generators(self, dl_manager: DownloadManager):
|
| 47 |
+
from pathlib import Path, os
|
| 48 |
|
| 49 |
+
if self.config.data_dir:
|
| 50 |
+
repo_root = Path(self.config.data_dir)
|
| 51 |
+
train_files = [repo_root / 'train' / f for f in os.listdir(repo_root / 'train')]
|
| 52 |
+
test_files = [repo_root / 'test' / f for f in os.listdir(repo_root / 'test')]
|
| 53 |
|
| 54 |
+
elif self.config.data_files:
|
| 55 |
+
train_files = self.config.data_files["train"]
|
| 56 |
+
test_files = self.config.data_files["test"]
|
| 57 |
|
| 58 |
|
| 59 |
+
train_paths = dl_manager.download(train_files)
|
| 60 |
+
test_paths = dl_manager.download(test_files)
|
| 61 |
|
| 62 |
+
return [
|
| 63 |
+
SplitGenerator(
|
| 64 |
+
name=Split.TRAIN,
|
| 65 |
+
gen_kwargs={"shards": train_paths},
|
| 66 |
+
),
|
| 67 |
+
SplitGenerator(
|
| 68 |
+
name=Split.TEST,
|
| 69 |
+
gen_kwargs={"shards": test_paths},
|
| 70 |
+
),
|
| 71 |
+
]
|
| 72 |
|
| 73 |
def _generate_examples(self, shards):
|
| 74 |
import chess.pgn
|