zoukankan      html  css  js  c++  java
  • 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

    有个地方修改后会无限出现我是小通

    英文原版的几个作者写的也不尽相同,中文版有和他们不同,所以很坑

  • 相关阅读:
    16-高级指针
    15-C语言结构体
    14-C语言宏
    13-C语言字符串函数库
    12-C语言字符串
    11-C语言指针
    10-C语言函数
    POJ 1001 高精度乘法
    POJ 1060 多项式乘法和除法取余
    POJ 1318 字典排序
  • 原文地址:https://www.cnblogs.com/fengmao31/p/13880198.html
Copyright © 2011-2022 走看看