Skip to content

Commit 7f8b329

Browse files
authored
dcgan: using fake dataset still requires dataroot parameter (#699)
* dataroot parameter set to required=False in the dcgan example * more robust check on dcgan fake dataset
1 parent 02d5761 commit 7f8b329

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

dcgan/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
parser = argparse.ArgumentParser()
1717
parser.add_argument('--dataset', required=True, help='cifar10 | lsun | mnist |imagenet | folder | lfw | fake')
18-
parser.add_argument('--dataroot', required=True, help='path to dataset')
18+
parser.add_argument('--dataroot', required=False, help='path to dataset')
1919
parser.add_argument('--workers', type=int, help='number of data loading workers', default=2)
2020
parser.add_argument('--batchSize', type=int, default=64, help='input batch size')
2121
parser.add_argument('--imageSize', type=int, default=64, help='the height / width of the input image to network')
@@ -51,6 +51,9 @@
5151

5252
if torch.cuda.is_available() and not opt.cuda:
5353
print("WARNING: You have a CUDA device, so you should probably run with --cuda")
54+
55+
if opt.dataroot is None and str(opt.dataset).lower() != 'fake':
56+
raise ValueError("`dataroot` parameter is required for dataset \"%s\"" % opt.dataset)
5457

5558
if opt.dataset in ['imagenet', 'folder', 'lfw']:
5659
# folder dataset

0 commit comments

Comments
 (0)