From 8c5f46505f0dab2727be5efd70f5d3a7f55535c1 Mon Sep 17 00:00:00 2001 From: Moritz Gunz Date: Tue, 10 Sep 2024 15:53:13 +0200 Subject: [PATCH] `OggZipDataset`: normalize // to / when reading files from archive The dataset implementation joins some paths wrongly at times, leading to double slashes breaking lookup in the zip file, even though there is a file at that path. By normalizing // to / the file can be read properly. --- returnn/datasets/audio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/returnn/datasets/audio.py b/returnn/datasets/audio.py index 2803f2599..2add4a106 100644 --- a/returnn/datasets/audio.py +++ b/returnn/datasets/audio.py @@ -179,7 +179,7 @@ def _read(self, filename, zip_index): return gzip.open(self._separate_txt_files[name], "rb").read() if self._zip_files is not None: - return self._zip_files[zip_index].read(filename) + return self._zip_files[zip_index].read(filename.replace("//", "/")) return open("%s/%s" % (self.paths[0], filename), "rb").read() def _collect_data_part(self, zip_index) -> Tuple[List[Dict[str, Any]], Optional[Dict[str, Any]]]: