KeithG33 commited on
Commit
54ad75a
·
1 Parent(s): 7a57da1
Files changed (1) hide show
  1. 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 not self.config.data_dir:
30
- repo_root = Path(__file__).parent
31
- else:
32
  repo_root = Path(self.config.data_dir)
 
 
33
 
34
- # Get files in the train and test directories
35
- train_shards = [repo_root / 'train' / f for f in os.listdir(repo_root / 'train')]
36
- test_shards = [repo_root / 'test' / f for f in os.listdir(repo_root / 'test')]
37
 
38
- train_shards = sorted((repo_root / 'train').glob("*.pgn"))
39
- test_shards = sorted((repo_root / 'test').glob("*.pgn"))
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(