Text-Summarizer-Pytorch-Chinese icon indicating copy to clipboard operation
Text-Summarizer-Pytorch-Chinese copied to clipboard

请问一下运行eval时报的错,怎末处理

Open mlm22222 opened this issue 2 years ago • 3 comments

Traceback (most recent call last): File "D:/Text-Summarizer-Pytorch-Chinese-master/eval.py", line 171, in eval_processor.evaluate_batch(True) File "D:/Text-Summarizer-Pytorch-Chinese-master/eval.py", line 78, in evaluate_batch start_id, end_id, unk_id) File "D:\Text-Summarizer-Pytorch-Chinese-master\beam_search.py", line 179, in beam_search sum_temporal_srcs_i, prev_s_i).type(T.long) File "D:\Text-Summarizer-Pytorch-Chinese-master\beam_search.py", line 54, in advance self.hid_h = h[beams_order] #(beam, n_hid); sorted IndexError: tensors used as indices must be long, byte or bool tensors

mlm22222 avatar Apr 19 '22 11:04 mlm22222

IndexError: tensors used as indices must be long, byte or bool tensors

建议debug下

LowinLi avatar May 13 '22 02:05 LowinLi

是用的win么?我也遇到了,应该是索引的问题,但是在linux就没报错

suancaimian avatar Jul 07 '22 12:07 suancaimian

把 beams_order = best_scores_id.squeeze(1) / n_extended_vocab 改成 beams_order = best_scores_id.squeeze(1) // n_extended_vocab

JJJJerry avatar Apr 24 '23 04:04 JJJJerry