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


(Lance Norskog) #1

This came when running the German->English model:

/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