char-cnn+torch+ubuntu16.04(RNN) 安裝過程
1. 搭建Torch 環境
1.1 安裝Torch7 的依賴項
# in a terminal, run the commands
curl -sk https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash
cd ~/torch; ./install.sh
安裝成功的標誌是最後顯示“==> Torch7’s dependencies have been installed ”
1.2 安裝 torch distribution
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; ./install.sh
注:安裝過程出現以下問題:
1. ./install.sh: line 59: cmake: command not found
意思就是cmake 命令程序沒有安裝,執行命令
sudo apt install cmake
安裝,安裝成功後繼續 cd ~/torch; ./install.sh 命令。
2.
error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was received.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
fatal: clone of 'https://github.com/torch/cutorch.git' into submodule path 'extra/cutorch' failed
這個報錯,原因可能是網絡的原因,切到你安裝torch 的目錄下重新安裝:
git clone https://github.com/torch/distro.git ~/torch --recursive
直到成功安裝,然後繼續cd ~/torch; ./install.sh
編譯程序
執行下列命令,使得安裝過程中被更改的PATH生效:
source ~/.bashrc
執行下列命令查看torch 是否安裝成功:
$th
出現上圖圖片中的內容表示torch安裝成功。
1.3 卸載torch
如果不使用torch,可以使用下列命令卸載:
rm -rf ~/torch
可以使用luarocks命令安裝其他的torch包
$ luarocks install image
$ luarocks list
至此Torch 環境 搭建完成
2. 運行char-cnn
2.1 安裝必要的包
$ luarocks install nngraph
$ luarocks install optim