A small mistake in translator.py - please ignore, just filed a github issue

pytorch

(Lance Norskog) #1

This came when running the German->English model:
iwslt-brnn2.s131_acc_62.71_ppl_7.74_e20.pt

/content/OpenNMT-py/onmt/translate/translation.py:48: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number
tokens[i] = src_raw[max_index[0]]


(Guillaume Klein) #2

The GitHub issue for reference:


(Guillaume Klein) #3