############ kaldi安装:
通用的安装参考
http://jrmeyer.github.io/asr/2016/01/26/Installing-Kaldi.html
需要python3.7.4
conda create -n kaldi python=3.7.4
conda activate kaldi
brew install automake sox
MKL安装:
官网下载,注册学生,
https://registrationcenter-download.intel.com/akdlm/irc_nas/tec/17172/m_mkl_2020.4.301.dmg
然后去邮箱里链接下载
MKL就安装成功了
git clone https://github.com/kaldi-asr/kaldi
git branch -a
git checkout -b 5.4 remotes/origin/5.4
cd kaldi/tools
./extras/check_dependencies.sh
OK之后
其中Makefile 中的
tar --exclude '*NONE*html' -xmaf sctk-$(SCTK_GITHASH).tar.gz
去掉参数a
改成 tar --exclude '*NONE*html' -xmf sctk-$(SCTK_GITHASH).tar.gz
make
不要 make -j8
Warning: IRSTLM is not installed by default anymore. If you need IRSTLM
Warning: use the script extras/install_irstlm.sh
All done OK.
继续再tools中
./extras/install_irstlm.sh
.././install-sh -c -d '/Users/haoning02/Desktop/iosapp/kaldi/tools/irstlm/include'
/usr/bin/install -c -m 644 cmd.h thpool.h dictionary.h gzfilebuf.h htable.h index.h lmContainer.h lmclass.h lmmacro.h lmtable.h lmInterpolation.h mempool.h mfstream.h n_gram.h ngramcache.h ngramtable.h timer.h util.h crc.h interplm.h linearlm.h mdiadapt.h mixture.h normcache.h shiftlm.h cplsa.h cswam.h doc.h '/Users/haoning02/Desktop/iosapp/kaldi/tools/irstlm/include'
Making install in scripts
make[2]: Nothing to be done for `install-exec-am'.
.././install-sh -c -d '/Users/haoning02/Desktop/iosapp/kaldi/tools/irstlm/bin'
/usr/bin/install -c add-start-end.sh build-lm-qsub.sh build-lm.sh rm-start-end.sh split-ngt.sh mdtsel.sh build-sublm.pl goograms2ngrams.pl lm-stat.pl merge-sublm.pl ngram-split.pl sort-lm.pl split-dict.pl plsa.sh '/Users/haoning02/Desktop/iosapp/kaldi/tools/irstlm/bin'
Making install in doc
make[2]: Nothing to be done for `install-exec-am'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make install-exec-hook
cd /Users/haoning02/Desktop/iosapp/kaldi/tools/irstlm/ && \
ln -s -n -f lib lib64
make[2]: Nothing to be done for `install-data-am'.
***() Installation of IRSTLM finished successfully
***() Please source the tools/env.sh in your path.sh to enable it
在tools下
cd ../src
./configure
make depend
make
########### 基本例子:
cd kaldi/egs/yesno/s5
wget http://www.openslr.org/resources/1/waves_yesno.tar.gz
tar xvf waves_yesno.tar.gz
./run.sh
#################error: 在5.4版本,kaldi/tools 下make报错
shorten_x.c:325:22: error: implicit declaration of function 'pcm2alaw' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
*writebufp++ = pcm2alaw( ulaw2pcm[data0[i]] );
是sph2pipe_v2.5 的问题
用这个补丁:
https://github.com/kaldi-asr/kaldi/pull/4285/files
sph2pipe.c加#include <unistd.h>
ulaw.h 加
uchar pcm2ulaw( short int sample );
uchar pcm2alaw( short int pcmval );
##########error:在5.4版本,kaldi/tools 下make报错 , sctk-2.4.10 报错
align.c:933:15: error: implicit declaration of function 'getpid' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
int pid = getpid();
需要把Makefile中的sctk每次强制解压注释掉
.PHONY: sctk
sctk: sctk-2.4.10-20151007-1312Z.tar.bz2
# tar xojf sctk-2.4.10-20151007-1312Z.tar.bz2 || \
# tar --exclude '*NONE*html' -xvojf sctk-2.4.10-20151007-1312Z.tar.bz2
rm -rf sctk && ln -s sctk-2.4.10 sctk
再修改:
./sctk-2.4.10/src/sclite/align.c
加
#include <unistd.h>
pid_t getpid(void);
pid_t getppid(void)
#########
sclite.c:579:15: error: implicit declaration of function 'TEXT_set_lang_prof' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (!TEXT_set_lang_prof(argv[opt+1]))
在 ./sctk-2.4.10/src/sclite/sctk.h
加
#include <unistd.h>
int TEXT_set_lang_prof(char *);
sctkUnit.c:1156:6: error: implicit declaration of function 'TEXT_set_lang_prof' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
TEXT_set_lang_prof("babel_turkish");
./sctk-2.4.10/src/sclite/sctkUnit.c
加
#include <unistd.h>
int TEXT_set_lang_prof(char *);
##############
Showing All Messages
Undefined symbol: void kaldi::OnlineSilenceWeighting::ComputeCurrentTraceback<fst::Fst<fst::ArcTpl<fst::TropicalWeightTpl<float> > > >(kaldi::LatticeFasterOnlineDecoderTpl<fst::Fst<fst::ArcTpl<fst::TropicalWeightTpl<float> > > > const&)
Showing All Messages
Undefined symbol: void kaldi::OnlineSilenceWeighting::ComputeCurrentTraceback<fst::Fst<fst::ArcTpl<fst::TropicalWeightTpl<float> > > >(kaldi::LatticeFasterOnlineDecoderTpl<fst::Fst<fst::ArcTpl<fst::TropicalWeightTpl<float> > > > const&)
Showing All Messages
Undefined symbol: kaldi::SingleUtteranceNnet3DecoderTpl<fst::Fst<fst::ArcTpl<fst::TropicalWeightTpl<float> > > >::GetBestPath(bool, fst::VectorFst<fst::ArcTpl<fst::LatticeWeightTpl<float> >, fst::VectorState<fst::ArcTpl<fst::LatticeWeightTpl<float> >, std::__1::allocator<fst::ArcTpl<fst::LatticeWeightTpl<float> > > > >*) const
git checkout -b 5.4 remotes/origin/5.4
这个版本不行,编译完的kaldi-ios.a缺少
OnlineSilenceWeighting
SingleUtteranceNnet3DecoderTpl
grep -nR SingleUtteranceNnet3DecoderTpl *
git checkout -b new-slurm.pl remotes/origin/kkm/new-slurm.pl
但是这个没有
Showing All Messages
Undefined symbol: kaldi::g_program_name
Showing All Messages
Undefined symbol: void kaldi::OnlineSilenceWeighting::ComputeCurrentTraceback<fst::Fst<fst::ArcTpl<fst::TropicalWeightTpl<float> > > >(kaldi::LatticeFasterOnlineDecoderTpl<fst::Fst<fst::ArcTpl<fst::TropicalWeightTpl<float> > > > const&)
Showing All Messages
Undefined symbol: kaldi::FatalMessageLogger::FatalMessageLogger(kaldi::LogMessageEnvelope::Severity, char const*, char const*, int)
所以既要有FatalMessageLogger 又要有 SingleUtteranceNnet3DecoderTpl 的branch还要继续找
###########
精简版:
python3.7.4
git clone https://github.com/kaldi-asr/kaldi
git branch -a
git checkout -b new-slurm.pl remotes/origin/kkm/new-slurm.pl
cd kaldi/tools
./extras/check_dependencies.sh
make
解决各种不兼容问题,implicit declaration of function ,基本都是引入 #include <unistd.h> 加缺的声明就好了
./extras/install_irstlm.sh
cd ../src
./configure
make depend
如果本地运行用make
如果编译成ios的库用build-kaldi-ios.sh
这个脚本里面有make ,会编译成ios能用的kaldi-ios.a
分享到:
相关推荐
基于kaldi的语音识别小系统搭建以及kaldi的全部资料
kaldi 源码,音频识别,声纹识别等的相关工具源码
kaldi资料合集,内含kaldi的安装,使用和kaldi主页上的翻译
利用从网上下载的kaldi源码和语音数据,训练好的支持自由说的模型,是模型,模型,模型!...不是源码,也不是其他的语音资源文件,需要的朋友可以下载下来,结合kaldi中eg5/aishell/s5的例子使用!
Kaldi 语音识别基础教程-01.pdf
kaldi的voxforge示例在线语音识别Demo,用于kaldi在线语音识别的学习。
kaldi2 ASR
kaldi入门资料整理,非常全面,资源是下载别人的,用来参考
一个适合kaldi初学者看的文档,介绍了kaldi的安装以及使用的一些基本知识!
资源里面有两个文件夹,一个是构建Kaldi语音识别工具箱非常重要的openfst,版本为1.6.7,将名称为openfst-1.6.7的文件拷贝到tools文件夹下。另一个文件是最后测试工具是否安装成功的音频,可以拷贝到Kaldi的egs->yes...
Kaldi 和语音识别
2016年出版的kaldi语音识别教程,作者为日本人 篠崎隆宏 (東京工業大学)
语音识别系统之kaldi安装。里面有具体步骤,欢迎下载。
Kaldi 学习03.pdf
pytorch-kaldi核心代码注释 源码来自于https://github.com/mravanelli/pytorch-kaldi 论文地址https://arxiv.org/pdf/1811.07453.pdf
语音识别工具kaldi及其应用,kaidi全部资料,适合新手使用
kaldi安装包的最新版本,解压后可直接使用 kaldi各文件解释 /egs:不同语料例子的执行脚本文件 /tools:存放asr过程中用到的库 /src:存放实际执行的c++算法
github上面的最新kaldi源码下载,主要运行在kaldi平台,实现语音识别系统的搭建等等。
Kaldi 学习-02.pdf