char-cnn+torch+ubuntu16.04(RNN) 安装过程

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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章