When enumerating over dataloaders I get the following error:
Traceback (most recent call last):
File “train.py”, line 218, in 
main()
File “train.py”, line 109, in main
train_valid(model, optimizer, scheduler, epoch, data_loaders, data_size, t)
File “train.py”, line 128, in train_valid
for batch_idx, batch_sample in enumerate(dataloaders[phase]):
File “/home/mhouben/miniconda3/envs/pytorch12/lib/python3.6/site-packages/torch/utils/data/dataloader.py”, line 819, in next
return self._process_data(data)
File “/home/mhouben/miniconda3/envs/pytorch12/lib/python3.6/site-packages/torch/utils/data/dataloader.py”, line 846, in _process_data
data.reraise()
File “/home/mhouben/miniconda3/envs/pytorch12/lib/python3.6/site-packages/torch/_utils.py”, line 369, in reraise
raise self.exc_type(msg)
KeyError: Caught KeyError in DataLoader worker process 0.
Original Traceback (most recent call last):
File “/home/mhouben/miniconda3/envs/pytorch12/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py”, line 178, in _worker_loop
data = fetcher.fetch(index)
File “/home/mhouben/miniconda3/envs/pytorch12/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py”, line 47, in fetch
return self.collate_fn(data)
File “/home/mhouben/miniconda3/envs/pytorch12/lib/python3.6/site-packages/torch/utils/data/_utils/collate.py”, line 75, in default_collate
return {key: default_collate([d[key] for d in batch]) for key in elem}
File “/home/mhouben/miniconda3/envs/pytorch12/lib/python3.6/site-packages/torch/utils/data/_utils/collate.py”, line 75, in 
return {key: default_collate([d[key] for d in batch]) for key in elem}
File “/home/mhouben/miniconda3/envs/pytorch12/lib/python3.6/site-packages/torch/utils/data/_utils/collate.py”, line 75, in 
return {key: default_collate([d[key] for d in batch]) for key in elem}
KeyError: ‘anc_img’
I am running out of ideas on how to figure out what causes this error. Any thoughts on what could cause this? Or how I should approach this error?