We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fc33c46 commit 41865ebCopy full SHA for 41865eb
torchvision/datasets/phototour.py
@@ -82,8 +82,10 @@ def __init__(
82
self.download()
83
84
if not self._check_datafile_exists():
85
- raise RuntimeError('Dataset not found.' +
86
- ' You can use download=True to download it')
+ try:
+ self.cache()
87
+ except Exception as error:
88
+ raise RuntimeError("Dataset not found. You can use download=True to download it") from error
89
90
# load the serialized data
91
self.data, self.labels, self.matches = torch.load(self.data_file)
@@ -141,6 +143,7 @@ def download(self) -> None:
141
143
142
144
os.unlink(fpath)
145
146
+ def cache(self) -> None:
147
# process and save as torch files
148
print('# Caching data {}'.format(self.data_file))
149
0 commit comments