ajbrock / BigGAN-PyTorch

The author's officially unofficial PyTorch BigGAN implementation.
MIT License
2.84k stars 470 forks source link

sh scripts/utils/prepare_data.sh error #62

Closed ShuangjunLiu closed 4 years ago

ShuangjunLiu commented 4 years ago

Run sh scripts/utils/prepare_data.sh as indicated.
Got error,

{'dataset': 'I128', 'data_root': 'data\r', 'batch_size': 256, 'num_workers': 16, 'chunk_size': 500, 'compression': False} /ImageNetaset root location data Data will not be augmented... Traceback (most recent call last): File "make_hdf5.py", line 110, in main() File "make_hdf5.py", line 107, in main run(config) File "make_hdf5.py", line 63, in run kwargs)[0] File "/scratch/liu.shu/codesPool/BigGAN-PyTorch/utils.py", line 566, in get_data_loaders load_in_mem=load_in_mem, dataset_kwargs) File "/scratch/liu.shu/codesPool/BigGAN-PyTorch/datasets.py", line 110, in init classes, class_to_idx = find_classes(root) File "/scratch/liu.shu/codesPool/BigGAN-PyTorch/datasets.py", line 34, in find_classes classes = [d for d in os.listdir(dir) if os.path.isdir(os.path.join(dir, d))] FileNotFoundError: [Errno 2] No such file or directory: 'data\r/ImageNet' {'dataset': 'I128_hdf5', 'data_root': 'data', 'batch_size': 64, 'parallel': False, 'augment': False, 'num_workers': 8, 'shuffle': False, 'seed': 0} Using dataset root location data/ILSVRC128.hdf5 Traceback (most recent call last): File "calculate_inception_moments.py", line 91, in main() File "calculate_inception_moments.py", line 87, in main run(config) File "calculate_inception_moments.py", line 52, in run loaders = utils.get_data_loaders(config) File "/scratch/liu.shu/codesPool/BigGAN-PyTorch/utils.py", line 566, in get_data_loaders load_in_mem=load_in_mem, dataset_kwargs) File "/scratch/liu.shu/codesPool/BigGAN-PyTorch/datasets.py", line 190, in init self.num_imgs = len(h5.File(root, 'r')['labels']) File "/home/liu.shu/.conda/envs/py36/lib/python3.7/site-packages/h5py/_hl/files.py", line 312, in init fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr) File "/home/liu.shu/.conda/envs/py36/lib/python3.7/site-packages/h5py/_hl/files.py", line 142, in make_fid fid = h5f.open(name, flags, fapl=fapl) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py/h5f.pyx", line 78, in h5py.h5f.open OSError: Unable to open file (unable to open file: name = 'data/ILSVRC128.hdf5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

Seems to use a blend of windows and linux path.

ShuangjunLiu commented 4 years ago

I found out this is caused by the end of line character on windows. Please delete this issue. Thanks.