OpenNMT Forum

RuntimeError: cannot perform reduction function max on tensor with no elements because the operation does not have an identity

Hi Everyone
I try to translate but Error is occur.
command

python3 ~/work/OpenNMT-py/translate.py -model model/model_step_30000.pt -src en-train-sp -output back_data -replace_unk -verbose -gpu 0

Error

Traceback (most recent call last):
File “/home/chanjun_park/work/OpenNMT-py/translate.py”, line 48, in
main(opt)
File “/home/chanjun_park/work/OpenNMT-py/translate.py”, line 32, in main
attn_debug=opt.attn_debug
File “/home/chanjun_park/work/OpenNMT-py/onmt/translate/translator.py”, line 332, in translate
translations = xlation_builder.from_batch(batch_data)
File “/home/chanjun_park/work/OpenNMT-py/onmt/translate/translation.py”, line 95, in from_batch
for n in range(self.n_best)]
File “/home/chanjun_park/work/OpenNMT-py/onmt/translate/translation.py”, line 95, in
for n in range(self.n_best)]
File “/home/chanjun_park/work/OpenNMT-py/onmt/translate/translation.py”, line 50, in _build_target_tokens
_, max_index = attn[i][:len(src_raw)].max(0)
RuntimeError: cannot perform reduction function max on tensor with no elements because the operation does not have an identity

Thanks in advance.