1. 克隆kaldi
git clone https://github.com/kaldi-asr/kaldi
2. 检查依赖
- 进入kaldi主目录,可以查看INSTALL文件,里面记录了安装的相关指令,如下:
This is the official Kaldi INSTALL. Look also at INSTALL.md for the git mirror installation.
[Option 1 in the following does not apply to native Windows install, see windows/INSTALL or following Option 2]
Option 1 (bash + makefile):
Steps:
(1)
go to tools/ and follow INSTALL instructions there.
(2)
go to src/ and follow INSTALL instructions there.
- 根据安装指令,cd 进入 tools 目录,查看tools 目录细的INSTALL文件,如下
To check the prerequisites for Kaldi, first run
extras/check_dependencies.sh
and see if there are any system-level installations you need to do. Check the
output carefully. There are some things that will make your life a lot easier
if you fix them at this stage. If your system default C++ compiler is not
supported, you can do the check with another compiler by setting the CXX
environment variable, e.g.
CXX=g++-4.8 extras/check_dependencies.sh
Then run
make
- 运行 extras/check_dependencies.sh 检查依赖是否满足,根据提示安装组件,比如:
sudo apt-get install sox
sudo apt-get install autoconf
当运行 extras/check_dependencies.sh ,返回以下结果的时候,则说明依赖安装完毕:
extras/check_dependencies.sh
extras/check_dependencies.sh: all OK.
- ** 特别说明安装 intel MKL(也可以用openblas或者其它底层数学库代替,具体可以参考http://kaldi-asr.org/doc/matrixwrap.html ),可能下载比较慢,需要耐心等待
./extras/install_sh
-
安装cuda,链接地址https://developer.nvidia.com/cuda-downloads
选项如下:
根据Base Installer 的提示,在命令行输入以下指令;
-
wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33.01_linux.run
sudo sh cuda_10.2.89_440.33.01_linux.run
3. cuda安装一直会失败,查看log如下:
>sudo sh cuda_10.1.243_418.87.00_linux.run
Log:
/var/log/cuda-installer.log
1 [INFO]: Driver not installed.
2 [INFO]: Checking compiler version...
3 [INFO]: gcc location: /bin/gcc
4
5 [INFO]: gcc version: gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
6
7 [INFO]: Initializing menu
8 [INFO]: Setup complete
9 [INFO]: Components to install:
10 [INFO]: Driver
11 [INFO]: 418.87.00
12 [INFO]: Executing NVIDIA-Linux-x86_64-418.87.00.run --ui=none --no-questions --accept-license --disable-nouveau --no-cc-version-check --install-libglvnd 2>&1
13 [INFO]: Finished with code: 256
14 [ERROR]: Install of driver component failed.
15 [ERROR]: Install of 418.87.00 failed, quitting
4. 起初怀疑是 Disabling Nouveau 的问题,按照document的操作,发现安装仍然失败;
5. 后来试了很多方法,发现是要 stop x server(stop the display manager in order to stop the X server),解决办法如下:
1. To find out your display manager, you can try running
pgrep -l dm
2. Follow these steps for cleaning:
apt-get --purge -y remove 'cuda*'
apt-get --purge -y remove 'nvidia*'
apt autoremove -y
apt-get clean
reboot
3. Go to the CUDA download site. Click on Linux -> x86_64 -> Ubuntu -> 18.04 -> Deb (local) And follow the Installation Instructions.
- 编译kaldi,在 tools/ 目录下面输入 make -j 4
make - j 4
- 编译src目录,cd 到 src 目录,configure有许多选项,具体可以额参考document,输入以下指令:
./configure --shared
make depend -j 8
make -j 8
- 这样kaldi就安装完了,也可以不安装cuda(没有N卡的时候),这样就不能运行DNN部分;