jiasenlu / NeuralBabyTalk

Pytorch code of for our CVPR 2018 paper "Neural Baby Talk"
https://arxiv.org/abs/1803.09845
MIT License
523 stars 123 forks source link

BUG in misc/utils.py #13

Open wangxinyu0922 opened 6 years ago

wangxinyu0922 commented 6 years ago

In my environment (pytorch 0.4.0), it will report error for line 78: word = itow[str(ix)] Because ix is a tensor, so it is better to use ix.item() to replace the ix, also for line 112, 128 and 154

Dvangelion commented 6 years ago

I have a similar bug reported in the validation phase. I was wondering I should replace fg_seq[i,j] by fg_seq[i,j].item() as well? Thanks for your help!

Exception NameError: "global name 'FileNotFoundError' is not defined" in <bound method _DataLoaderIter.del of <torch.utils.data.dataloader._DataLoaderIter object at 0x7f4039abbf50>> ignored /DATA/Ke/Babytalk/NeuralBabyTalk/misc/model.py:306: UserWarning: volatile was removed and now has no effect. Use with torch.no_grad(): instead. conv_feats, fc_feats = self.cnn(Variable(img.data, volatile=True)) Traceback (most recent call last): File "main.py", line 357, in lang_stats = eval(opt) File "main.py", line 154, in eval seq.data, bn_seq.data, fg_seq.data, opt.vocab_size, opt) File "/DATA/Ke/Babytalk/NeuralBabyTalk/misc/utils.py", line 64, in decode_sequence det_word = itod[fg_seq[i,j]] KeyError: tensor(110, device='cuda:0') Exception NameError: "global name 'FileNotFoundError' is not defined" in <bound method _DataLoaderIter.del of <torch.utils.data.dataloader._DataLoaderIter object at 0x7f4039abb050>> ignored

wangxinyu0922 commented 6 years ago

There are many part having the same problem, you can try it.

FuyuWang commented 6 years ago

@Dvangelion, I meet the same problem, have you solved it ???