Element-Research / rnn

Recurrent Neural Network library for Torch7's nn
BSD 3-Clause "New" or "Revised" License
939 stars 313 forks source link

attempt to index global '_' (a nil value) #285

Closed christopher5106 closed 8 years ago

christopher5106 commented 8 years ago

I just tried

require 'nn'

rho = 5
hiddenSize = 10
outputSize = 5 -- num classes
nIndex = 10000

-- recurrent module
rm = nn.Sequential()
   :add(nn.ParallelTable()
      :add(nn.LookupTable(nIndex, hiddenSize))
      :add(nn.Linear(hiddenSize, hiddenSize)))
   :add(nn.CAddTable())
   :add(nn.Sigmoid())

rnn = nn.Sequencer(
   nn.Sequential()
      :add(nn.Recurrence(rm, hiddenSize, 1))
      :add(nn.Linear(hiddenSize, outputSize))
      :add(nn.LogSoftMax())
)

and I get on one of my computers the following error :

/torch/install/bin/luajit: .../torch/install/share/lua/5.1/rnn/Recurrence.lua:15: attempt to index global '_' (a nil value)
stack traceback:
    ...h/torch/install/share/lua/5.1/rnn/Recurrence.lua:15: in function '__init'
    ...st/torch/install/share/lua/5.1/torch/init.lua:91: in function <...st/torch/install/share/lua/5.1/torch/init.lua:87>
    [C]: in function 'Recurrence'
    scripts/test.lua:19: in main chunk
    [C]: in function 'dofile'
    ...urez/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
    [C]: at 0x010a4a41b0

any idea what can it be ? thanks a lot

nicholas-leonard commented 8 years ago

A recent modernization of the _ package broke this. Sorry I should have tested rnn as well. Commit https://github.com/Element-Research/rnn/commit/c935faa35dadf982140dd1636258f3f7bd0e6024 fixes this. Updating rnn should fix your issue. Thank you for telling us about the bug :)