全新mac安装kaldi

1. 安装xcode

官网下载xcode
https://developer.apple.com/download/

2.安装Xcode命令行工具

$ xcode-select --install

3.安装homebrew

命令获取网址:
https://brew.sh/

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

参考网址:

https://www.jianshu.com/p/8223a0d75879

4.zip下载kaldi

https://github.com/kaldi-asr/kaldi

5. brew install unzip

解压kaldi文件

unzip kaldi-master.zip

6. 检查依赖

cd kaldi-master/tools
extras/check_dependencies.sh

7. 按提示安装各种依赖

brew install sox
...

8. 安装Intel MKL

检查依赖的结果显示要在官网下载安装
https://software.intel.com/en-us/mkl/choose-download/macos
显示OK, 表明依赖安装完成。

extras/check_dependencies.sh 
extras/check_dependencies.sh: all OK.

查询本机处理器核心数目

$sysctl hw.physicalcpu
hw.physicalcpu: 4
$ sysctl hw.logicalcpu
hw.logicalcpu: 8

http://www.jianshu.com/p/cdf1e0d5c831

9. 编译

make -j 4
Warning: IRSTLM is not installed by default anymore. If you need IRSTLM
Warning: use the script extras/install_irstlm.sh
All done OK.

10. install cuda

官网下载安装
安装CUDA, NIDIA链接:https://developer.nvidia.com/cuda-downloads

11. src 编译前配置

cd ../src
./configure --shared
$ ./configure --shared
Configuring KALDI to use MKL.
Checking compiler g++ ...
Checking OpenFst library in /Users/dilinlin/kaldi/kaldi-master/tools/openfst-1.6.7 ...
Checking cub library in /Users/dilinlin/kaldi/kaldi-master/tools/cub-1.8.0 ...
Doing OS specific configurations ...
On Darwin: Checking for Accelerate framework ...
Configuring for OS X version 10.14 ...
Successfully configured for Darwin with Accelerate framework.
Using CUDA toolkit /usr/local/cuda (nvcc compiler and runtime libraries)
Kaldi has been successfully configured. To compile:

  make -j clean depend; make -j 

where  is the number of parallel builds you can afford to do. If unsure,
use the smaller of the number of CPUs or the amount of RAM in GB divided by 2,
to stay within safe limits. 'make -j' without the numeric value may not limit
the number of parallel jobs at all, and overwhelm even a powerful workstation,
since Kaldi build is highly parallelized.

12. 执行编译

make depend -j 4
make -j 4
.......
ranlib kaldi-fstext.a
g++ -dynamiclib -o libkaldi-fstext.dylib -install_name @rpath/libkaldi-fstext.dylib  -Wl,-rpath -Wl,/Users/dilinlin/kaldi/kaldi-master/tools/openfst-1.6.7/lib -g -Wl,-rpath -Wl,/Users/dilinlin/kaldi/kaldi-master/src/lib push-special.o kaldi-fst-io.o context-fst.o grammar-context-fst.o  ../tree/libkaldi-tree.dylib  ../util/libkaldi-util.dylib  ../matrix/libkaldi-matrix.dylib  ../base/libkaldi-base.dylib /Users/dilinlin/kaldi/kaldi-master/tools/openfst-1.6.7/lib/libfst.dylib -framework Accelerate -lm -lpthread -ldl
ln -sf /Users/dilinlin/kaldi/kaldi-master/src/fstext/libkaldi-fstext.dylib /Users/dilinlin/kaldi/kaldi-master/src/lib/libkaldi-fstext.dylib
ar -cr kaldi-hmm.a hmm-topology.o transition-model.o hmm-utils.o tree-accu.o posterior.o hmm-test-utils.o
ranlib kaldi-hmm.a
g++ -dynamiclib -o libkaldi-hmm.dylib -install_name @rpath/libkaldi-hmm.dylib  -Wl,-rpath -Wl,/Users/dilinlin/kaldi/kaldi-master/tools/openfst-1.6.7/lib -g -Wl,-rpath -Wl,/Users/dilinlin/kaldi/kaldi-master/src/lib hmm-topology.o transition-model.o hmm-utils.o tree-accu.o posterior.o hmm-test-utils.o  ../tree/libkaldi-tree.dylib  ../util/libkaldi-util.dylib  ../matrix/libkaldi-matrix.dylib  ../base/libkaldi-base.dylib /Users/dilinlin/kaldi/kaldi-master/tools/openfst-1.6.7/lib/libfst.dylib -framework Accelerate -lm -lpthread -ldl
ln -sf /Users/dilinlin/kaldi/kaldi-master/src/hmm/libkaldi-hmm.dylib /Users/dilinlin/kaldi/kaldi-master/src/lib/libkaldi-hmm.dylib

也不知道成功了没有,跑个yesno验证一下。
参考网址:

http://hacpai.com/article/1547886299887
http://blog.csdn.net/aidanmo/article/details/82778260

你可能感兴趣的:(kaldi)