机器学习 / 语音识别 · 2023年7月31日

KALDI安装

**注意:编译时尽量采用低版本的GCC与G++去编译,因为嵌入式的交叉编译器一般版本不会太高,也避免一个不必要的错误 **

安装依赖:

sudo apt-get install libatlas* , wget, git, svn, awk, perl,sox, subversion

硬件信息:

CPU:
    Architecture:                    x86_64
    CPU op-mode(s):                  32-bit, 64-bit
    Byte Order:                      Little Endian
    Address sizes:                   46 bits physical, 48 bits virtual
    CPU(s):                          48
    On-line CPU(s) list:             0-47
RAM:
 	MemTotal:       98849356 kB
    MemFree:         1985980 kB
    MemAvailable:   94600448 kB
    Buffers:          596200 kB
    Cached:         89925100 kB
    SwapCached:          452 kB
    Active:         20818128 kB
System:
	Linux version 5.13.0-41-generic (buildd@lcy02-amd64-017) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 
1.从github下载最新的kaldi
 https://github.com/kaldi-asr/kaldi.git
2. cat INSTALL

这里面详细介绍了如何安装,里面详细介绍了先需要安装一些工具跟依赖,故需要先进入到tools目录下
在tools目录下
执行cat INSTALL,会看到
extras/check_dependencies.sh
make
这个过程会有点长。。。。。。。。。。。。。。

如果安装过程中出现stdin error或者 github下载错误,则打开Makefile 找到对应的github地址,下载相
应的版本,放到tools目录下,再进行编译。

make[3]: Leaving directory '/data/zsf/Zsf_WorkSpace/Kaldi_WorkSpace/kaldi/tools/openfst-1.7.2'
make[2]: Leaving directory '/data/zsf/Zsf_WorkSpace/Kaldi_WorkSpace/kaldi/tools/openfst-1.7.2'
make[1]: Leaving directory '/data/zsf/Zsf_WorkSpace/Kaldi_WorkSpace/kaldi/tools/openfst-1.7.2'
rm -f openfst
ln -s openfst-1.7.2 openfst
-e 


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

出现上面的打印,则显示已经正确安装tools
3.安装src
cd src目录,
cat INSTALL,里面详细介绍了安装流程 configure --shared
make depend -j 8
make -j 8

当出现如下提示,说明已经编译安装结束:
    orkSpace/kaldi/tools/openfst-1.7.2/lib/libfst.so -L/opt/intel/mkl/lib/intel64 -Wl,-rpath=/opt/intel/mkl/lib/intel64 -l:libmkl_intel_lp64.so -l:libmkl_core.so -l:libmkl_sequential.so -ldl -lpthread -lm -lm -lpthread -ldl -lcuda -lcublas -lcusparse -lcusolver -lcudart -lcurand -lcufft -lnvToolsExt -lcusolver -o lattice-add-nnlmscorec++ -Wl,-rpath=/data/zsf/Zsf_WorkSpace/Kaldi_WorkSpace/kaldi/tools/openfst-1.7.2/lib -rdynamic  -L/usr/local/cuda/lib64/stubs -L/usr/local/cuda/lib64 -Wl,-rpath,/usr/local/
cuda/lib64 -L/usr/local/cuda/lib/stubs -L/usr/local/cuda/lib -Wl,-rpath,/usr/local/cuda/lib -Wl,-rpath=/data/zsf/Zsf_WorkSpace/Kaldi_WorkSpace/kaldi/src/lib  lattice-path-cover.o   ../rnnlm/libkaldi-rnnlm.so  ../nnet3/libkaldi-nnet3.so  ../cudamatrix/libkaldi-cudamatrix.so  ../lat/libkaldi-lat.so  ../lm/libkaldi-lm.so  ../fstext/libkaldi-fstext.so  ../hmm/libkaldi-hmm.so  ../tree/libkaldi-tree.so  ../util/libkaldi-util.so  ../matrix/libkaldi-matrix.so  ../base/libkaldi-base.so /data/zsf/Zsf_WorkSpace/Kaldi_WorkSpace/kaldi/tools/openfst-1.7.2/lib/libfst.so -L/opt/intel/mkl/lib/intel64 -Wl,-rpath=/opt/intel/mkl/lib/intel64 -l:libmkl_intel_lp64.so -l:libmkl_core.so -l:libmkl_sequential.so -ldl -lpthread -lm -lm -lpthread -ldl -lcuda -lcublas -lcusparse -lcusolver -lcudart -lcurand -lcufft -lnvToolsExt -lcusolver -o lattice-path-covermake[1]: Leaving directory '/data/zsf/Zsf_WorkSpace/Kaldi_WorkSpace/kaldi/src/latbin'
Done
4.测试kaldi安装成功与否
cd kaldi/egs/yesno/s5
./run.sh
提示如下:
local/score.sh: scoring with word insertion penalty=0.0,0.5,1.0
%WER 0.00 [ 0 / 232, 0 ins, 0 del, 0 sub ] exp/mono0a/decode_test_yesno/wer_10_0.0
则说明安装成功
打赏作者