xacer commited on
Commit
7d55b83
1 Parent(s): 238d5b8

Fix issue generating split on Windows

Browse files

The separator used by `glob.glob` is `os.path.sep`, which is usually `/` but sometimes `\` (Windows). This contribution changes the expected separator from `/` to `os.path.sep` and fixes a bug on Windows where the script fails to generate the train and test splits.

Files changed (1) hide show
  1. libri_light.py +1 -1
libri_light.py CHANGED
@@ -147,7 +147,7 @@ class LibriLight(datasets.GeneratorBasedBuilder):
147
  def _generate_examples(self, archive_path):
148
  paths = glob.glob(os.path.join(archive_path, self.config.name, "**", "**", "*.flac"))
149
  for key, path in enumerate(paths):
150
- path_split = path.split("/")
151
  id_ = path_split[-1].replace(".flac", "")
152
  speaker_id = int(path_split[-3])
153
  path_json = path.replace(".flac", ".json")
 
147
  def _generate_examples(self, archive_path):
148
  paths = glob.glob(os.path.join(archive_path, self.config.name, "**", "**", "*.flac"))
149
  for key, path in enumerate(paths):
150
+ path_split = path.split(os.path.sep)
151
  id_ = path_split[-1].replace(".flac", "")
152
  speaker_id = int(path_split[-3])
153
  path_json = path.replace(".flac", ".json")