rosinality / vq-vae-2-pytorch

Implementation of Generating Diverse High-Fidelity Images with VQ-VAE-2 in PyTorch
Other
1.62k stars 272 forks source link

AttributeError: 'CodeRow' object has no attribute 'file' #50

Closed JCL823 closed 4 years ago

JCL823 commented 4 years ago

When I was trying the code in Step2 (I run python train_pixelsnail.py LMDB128, where LMDB128 is the lmdb file named by myself), I got an error:

Namespace(amp='O0', batch=32, channel=256, ckpt=None, dropout=0.1, epoch=420, hier='top', lr=0.0003, n_cond_res_block=3, n_out_res_block=0, n_res_block=4, n_res_channel=256, path='LMDB128', sched=None) 0%| | 0/2187 [00:00<?, ?it/s]Traceback (most recent call last): File "train_pixelsnail.py", line 151, in <module> train(args, i, loader, model, optimizer, scheduler, device) File "train_pixelsnail.py", line 25, in train for i, (top, bottom, label) in enumerate(loader): File "/export/scratch/laixx313/miniconda3/envs/myenv235/lib/python3.6/site-packages/tqdm/std.py", line 1102, in __iter__ for obj in iterable: File "/export/scratch/laixx313/miniconda3/envs/myenv235/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 819, in __next__ return self._process_data(data) File "/export/scratch/laixx313/miniconda3/envs/myenv235/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 846, in _process_data data.reraise() File "/export/scratch/laixx313/miniconda3/envs/myenv235/lib/python3.6/site-packages/torch/_utils.py", line 369, in reraise raise self.exc_type(msg) AttributeError: Caught AttributeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/export/scratch/laixx313/miniconda3/envs/myenv235/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/export/scratch/laixx313/miniconda3/envs/myenv235/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/export/scratch/laixx313/miniconda3/envs/myenv235/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/export/scratch/laixx313/MAW/Robust_Gen/torch/vq-vae-2/dataset.py", line 51, in __getitem__ return torch.from_numpy(row.top), torch.from_numpy(row.bottom), row.file AttributeError: 'CodeRow' object has no attribute 'file'

Could you please let me know where I got wrong?