2016-09-28 146 views
1

错误加载模块“libpaths”我有卢阿5.2,火炬版本7,Ubuntu的版本14.04信赖的安装Lua中抛出错误luajit:从文件

我试图运行下面的代码 +++++++ +++++++++++++++代码++++++++++++++++++++++++++++++++++++++++++++

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 

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

我收到以下错误

 
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 
+0

你确定你在'/home/guru99u2/torch/install/lib/lua/5.2/'有lua dll吗?它失踪的卢阿功能。所以我们可以责怪dll。 –

回答

2

出现了一些在安装过程中错误(或你没有清除以前的版本),因为你正在尝试使用支持Lua 5.1 ABI的解释器(在这种情况下是LuaJIT)为Lua 5.2构建模块。结果你得到那个错误undefined symbol: luaL_setfuncs,因为动态库期望有这个函数,但是加载的解释器不提供它。

Torch同时支持LuaJIT和Lua 5.2,但在切换Lua版本时需要按照documentation中的说明运行./clean.sh脚本。

+0

我已经这样做了,但仍然是相同的错误。我需要重新安装lua&torch吗?如果是,那么安装的正确顺序是什么。我将不得不安装第一个lua 5.2或火炬或luajit&订单的其余部分并感谢您的帮助 –

+0

您是否指定了'TORCH_LUA_VERSION'?如果您将它配置为Lua 5.2,则使用Lua 5.2运行脚本而不是LuaJIT。 –

+0

是的,我完全按照文档“TORCH_LUA_VERSION = LUA52 ./install.sh”来做 - 我输入的命令是 –