macournoyer / neuralconvo

Neural conversational model in Torch
777 stars 346 forks source link

Train with error #79

Open wilddylan opened 7 years ago

wilddylan commented 7 years ago

When I execute this command th train.lua --dataset 20000 --hiddenSize 100; I got this error:

-- Loading dataset
Loading vocabulary from data/vocab.t7 ...

Dataset stats:
  Vocabulary size: 3830
         Examples: 58852
dgk ending

-- Epoch 1 / 30

/Users/root1/torch/install/bin/lua: ...root1/torch/install/share/lua/5.2/rnn/recursiveUtils.lua:44: expecting nested tensors or tables. Got nil and nil instead
stack traceback:
    [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 ?

Before execute this command, I install nn, rnn and async use luarock.

wilddylan commented 7 years ago

Fixed

Modified seq2seq.lua:

--[[ Backward coupling: Copy decoder gradients to encoder LSTM ]]--
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
wilddylan commented 7 years ago

But When training continued, Got this error:

-- Loading dataset
Loading vocabulary from data/vocab.t7 ...

Dataset stats:
  Vocabulary size: 3830
         Examples: 58852
dgk ending

-- Epoch 1 / 30

/Users/root1/torch/install/bin/lua: /Users/root1/torch/install/share/lua/5.2/torch/File.lua:375: unknown object
stack traceback:
    [C]: in function 'error'
    /Users/root1/torch/install/share/lua/5.2/torch/File.lua:375: in function 'readObject'
    ./dataset.lua:144: in function 'for iterator'
    train.lua:77: in main chunk
    [C]: in function 'dofile'
    ...oot1/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
    [C]: in ?

How to Fix this???