Closed kevinuserdd closed 3 years ago
File "../V0/modules.py", line 93, in forward pe_ss = self.pe_ss[(pos_ss).view(-1)+self.max_seq_len].view(size=[batch,max_seq_len,max_seq_len,-1]) IndexError: index 363 is out of bounds for dimension 0 with size 351
和max_seq_len大小有关,作者训练的时候max_seq_len取为训练集和测试集中最大的句子长度,max_seq_len被用于位置向量的编码。如果预测的句子长度超过max_seq_len + 1 的时候就会出错。建议调整flat_main.py中的max_seq_len,并且控制预测句子的长度。
File "../V0/modules.py", line 93, in forward pe_ss = self.pe_ss[(pos_ss).view(-1)+self.max_seq_len].view(size=[batch,max_seq_len,max_seq_len,-1]) IndexError: index 363 is out of bounds for dimension 0 with size 351
和max_seq_len大小有关,作者训练的时候max_seq_len取为训练集和测试集中最大的句子长度,max_seq_len被用于位置向量的编码。如果预测的句子长度超过max_seq_len + 1 的时候就会出错。建议调整flat_main.py中的max_seq_len,并且控制预测句子的长度。
我想问下,这里(pos_ss).view(-1)+self.max_seq_len 有什么特殊含义吗?
File "../V0/modules.py", line 93, in forward pe_ss = self.pe_ss[(pos_ss).view(-1)+self.max_seq_len].view(size=[batch,max_seq_len,max_seq_len,-1]) IndexError: index 363 is out of bounds for dimension 0 with size 351