欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

kaldi安装

程序员文章站 2022-05-27 19:57:43
...

本文讲述kaldi安装流程和安装过程中的异常信息以及处理方法,最后测试是否安装成功。安装过程参考 kaldi文档: http://kaldi-asr.org/doc/tutorial_setup.html

1. 环境准备

Ubuntu(虚拟机安装,没有GPU,额,经费不足,当然也就不用麻烦安装cuda了)
1)安装 ATLAS

sudo apt-get install libatlas*

2)确认安装以下包:wget, git, svn, awk, perl

dpkg -l|grep wget
dpkg -l|grep git
dpkg -l|grep svn
dpkg -l|grep awk
dpkg -l|grep perl

根据输出信息,如果没有安装用"apt-get install"安装

2. 下载Kaldi

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

3. tool 编译

1)进入下载后的文件目录

cd kaldi/tools/

2)运行编译指令

make

下面为可能遇到的异常以及处理方法,如果没有异常跳过此部分阅读

下面为可能遇到的异常以及处理方法(如果没有异常跳过此部分阅读)

异常1: sox subversion

我这里缺少sox subversion
解决方法:

sudo apt-get install sox subversion

异常2: requires compiler and library support for the ISO C++ 2011 standard.

提示如下

/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support
makefile:60: recipe for target ‘recording.o’ failed
make[4]: *** [recording.o] Error 1
make[4]: Leaving directory ‘/home/wendy/kaldi/tools/sctk-20159b5/src/asclite/core’
makefile:12: recipe for target ‘all’ failed
make[3]: *** [all] Error 2
make[3]: Leaving directory ‘/home/kaldi/tools/sctk-20159b5/src/asclite’
makefile:12: recipe for target ‘all’ failed
make[2]: *** [all] Error 2
make[2]: Leaving directory ‘/home/kaldi/tools/sctk-20159b5/src’
makefile:19: recipe for target ‘all’ failed
make[1]: *** [all] Error 2
make[1]: Leaving directory ‘/home/kaldi/tools/sctk-20159b5’
Makefile:119: recipe for target ‘sctk/.compiled’ failed
make: *** [sctk/.compiled] Error 2

解决方法:

进入kaldi/tools/sctk-20159b5/src/asclite/core’ 文件夹

cd sctk-20159b5/src/asclite/core

修改Makefile文件,在CC = g++ 后面添加 -std=c++11
修改前

CC = g++

修改后

CC = g++ -std=c++11

在该目录下执行make命令

make

退回到kaldi/tools/目录,执行make

make

编译成功
提示如下:

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

4. config

进入目录如下:

cd ../src; ./configure

下面为可能遇到的异常以及处理方法(如无异常跳过此部分阅读)

异常1:MKL

Configuring MKL library directory: ***configure failed: Could not find the MKL library directory.
Please use the switch --mkl-root and/or --mkl-libdir if you have MKL installed,
or try another math library, e.g. --mathlib=OPENBLAS (Kaldi may be slower). ***

解决方法:

./configure --mathlib=ATLAS

无异常输出

5. make

make

提示成功如下:

这里是引用
make[1]: Leaving directory ‘/home/***/kaldi/src/matrix’
echo Done
Done

6. 运行第一个脚本以测试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

安装成功

相关标签: 语音识别

上一篇: kaldi安装

下一篇: sph2pipe用法