fixpath
Browse files- ChessBot-Dataset.py +8 -10
ChessBot-Dataset.py
CHANGED
|
@@ -26,19 +26,17 @@ class ChessPGNDataset(GeneratorBasedBuilder):
|
|
| 26 |
def _split_generators(self, dl_manager: DownloadManager):
|
| 27 |
from pathlib import Path, os
|
| 28 |
|
| 29 |
-
if
|
| 30 |
-
repo_root = Path(__file__).parent
|
| 31 |
-
else:
|
| 32 |
repo_root = Path(self.config.data_dir)
|
|
|
|
|
|
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
train_paths = dl_manager.download([str(p) for p in train_shards])
|
| 41 |
-
test_paths = dl_manager.download([str(p) for p in test_shards])
|
| 42 |
|
| 43 |
return [
|
| 44 |
SplitGenerator(
|
|
|
|
| 26 |
def _split_generators(self, dl_manager: DownloadManager):
|
| 27 |
from pathlib import Path, os
|
| 28 |
|
| 29 |
+
if self.config.data_dir:
|
|
|
|
|
|
|
| 30 |
repo_root = Path(self.config.data_dir)
|
| 31 |
+
train_files = [repo_root / 'train' / f for f in os.listdir(repo_root / 'train')]
|
| 32 |
+
test_files = [repo_root / 'test' / f for f in os.listdir(repo_root / 'test')]
|
| 33 |
|
| 34 |
+
elif self.config.data_files:
|
| 35 |
+
train_files = self.config.data_files["train"]
|
| 36 |
+
test_files = self.config.data_files["test"]
|
| 37 |
|
| 38 |
+
train_paths = dl_manager.download(train_files)
|
| 39 |
+
test_paths = dl_manager.download(test_files)
|
|
|
|
|
|
|
| 40 |
|
| 41 |
return [
|
| 42 |
SplitGenerator(
|