2016-09-28 29 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」來做 - 我輸入的命令是 –