Please somebody fix rnn luarocks installation

191 views
Skip to first unread message

Tasty Minerals

unread,
Oct 24, 2017, 4:30:33 PM10/24/17
to torch7
I have just reinstalled Torch as usual via standard procedure. 

git clone https://github.com/torch/distro.git torch --recursive
cd torch
./install.sh


Afterwards, I updated the environment via torch-activate script and used ~/torch/install/bin/luarocks to install rnn and dpnn packages.
However, all my rnn based models stopped running due to 

/home/pavel/torch/install/bin/luajit: /home/pavel/torch/install/share/lua/5.1/trepl/init.lua:389: /home/pavel/torch/install/share/lua/5.1/trepl/init.lua:389: /home/pavel/torch/install/share/lua/5.1/torch/init.lua:102: class nn.SpatialGlimpse has been already assigned a parent class stack traceback: [C]: in function 'error' /home/pavel/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require'
 main
.lua:4: in main chunk

Here is why:

/home/pavel/torch/install/share/lua/5.1/rnn/init.lua file:

require 'torchx'
local _ = require 'moses'
require 'nn'
local _cuda, _ = pcall(require, 'cunn')

-- create global rnn table:
rnn
= {}
rnn
.cuda = _cuda
rnn
.version = 2.7 -- better support for bidirection RNNs

(...)

-- modules
require('rnn.LookupTableMaskZero')
require('rnn.MaskZero')
require('rnn.ReverseSequence')
require('rnn.SpatialGlimpse') <-- this should not be here, because it is instantiated by dpnn

But checkout from rnn master pulls the correct 2.1 version not 2.7 as above!

My /home/pavel/torch/install/share/lua/5.1/dpnn/init.lua seems in sync with dpnn master

require 'torch'
require 'nn'
local _ = require 'moses'
-- create global dpnn table
dpnn
= {}
dpnn
.version = 2

unpack
= unpack or table.unpack -- lua 5.2 compat

(...)

-- modules
require('dpnn.ReverseTable')
require('dpnn.Inception')
require('dpnn.Clip')
require('dpnn.SpatialUniformCrop')
require('dpnn.SpatialGlimpse')

Trying to fix I am bumping into new errors which make little sense and never appeared before on the exact same code.
Can somebody explain why does luarocks installs incorrect rnn init.lua? 
This is a serious blocker for us right now because we can't run experiments via a newly created Torch docker image which pulls this mess each time. 

pa...@gini.net

unread,
Oct 25, 2017, 10:18:31 AM10/25/17
to torch7
I figured it out. Element-Research/rnn was deprecated in favor of torch/rnn and with it they deprecated some classes that now do not exist in rnn anymore. So, if you decide to update your Torch installation you models that use rnn will probably stop working.
In order to keep the compatibility with the older code you can continue using Element-Research version:

git clone https://github.com/Element-Research/rnn.git
cd rnn
luarocks make rocks/rnn-scm-1.rockspec
Reply all
Reply to author
Forward
0 new messages