forked from espnet/espnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
68 lines (54 loc) · 2.39 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
PYTHON := /usr/bin/python2.7
KALDI =
.PHONY: all clean
all: virtualenv chainer_patch kaldi nkf kaldi-io-for-python warp-ctc chainer_ctc sentencepiece moses
all_python: virtualenv chainer_patch warp-ctc chainer_ctc
kaldi-io-for-python:
git clone https://github.com/vesis84/kaldi-io-for-python.git
cd ../src/utils; ln -s ../../tools/kaldi-io-for-python/kaldi_io.py kaldi_io_py.py
ifneq ($(strip $(KALDI)),)
kaldi:
ln -s $(KALDI) kaldi
else
kaldi:
git clone https://github.com/kaldi-asr/kaldi.git kaldi_github; cd kaldi_github/tools; $(MAKE) all
cd kaldi_github/src; ./configure --shared --use-cuda=no; $(MAKE) depend; $(MAKE) all
ln -nfs kaldi_github kaldi
endif
# for some reason, including matplotlib in requirements.txt causes errors, and
# matplotlib should be separately pip installed
virtualenv: requirements.txt
test -d venv || virtualenv -p $(PYTHON) venv
. venv/bin/activate; pip install pip --upgrade
. venv/bin/activate; pip install -r requirements.txt
. venv/bin/activate; pip install matplotlib
chainer_patch: virtualenv
$(eval FILENAME := $(shell find venv/lib -name "multiprocess_iterator.py"))
. venv/bin/activate; patch $(FILENAME) < prefetch.patch
nkf:
mkdir -p nkf
cd nkf; wget https://ja.osdn.net/dl/nkf/nkf-2.1.4.tar.gz
cd nkf; tar zxvf nkf-2.1.4.tar.gz; cd nkf-2.1.4; $(MAKE) prefix=.
warp-ctc: virtualenv
git clone https://github.com/jnishi/warp-ctc.git
. venv/bin/activate; cd warp-ctc && mkdir build && cd build && cmake .. && make -j4 ; true
. venv/bin/activate; pip install cffi
. venv/bin/activate; cd warp-ctc/pytorch_binding && python setup.py install # maybe need to: apt-get install python-dev
chainer_ctc: virtualenv
git clone https://github.com/jheymann85/chainer_ctc.git
. venv/bin/activate; pip install cython
. venv/bin/activate; cd chainer_ctc && chmod +x install_warp-ctc.sh && ./install_warp-ctc.sh ; true
. venv/bin/activate; cd chainer_ctc && pip install .
sentencepiece:
git clone https://github.com/google/sentencepiece.git
cd sentencepiece && mkdir build && cd build && (cmake3 .. || cmake ..) && $(MAKE)
moses:
git clone https://github.com/moses-smt/mosesdecoder.git moses
clean:
rm -fr kaldi_github kaldi kaldi_python venv nkf kaldi-io-for-python ../src/utils/kaldi_io_py.py warp-ctc chainer_ctc sentencepiece moses
rm -f miniconda.sh
find . -iname "*.pyc" -delete
clean_python:
rm -fr venv warp-ctc chainer_ctc
rm -f miniconda.sh
find . -iname "*.pyc" -delete