- Cmake 2.8.7
- Eigen
dynet
(Don't have to install this separately; will be installed below)
These steps have been tested on Ubuntu 16.04 and macOS Sierra.
- Once this repository has been cloned, the
dynet/
submodule needs to be synced
git submodule init
git submodule update
- This will download the required files to dynet directory. Let this directory be
PATH_TO_DYNET
.
PATH_TO_DYNET=<your_stack_lstm_dir>/dynet/
- Download the C++ library
eigen
which is used by dynet:
cd $HOME
hg clone https://bitbucket.org/eigen/eigen/
cd eigen
Note: There were compilation issues with some versions of eigen
. This installation has been successful with Eigen v3.3.1
4. Now, create a build
directory and install eigen:
mkdir build
cd build
cmake ..
- Run
sudo make install
. This will push the library files to the localinclude
directory. On Ubuntu 16.04 and macOS Sierra, they are copied to/usr/local/include/eigen3
. - Go back to
dynet
directory instack-lstm-ner
and builddynet
. Modify the code below with youreigen3
include
location and boost location.
cd $PATH_TO_DYNET
mkdir build
cd build
cmake .. -DEIGEN3_INCLUDE_DIR=/usr/local/include/eigen3
make -j 2
Note: If DYNET fails to compile and throws an error like this:
$ make -j 2
Scanning dependencies of target dynet
Scanning dependencies of target dynet_shared
[ 1%] [ 2%] Building CXX object dynet/CMakeFiles/dynet.dir/cfsm-builder.cc.o
Building CXX object dynet/CMakeFiles/dynet_shared.dir/cfsm-builder.cc.o
In file included from /home/user/dynet/dynet/dynet.h:13:0,
from /home/user/dynet/dynet/cfsm-builder.h:6,
from /home/user/dynet/dynet/cfsm-builder.cc:1:
/home/user/dynet/dynet/tensor.h:22:42: fatal error: unsupported/Eigen/CXX11/Tensor: No such file or directory
#include <unsupported/Eigen/CXX11/Tensor>
^
compilation terminated.
Then, download and install a stable version of Eigen and rebuild DyNet:
cd $HOME
wget u.cs.biu.ac.il/~yogo/eigen.tgz
tar zxvf eigen.tgz
cd eigen
Repeat step 4 and run:
cd $PATH_TO_DYNET/build
rm -rf *
Now, rebuild DyNet again.
7. Create a build
directory in <stack_lstm_dir> and in the same directory stack-lstm-ner
, do cmake . -DEIGEN3_INCLUDE_DIR=/usr/local/include/eigen3
and then make
. This will build lstm-parse
in ner-system
If you want to see the compile commands that are used, you can run
make VERBOSE=1