Unverified Commit 47e59b16 authored by Philip Meier's avatar Philip Meier Committed by GitHub
Browse files

separate caching logic from download (#3448)


Co-authored-by: default avatarFrancisco Massa <fvsmassa@gmail.com>
parent b266c2f1
...@@ -92,8 +92,10 @@ class PhotoTour(VisionDataset): ...@@ -92,8 +92,10 @@ class PhotoTour(VisionDataset):
self.download() self.download()
if not self._check_datafile_exists(): if not self._check_datafile_exists():
raise RuntimeError('Dataset not found.' + try:
' You can use download=True to download it') self.cache()
except Exception as error:
raise RuntimeError("Dataset not found. You can use download=True to download it") from error
# load the serialized data # load the serialized data
self.data, self.labels, self.matches = torch.load(self.data_file) self.data, self.labels, self.matches = torch.load(self.data_file)
...@@ -151,6 +153,7 @@ class PhotoTour(VisionDataset): ...@@ -151,6 +153,7 @@ class PhotoTour(VisionDataset):
os.unlink(fpath) os.unlink(fpath)
def cache(self) -> None:
# process and save as torch files # process and save as torch files
print('# Caching data {}'.format(self.data_file)) print('# Caching data {}'.format(self.data_file))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment