ptrblck:

Could you post the complete stack trace


This is the complete error:
---------------------------------------------------------------------------

IndexError                                Traceback (most recent call last)

<ipython-input-41-e0be5daf1ede> in <module>()
      1 # Train model on val set
----> 2 train(combo, (loaders_a, loaders_b), optimizer, criterion, epochs=3, dev=dev)

6 frames

<ipython-input-40-457ef59c47c1> in train(net, loaders, optimizer, criterion, epochs, dev, save_param, model_name)
     42         print("Pre-for")
     43           #j=0
---> 44         for j, ((input_a, labels_a), (input_b, labels_b)) in enumerate(zip(loaders_a["val"], loaders_b["val"])):
     45           print("first print inside for")
     46           labels_a = labels_a.unsqueeze(1).float()

/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py in __next__(self)
    515             if self._sampler_iter is None:
    516                 self._reset()
--> 517             data = self._next_data()
    518             self._num_yielded += 1
    519             if self._dataset_kind == _DatasetKind.Iterable and \

/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py in _next_data(self)
    555     def _next_data(self):
    556         index = self._next_index()  # may raise StopIteration
--> 557         data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
    558         if self._pin_memory:
    559             data = _utils.pin_memory.pin_memory(data)

/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py in fetch(self, possibly_batched_index)
     42     def fetch(self, possibly_batched_index):
     43         if self.auto_collation:
---> 44             data = [self.dataset[idx] for idx in possibly_batched_index]
     45         else:
     46             data = self.dataset[possibly_batched_index]

/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py in <listcomp>(.0)
     42     def fetch(self, possibly_batched_index):
     43         if self.auto_collation:
---> 44             data = [self.dataset[idx] for idx in possibly_batched_index]
     45         else:
     46             data = self.dataset[possibly_batched_index]

/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataset.py in __getitem__(self, idx)
    328 
    329     def __getitem__(self, idx):
--> 330         return self.dataset[self.indices[idx]]
    331 
    332     def __len__(self):

/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataset.py in __getitem__(self, idx)
    328 
    329     def __getitem__(self, idx):
--> 330         return self.dataset[self.indices[idx]]
    331 
    332     def __len__(self):

IndexError: list index out of range

This occur only on val set.