As an alternative to Caffe framework, Torch 7, which is maintained by Facebook Research provides a more flexible framework for machine learning algorithms, especially for popular Deep Learning. Difference from the Caffe that is developed by C++ & CUDA (see here for source codes) and wrapped with multiple script language such as python and matlab, Torch 7 is developed using C & CUDA (see here for source code) under the hood while the interface is provided through LuaJIT, an easy and efficient script language. In this post, I install the Torch 7 framework on my Ubuntu 14.04 laptop and run the basic test programs on it, using only CPU.
To find out what is Lua, you can refer this article (http://cellux.github.io/articles/introduction-to-luajit-part-1/)
Torch 7:
Website:
http://torch.ch/
Github:
https://github.com/torch/torch7
Installation Instruction:
http://torch.ch/docs/getting-started.html#_
According to this instruction:
# in a terminal, run the commands curl -sk https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash
The first line is to install dependencies that are required for Torch 7,
Go into this bash file (https://raw.githubusercontent.com/torch/ezinstall/master/install-deps), you can see that the dependencies are (part of it them listed):
OpenBLAS: an optimized BLAS library, BLAS, called Basic Linear Algebra Subprograms, provides standard building blocks for performing basic vector and matrix operations.
gcc/g++, cmake, git, gnuplot, python, etc.
This will take several minutes (mine for 20 mins) according to your computer.
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; ./install.sh
Second and third lines install LuaJIT, LuaRocks, and use LuaRocks to install Torch and other packages. You can see some of the packages in their github (https://github.com/torch/distro). Torch is installed on your computer under the path: "~/torch/".
This will take several minutes (mine for ~2 min clone from git and ~15 min to install)
Nicely Done!
After several minutes installation, you can just type:
"th" in terminal to run torch.
Note that if it shows "th: command not found", please refresh the bashrc file by command:
"source ~/.bashrc"
Then command "th" will give you this:
Test Torch 7:
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"
Done! You will see the demo runs to train different models on the CIFAR dataset. The screenshot is like this:
Thanks:) it is useful.
ReplyDeleteHello dear community friends.
ReplyDeleteI just made an installation article for Ubuntu 15.04. I hope it will be helpful especially for new Ubuntu lovers.
How to Install Ubuntu 15.04 in VMware Workstation 12 with Easy Install Step-by-Step
http://www.sysadminshowto.com/how-to-install-ubuntu-15-04-in-vmware-workstation-12-with-easy-install-step-by-step/
Made for the Ubuntu community.
Love sharing knowledge with others!
how to install iTorch?
ReplyDeleteDo I Have to install OpenBLAS before or after installing Torch7?
ReplyDeletehi!
ReplyDeleteHow much time have you spent on training this model (screenshot) ???
Can we stop it while it is training? thanks
I have access to server which has torch installed in specific directory. I need to run torch from my directory, by simply write $th, it gives me the message of not found. What should I do?
ReplyDelete