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 clonehttps://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-devluarocks 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 clonehttps://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
网友评论