Installing Torch 7 deep learning on Ubuntu 16.04

Make sure you have followed caffe setup if not atleast install Prerequisite packages from that post.

Step 1: install general dependencies

sudo apt-get install --no-install-recommends git software-properties-common

Step 2: gedit ~/.bashrc (append following lines) and restart terminal (source ~/.bashrc)

export TORCH_ROOT=~/torch

Step 3: Download Torch repo in that root location

git clone https://github.com/torch/distro.git $TORCH_ROOT --recursive

Step 4: Change directory to Torch folder

cd $TORCH_ROOT

Step 5: Install torch dependencies

./install-deps

Step 6: Now, lets install torch

./install.sh -b

Step 7: Install some extra dependencies after restarting terminal (source ~/.bashrc)

sudo apt-get install --no-install-recommends libhdf5-serial-dev liblmdb-dev

luarocks install tds
luarocks install "https://raw.github.com/deepmind/torch-hdf5/master/hdf5-0-0.rockspec"
luarocks install "https://raw.github.com/Neopallium/lua-pb/master/lua-pb-scm-0.rockspec"
luarocks install lightningmdb 0.9.18.1-1 LMDB_INCDIR=/usr/include LMDB_LIBDIR=/usr/lib/x86_64-linux-gnu

# If you have installed NCCL
luarocks install "https://raw.githubusercontent.com/ngimel/nccl.torch/master/nccl-scm-1.rockspec"

luarocks install nngraph 
luarocks install optim
luarocks install nn

If you’d like to train on an NVIDIA GPU using CUDA (this can be to about 15x faster), you’ll of course need the GPU, and you will have to install the CUDA Toolkit. Then get the cutorch and cunn packages:

luarocks install cutorch
luarocks install cunn

Aditionally to load caffe models in torch

luarocks install loadcaffe

Step 8: Install torch/demos from github by command:

git clone https://github.com/torch/demos

Go into the demos folder, then just run one of the demos:

th demos/train-on-cifar/train-on-cifar.lua

Training screenshot

torchtestupload

Advertisements

Join the Discussion

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: