LowinLi / Text-Summarizer-Pytorch-Chinese

提供一款中文版生成式摘要服务
MIT License
319 stars 48 forks source link

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

Open mlm22222 opened 2 years ago

mlm22222 commented 2 years ago

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

LowinLi commented 2 years ago
IndexError: tensors used as indices must be long, byte or bool tensors

建议debug下

suancaimian commented 2 years ago

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

JJJJerry commented 1 year ago

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