IAM

OPENSOURCEFAN STUDYING
STUDYINGCOMPUTERSCIENCEANDMATH COMPUTERSCIENCE

Check out the latest superpixel benchmark — Superpixel Benchmark (2016) — and let me know your opinion! @david_stutz

SERIES»Working with Ubuntu«

Installing Torch and iTorch, Installing ZeroBrane Studio with Torch Support

In this series, I blog about development and research with Ubuntu. This time: how to install LUA, Torch and iTorch and use Torch from within ZeroBrane Studio.

Torch can easily be installed from the repository and includes LUAJit:

git clone https://github.com/torch/distro.git ~/torch-master --recursive
cd ~/torch-master
bash install-deps
# Installation will take longer with CUDA and CuDNN:
./install.sh

At the end, the installer will add the following line to the bash profile:

. ~/torch-master/install/bin/torch-activate

After starting a new console, the installation can be tested by running the interactive Torch console:

th
 
  ______             __   |  Torch7 
 /_  __/__  ________/ /   |  Scientific computing for Lua. 
  / / / _ \/ __/ __/ _ \  |  Type ? for help 
 /_/  \___/_/  \__/_//_/  |  https://github.com/torch 
                          |  http://torch.ch 
	
th> require 'torch'
# will list all the functions ...

To work with Torch in an iPython (or Jupyter) notebook, Facebook provides a Torch kernel. The following assumes that iPython and Jupyter are already installed:

# Console should be restarted after installing Torch:
sudo apt-get install libzmq3-dev libssl-dev python-zmq
sudo apt-get install luarocks
luarocks install lzmq --local
luarocks install image --local
git clone https://github.com/facebook/iTorch.git iTorch-master
cd iTorch-master
luarocks make --local

The kernel can be tested by running jupyter notebook and looking for the iTorch kernel.

ZeroBrane Studio can easily be installed from the website or as follows:

wget https://download.zerobrane.com/ZeroBraneStudioEduPack-1.50-linux.sh
chmod +x ZeroBraneStudioEduPack-1.50-linux.sh
sudo ./ZeroBraneStudioEduPack-1.50-linux.sh
rm ZeroBraneStudioEduPack-1.50-linux.sh

In order to run Torch from within ZeroBrane Studio, it needs to know where Torch's binary is located:

export TORCH_BIN=~/torch-master/install/bin/th

By starting ZeroBrane Studio from console (after creating a new console instance) using zbstudio, Torch can easily be used; test it using

require 'torch'

More from »Working with Ubuntu«:

What is your opinion on this article? Did you find it interesting or useful? Let me know your thoughts in the comments below or using the following platforms:

@david_stutz