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.

Is there an empty line in your test file?

No it is not. But now it is working

What did you do to solve the issue? It could help others facing the same error.

With or without verbose, there seems to be when it is translated and sometimes not.There seems to be a bug.