2017-06-04 75 views
0

所以,我試圖用this tutorial在我的mac(Sierra)上設置torch-rnn。我已經完成了步驟1-6(基本安裝和預處理數據),但是當我嘗試運行實際需要的訓練命令我碰到一個錯誤:火炬無法找到HDF5頭文件

Catons-Mac-mini:torch-rnn catons$ th train.lua -gpu -1 -input_h5 data/datafile.h5 -input_json data/datafile.json 
/Users/catons/torch/install/bin/luajit: /Users/catons/torch/install/share/lua/5.1/trepl/init.lua:389: /Users/catons/torch/install/share/lua/5.1/trepl/init.lua:389: /Users/catons/torch/install/share/lua/5.1/hdf5/ffi.lua:42: Error: unable to locate HDF5 header file at /usr/local/Cellar/hdf5/1.10.1/include;/usr/include;/usr/local/opt/szip/include/hdf5.h 
stack traceback: 
    [C]: in function 'error' 
    /Users/catons/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require' 
    train.lua:6: in main chunk 
    [C]: in function 'dofile' 
    ...tons/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk 
    [C]: at 0x0105195a10 

注:我不得不修改命令列車因缺少CUDA支持

我嘗試使用brew卸載並重新安裝hdf5,包括使用--with-mpi選項。儘管如此,頭文件仍然沒有顯示出來。

感謝您的任何幫助或建議!

編輯:好的,所以頭文件實際上存在,我不認爲火炬找不到它由於權限問題,因爲我設置文件的權限爲-rwxrwxrwx(不可否認,這可能會太過分了)。

回答

0

我有同樣的問題。我正在運行2013年初與Sierra的Mac。

對我來說有效的是使用HDF5 1.8而不是1.10.1。

brew install [email protected] 

然後更新/Users/catons/torch/install/share/lua/5.1/hdf5/init.lua的路徑指向1.8,而不是1.10.1。

hdf5._config = { 
    HDF5_INCLUDE_PATH = "/usr/local/Cellar/[email protected]/1.8.18/include", 
    HDF5_LIBRARIES = "/usr/local/Cellar/[email protected]/1.8.18/lib/libhdf5.dylib;/usr/local/opt/szip/lib/libsz.dylib;/usr/lib/libz.dylib;/usr/lib/libdl.dylib;/usr/lib/libm.dylib" 
} 

如果你在這之後的「關閉」的錯誤,以取代線44在ffi.lua文件在同一目錄:

local process = io.popen("gcc -D '_Nullable=' -E " .. headerPath) -- TODO pass -I 

最後,如果你使用的火炬-CL ,您需要替換config.lua和ffi.lua的torch-cl版本中的路徑和第44行。