LayneH / SAT-selective-cls

Self-Adaptive Traning for Selective Classification.
MIT License
2 stars 4 forks source link

'C10' object has no attribute 'train_data' #1

Closed titobrezende closed 2 years ago

titobrezende commented 2 years ago

Hi!! Trying to run the default .sh file I get this error:

Namespace(arch='vgg16_bn', coverage=[100.0, 99.0, 98.0, 97.0, 95.0, 90.0, 85.0, 80.0, 75.0, 70.0, 60.0, 50.0, 40.0, 30.0, 20.0, 10.0], dataset='cifar10', epochs=300, evaluate=False, gamma=0.5, gpu_id='1', loss='sat', lr=0.1, manualSeed=9690, momentum=0.9, pretrain=0, rewards=[2.2], sat_momentum=0.99, save='./log/cifar10_vgg16_bnsat', schedule=[25, 50, 75, 100, 125, 150, 175, 200, 225, 250, 275], test_batch=200, train_batch=128, weight_decay=0.0005, workers=4) ==> Preparing dataset cifar10 Downloading https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz to /home/tito/datasets/CIFAR10/cifar-10-python.tar.gz 100.0%Extracting /home/tito/datasets/CIFAR10/cifar-10-python.tar.gz to /home/tito/datasets/CIFAR10 Files already downloaded and verified ==> creating model 'vgg16_bn' Total params: 14.99M

./log/cifar10_vgg16_bnsat/cifar10/vgg16_bno2.20 Epoch: [1 | 300] LR: 0.100000 Traceback (most recent call last): File "train.py", line 590, in main() File "train.py", line 200, in main train_loss, train_acc = train(trainloader, model, criterion, optimizer, epoch, use_cuda) File "train.py", line 235, in train for batch_idx, batch_data in enumerate(trainloader): File "/home/tito/venvs/pyTorch/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 345, in next data = self._next_data() File "/home/tito/venvs/pyTorch/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 856, in _next_data return self._process_data(data) File "/home/tito/venvs/pyTorch/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 881, in _process_data data.reraise() File "/home/tito/venvs/pyTorch/lib/python3.8/site-packages/torch/_utils.py", line 395, in reraise raise self.exc_type(msg) AttributeError: Caught AttributeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/tito/venvs/pyTorch/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/home/tito/venvs/pyTorch/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/tito/venvs/pyTorch/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/tito/development/SAT-selective-cls/dataset_utils.py", line 42, in getitem img, target = self.train_data[index], self.train_labels[index] AttributeError: 'C10' object has no attribute 'train_data'

LayneH commented 2 years ago

Hi,

It seems the problem comes from the inconsistency of TorchVision that this code uses an older version. Please refer to these lines to fix the problem.