You can download a copy of this code with the following command:
git clone https://github.com/michaelcapizzi/dynet_tutorial.git
It is recommended that you use virtual environments for all python projects.
For more informatio on conda, see here
For more information on virtualenv, see here
This repository is built with python 3 and has the following requirements:
numpyjupytermatplotlib
They can be installed by running pip install -r requirements.txt
These instructions can all be found here
Make sure to have the following installed globally on your machine before attempting installation.
udo apt-get update
sudo apt-get install python-pip build-essential cmake mercurial
xcode-select --install
brew install cmake hg python
These instructions have been taken from here
dynet is written in C++ with a python wrapper (there's also a scala wrapper!).
As a result, installing dynet requires three steps:
- getting system requirements
- compiling the
C++code - installing the
pythonwrapper
Anytime you re-install or update dynet, you will be required to:
git pullfrom thedynetdirectory- compile the
C++code (step 2 above) - reinstall the
pythonwrapper (step 3 above)
- Install
cython
pip install cython
- Clone the
dynetrepository
mkdir dynet-base
cd dynet-base
git clone https://github.com/clab/dynet.git
- Clone the
eigenrepository (requirement for matrix operations)
hg clone https://bitbucket.org/eigen/eigen -r 346ecdb
- Compile
C++(this can take up to 10 minutes)
cd dynet
mkdir build
cd build
cmake .. -DEIGEN3_INCLUDE_DIR=../../eigen -DPYTHON=`which python`
make -j 2
cd python
python ../../setup.py build --build-dir=.. --skip-build install
From the root directory (dynet-base/dynet) of the dynet install, run this command:
python examples/python/xor.py
I have not tried installing for Windows, but instructions are here