ruotianluo / self-critical.pytorch

Unofficial pytorch implementation for Self-critical Sequence Training for Image Captioning. and others.
MIT License
991 stars 278 forks source link

"IndexError: pop from empty list" when eval #255

Closed hungnt14 closed 2 years ago

hungnt14 commented 3 years ago

I got this error while my code was doing eval test cases I'm training on COCO2017 dataset use with resnet.

Traceback (most recent call last): File "tools/train.py", line 296, in train(opt) File "tools/train.py", line 250, in train dp_model, lw_model.crit, loader, eval_kwargs) File "/content/self-critical.pytorch/captioning/utils/eval_utils.py", line 207, in eval_split predictions.pop() IndexError: pop from empty list

ruotianluo commented 3 years ago

Does it happen when batch_size is 1?

qchenjie commented 3 years ago

I also encountered this problem, This is trained on the flickr30 dataset , and the batch_size is 10 ,

hungnt14 commented 2 years ago

I fixed it by putting some if statements to prevent this error happen. And the training process has worked. I don't know whether this change can affect the result, but it works xD