vkapoor commited on
Commit
5be181a
·
1 Parent(s): 8969c0d

Update ecoset.py

Browse files
Files changed (1) hide show
  1. ecoset.py +13 -4
ecoset.py CHANGED
@@ -168,27 +168,36 @@ class Ecoset(datasets.GeneratorBasedBuilder):
168
  archives = dl_manager.download_custom(_URLS["ikw"], subprocess_download)
169
  print("Ecoset files are stored under: \n", archives)
170
 
171
-
 
 
 
 
 
 
 
 
 
172
 
173
  # return data splits
174
  return [datasets.SplitGenerator(
175
  name=datasets.Split.TRAIN,
176
  gen_kwargs={
177
- "archives": archives,
178
  "split": "train",
179
  },
180
  ),
181
  datasets.SplitGenerator(
182
  name=datasets.Split.VALIDATION,
183
  gen_kwargs={
184
- "archives": archives,
185
  "split": "validation",
186
  },
187
  ),
188
  datasets.SplitGenerator(
189
  name=datasets.Split.TEST,
190
  gen_kwargs={
191
- "archives": archives,
192
  "split": "test",
193
  },
194
  ),
 
168
  archives = dl_manager.download_custom(_URLS["ikw"], subprocess_download)
169
  print("Ecoset files are stored under: \n", archives)
170
 
171
+ split_dict = {split:[] for split in ("train", "val", "test")}
172
+ for split in split_dict.keys():
173
+ # Get a list of subdirectories within the current split's directory
174
+ subdirectories = [d for d in os.listdir(os.path.join(archives, split)) if os.path.isdir(os.path.join(archives, split, d))]
175
+
176
+ # Iterate through the subdirectories and collect file paths
177
+ for subdirectory in subdirectories:
178
+ subdirectory_path = os.path.join(archives, split, subdirectory)
179
+ file_paths = abslist(subdirectory_path)
180
+ split_dict[split].extend(file_paths)
181
 
182
  # return data splits
183
  return [datasets.SplitGenerator(
184
  name=datasets.Split.TRAIN,
185
  gen_kwargs={
186
+ "archives": split_dict,
187
  "split": "train",
188
  },
189
  ),
190
  datasets.SplitGenerator(
191
  name=datasets.Split.VALIDATION,
192
  gen_kwargs={
193
+ "archives": split_dict,
194
  "split": "validation",
195
  },
196
  ),
197
  datasets.SplitGenerator(
198
  name=datasets.Split.TEST,
199
  gen_kwargs={
200
+ "archives": split_dict,
201
  "split": "test",
202
  },
203
  ),