1
votes

I have lua 5.2, Torch version 7, Ubuntu version 14.04 trusty Installed

I am trying to run the following code ++++++++++++++++++++++code++++++++++++++++++++++++++++++++++++++++++++

require 'neuralconvo' require 'xlua' 
-- Load Dataset 
print("--Loading Dataset") 
dataset=neuralconvo.Dataset(neuralconvo.CornellMovieDiaogs("data/cornell_movie_diaogs"),
{   loadFirst = options.dataset,
    minWordFreq = options.minWordFreq 
})

--Build Model 
model = neuralconvo.Seq2Seq(dataset.wordsCount, options.hiddenSize) model.goToken = dataset.goToken 
model.eosToken=dataset.eosToken

--Training Parameters 
model.criterion=nn.SequencerCriterion(nn.ClassNLLCriterion()) 
model.learningRaw =  options.learningRate 
model.momentum = otions.momentum 
local decayFactor = (options.minLR - options.learningRate)/options.saturateEpoch local minMeanError = nil

--Enable Cuda 
if options.cuda then    
    require 'cutorch'   
    require 'cunn' 
elseif options.opencl then  
    require 'cltorch'   
    require 'clnn'
    model:cl()
end

-- Train Model using backpropogation    
for epoch = 1,options.maxEpoch do
    local errors = torch.Tensor(dataset.examplesCount):fill(0)      
    local timer=torch.timer()
    local i=1
    for examples in dataset:batches(options.batchSize) do                                                                                     
            collectgarbage()
            for _, example in ipairs(examples) do
                    local input, target = unpack(examples) do
                    if options.cuda then
                        input = input:cuda()
                        target = target:cuda()
                    elseif options.opencl then
                        input = input:cl()
                        target = target:cl()
                    end
                    local err=model:train(input, target)
                        if err ~= err then
                            error("Invalid error! Exiting.")
                        end
                    errors[i] = err
                    xlua.progress(i, dataset.examplesCount)
                    i=i+1
                    end             
             end        
             timer:stop()       
--Save the model if not Improved        
if minMeanError == nil or errors:mean() < minMeanError then
                print("\n(Saving model...)")  
                torch.save("data/model.t7",model)
                minMeanError=errors:mean()      
           end
-- Update Learning Rate         
    model.learningRate = model.learningRate + decayFactor       
    model.learningRate = math.max(options.minLR,model.learningRate)         
end     
end

   =============================================================     

I get the following error

luajit: error loading module 'libpaths' from file '/home/guru99u2/torch/install/lib/lua/5.2/libpaths.so':
    /home/guru99u2/torch/install/lib/lua/5.2/libpaths.so: undefined symbol: luaL_setfuncs
stack traceback:
    [C]: at 0x00450240
    [C]: in function 'require'
    /home/guru99u2/torch/install/share/lua/5.2/paths/init.lua:1: in main chunk
    [C]: in function 'require'
    /home/guru99u2/torch/install/share/lua/5.2/torch/init.lua:12: in main chunk
    [C]: in function 'require'
    ./neuralconvo.lua:1: in main chunk
    [C]: in function 'require'
    bot.lua:1: in main chunk
    [C]: at 0x00404d60
1
Are you sure you have lua dll in '/home/guru99u2/torch/install/lib/lua/5.2/'? Its missing lua function. So we can blame dll. - Kamila Szewczyk

1 Answers

2
votes

Something went wrong during the installation process (or you didn't clean the previous version) as you are trying to use modules built for Lua 5.2 with the interpreter that supports Lua 5.1 ABI (LuaJIT in this case). As the result you get that error undefined symbol: luaL_setfuncs because the dynamic library expects to have the function, but the loaded interpreter doesn't provide it.

Torch supports both LuaJIT and Lua 5.2, but you need to run ./clean.sh script as indicated in the documentation when switching Lua versions.