seq2seq+torch7聊天机器人bug处理
[C]: in function 'error'
...root1/torch/install/share/lua/5.2/rnn/recursiveUtils.lua:44: in function 'recursiveCopy'
./seq2seq.lua:58: in function 'backwardConnect'
./seq2seq.lua:78: in function 'train'
train.lua:90: in main chunk
[C]: in function 'dofile'
...oot1/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: in ?
出现这个bug应该是tensorflow更新问题。
修改seq2seq.lua文件
function Seq2Seq:backwardConnect()
-- self.encoderLSTM.userNextGradCell =--
-- nn.rnn.recursiveCopy(self.encoderLSTM.userNextGradCell, self.decoderLSTM.userGradPrevCell)
-- self.encoderLSTM.gradPrevOutput =
-- nn.rnn.recursiveCopy(self.encoderLSTM.gradPrevOutput, self.decoderLSTM.userGradPrevOutput)
if (self.encoderLSTM.userNextGradCell ~= nil) then
self.encoderLSTM.userNextGradCell =
nn.rnn.recursiveCopy(self.encoderLSTM.userNextGradCell, self.decoderLSTM.userGradPrevCell)
end
if (self.encoderLSTM.gradPrevOutput ~= nil) then
self.encoderLSTM.gradPrevOutput =
nn.rnn.recursiveCopy(self.encoderLSTM.gradPrevOutput, self.decoderLSTM.userGradPrevOutput)
end
end
训练完之后会出现无法对话,原因是没有cunn
所以必须安装cuda
有个地方修改后会无限出现我是小通
英文原版的几个作者写的也不尽相同,中文版有和他们不同,所以很坑