diff --git a/src/litdata/streaming/config.py b/src/litdata/streaming/config.py index ef32cd843..23402df55 100644 --- a/src/litdata/streaming/config.py +++ b/src/litdata/streaming/config.py @@ -83,7 +83,7 @@ def download_chunk_from_index(self, chunk_index: int) -> None: return if self._downloader is None: - raise RuntimeError("The downloader should be defined.") + return self._downloader.download_chunk_from_index(chunk_index) @@ -101,7 +101,9 @@ def try_decompress(self, local_chunkpath: str) -> None: with open(local_chunkpath, "rb") as f: data = f.read() - os.remove(local_chunkpath) + # delete the files only if they were downloaded + if self._downloader is not None: + os.remove(local_chunkpath) data = self._compressor.decompress(data)