Skip to content

Commit

Permalink
Added graceful exit if data download errored (#3096)
Browse files Browse the repository at this point in the history
  • Loading branch information
vfdev-5 authored Oct 16, 2023
1 parent 253b5f1 commit 624eb63
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions examples/super_resolution/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ def __len__(self):
return len(self.dataset)


trainset = torchvision.datasets.Caltech101(root="./data", download=True)
testset = torchvision.datasets.Caltech101(root="./data", download=False)
try:
trainset = torchvision.datasets.Caltech101(root="./data", download=True)
testset = torchvision.datasets.Caltech101(root="./data", download=False)
except RuntimeError:
print("Dataset download problem, exiting without error code")
exit(0)

trainset_sr = SRDataset(trainset, scale_factor=opt.upscale_factor, crop_size=opt.crop_size)
testset_sr = SRDataset(testset, scale_factor=opt.upscale_factor, crop_size=opt.crop_size)
Expand Down

0 comments on commit 624eb63

Please sign in to comment.