-
Notifications
You must be signed in to change notification settings - Fork 6
/
INSTALL_KALDI
94 lines (68 loc) · 3.53 KB
/
INSTALL_KALDI
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#Install Kaldi and OpenBLAS dependencies and compile an optimized version of OpenBLAS specificall for your architecture
#It is important to build a non-multithreaded version of OpenBLAS, as race conditions and strange errors will pop while using Kaldi otherwise.
sudo apt-get install gfortran build-essential automake git zlib1g-dev libtool subversion curl vim python-pip screen
wget http://github.com/xianyi/OpenBLAS/archive/v0.2.18.tar.gz
make BINARY=64 FC=gfortran USE_THREAD=0
sudo mkdir /opt/openblas_st
sudo make PREFIX=/opt/openblas_st install
# Now build Kaldi:
cd ~
git clone https://github.com/kaldi-asr/kaldi kaldi
cd ~/kaldi/tools
make -j 8
cd ../src
./configure --shared --static-math=yes --mathlib=OPENBLAS --openblas-root=/opt/openblas_st/ --use-cuda={yes|no}
# finally build Kaldi:
make depend -j 8; make -j 8
# Dependencies for the gst-kaldi-nnet2-online plugin:
sudo apt-get install gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-pulseaudio gstreamer1.0-plugins-ugly gstreamer1.0-tools libgstreamer1.0-dev libjansson-dev
# Now install the gst-kaldi-nnet2-online plugin:
export KALDI_ROOT=~/kaldi/
cd $KALDI_ROOT/tools/
git clone https://github.com/alumae/gst-kaldi-nnet2-online
cd gst-kaldi-nnet2-online/src
make depend
make
# You can now test if the gst-kaldi-nnet2-online installation works:
GST_PLUGIN_PATH=$KALDI_ROOT/tools/gst-kaldi-nnet2-online/src gst-inspect-1.0 kaldinnet2onlinedecoder
#[...]
#Plugin Details:
# Name kaldinnet2onlinedecoder
# Description kaldinnet2onlinedecoder
# Filename /home/ambientsearch/kaldi/tools/gst-kaldi-nnet2-online/src/libgstkaldionline2.so
# Version 1.0
# License unknown
# Source module Kaldi
# Binary package GStreamer
# Origin URL http://gstreamer.net/
#[...]
# Now install ~/kaldi/tools/kaldi-gstreamer-server
cd $KALDI_ROOT/tools/
git clone https://github.com/alumae/kaldi-gstreamer-server
# Download the Tedlium nnet2 model
cd kaldi-gstreamer-server/test/models
./download-tedlium-nnet2.sh
# (You should now have the model in test/models/english/tedlium_nnet_ms_sp_online)
# Make a start script for a tedlium model worker:
echo export KALDI_ROOT=$KALDI_ROOT > run_tedlium.sh
echo export GST_PLUGIN_PATH=\$KALDI_ROOT/tools/gst-kaldi-nnet2-online/src >> run_tedlium.sh
echo python kaldigstserver/worker.py -u ws://localhost:8100/worker/ws/speech -c sample_english_nnet2.yaml >> run_tedlium.sh
chmod guo+x run_tedlium.sh
# edit sample_english_nnet2.yaml
vim sample_english_nnet2.yaml
#-> uncomment the line "big-lm-const-arpa: test/models/english/tedlium_nnet_ms_sp_online/G.carpa" to get language model rescoring (recommended)
#Install kaldi-gstreamer-server dependencies:
sudo apt-get install python-gi
sudo pip install --upgrade ws4py==0.3.2 pyyaml tornado
# Start a new screen session:
screen
python kaldigstserver/master_server.py --port=8100
CRTL-A C
# Now run the worker (You will need about 4gb of RAM per worker if you activiated the LM)
./run_tedlium.sh
# It should now load the acoustic and language model and finish with:
2016-08-02 14:39:33 - INFO: __main__: Opened websocket connection to server
# If you go back to the server, you should also see:
CRTL-A P
INFO 2016-08-02 14:39:33,061 New worker available <__main__.WorkerSocketHandler object at 0x7f2e7c087950>
# Congratulations! Your full-duplex online speech recognition server is running on port 8100! You could also run multiple workers, if you need concurrent connections.