尊敬的作者,您好,在用您代码实验中modeling_unilm.py出现下面的报错,
File "C:\Users\river\Unilm-master\modeling_unilm.py", line 431, in forward
return self.beam_search(input_ids, token_type_ids, position_ids, attention_mask)
File "C:\Users\river\Unilm-master\modeling_unilm.py", line 691, in beam_search
seq.append(wids_list[fid - 1][pos_in_frame])
TypeError: list indices must be integers or slices, not float
在modeling_unilm.py报错的地方做如下的修改后,
seq = [wids_list[frame_id][pos_in_frame]]
for fid in range(frame_id, 0, -1):
pos_in_frame = int(ptrs[fid][pos_in_frame]) # 添加了int() 类型转换
seq.append(wids_list[fid - 1][pos_in_frame])
seq.reverse()
traces['pred_seq'].append(seq)
程序可正常运行,但出现预测输出文件重复字的情况。请问这样修改的对吗?重复字的问题是这样修改导致的吗?求指导,不甚感谢
尊敬的作者,您好,在用您代码实验中modeling_unilm.py出现下面的报错, File "C:\Users\river\Unilm-master\modeling_unilm.py", line 431, in forward return self.beam_search(input_ids, token_type_ids, position_ids, attention_mask) File "C:\Users\river\Unilm-master\modeling_unilm.py", line 691, in beam_search seq.append(wids_list[fid - 1][pos_in_frame]) TypeError: list indices must be integers or slices, not float 在modeling_unilm.py报错的地方做如下的修改后, seq = [wids_list[frame_id][pos_in_frame]] for fid in range(frame_id, 0, -1): pos_in_frame = int(ptrs[fid][pos_in_frame]) # 添加了int() 类型转换 seq.append(wids_list[fid - 1][pos_in_frame]) seq.reverse() traces['pred_seq'].append(seq) 程序可正常运行,但出现预测输出文件重复字的情况。请问这样修改的对吗?重复字的问题是这样修改导致的吗?求指导,不甚感谢