Environment
Rule number 1 - use Linux. Although it is possible to use Kaldi on Windows, most people I find trustworthy convinced me that Linux will do the job with the less amount of problems. I have chosen Ubuntu 14.10. This was (in 2014/15) a rich and stable Linux representation which I honestly recommend. When you finally have your Linux running properly, please open a terminal and install some necessary stuff (if you do not already have it):
(has to be installed)
atlas
– automation and optimization of calculations in the field of linear algebra,autoconf
– automatic software compilation on different operating systems,automake
– creating portable Makefile files,git
– distributed revision control system,libtool
– creating static and dynamic libraries,svn
– revision control system (Subversion), necessary for Kaldi download and installation,wget
– data transfer using HTTP, HTTPS and FTP protocols,zlib
– data compression,
安装指令: sudo apt-get install autoconf
(probably has to be installed)
awk
– programming language, used for searching and processing patterns in files and data streams,bash
– Unix shell and script programming language,grep
– command-line utility for searching plain-text data sets for lines matching a regular expression,make
– automatically builds executable programs and libraries from source code,perl
– dynamic programming language, perfect for text files processing.
遇到的问题:
- Unable to locate package atlas
- Unable to locate package zlib
- Package 'svn' has no installation candidate
- Package 'awk' has no installation candidate
解决方案:
- Unable to locate xxx:
2 zlib官方网站:http://www.zlib.net 上下载源码来安装zlib软件包。
解压下载的包:
$tar -xvzf zlib-1.2.11.tar.gz
到下载的包里进行编译:
$cd zlib-1.2.11.tar.gz
$./configure
$make
$sudo make install
3 atlas
Try to add the repositories with
sudo add-apt-repository universe
sudo add-apt-repository main
sudo apt-get update
And then install needed packages with
sudo apt-get install libatlas-base-dev liblapack-dev libblas-dev
4 zlib: sudo apt-get install zlib1g
Download Kaldi
Just follow the instruction carefully: Downloading and installing Kaldi. If you do not have much idea about how to use GIT, please read about it: Kaldi Tutorial: Version control with Git (5 minutes).
I installed Kaldi in this directory (called 'Kaldi root path'): /home/{user}/kaldi-trunk
git clone https://github.com/kaldi-asr/kaldi.git kaldi --origin upstream
cd kaldi
If you want to get updates and bug fixes you can go to some checked-out directory, and type
git pull
cd kaldi 之后分别在 /tools 和 /src 文件夹下输入: cat INSTALL 查看安装说明,根据说明安装
首先安装依赖包。在./tool目录下检查依赖包,检查完成后输入make,开始编译,输入make -j 8命令可以加快速度(多核并行处理)。
之后切换到./src目录下,输入./configure进行配置,然后输入make depend,完成之后输入make进行编译。当然这个过程也可以并行处理加速,输入make -j 8。经过漫长的编译过程以后,就安装完毕了
如果要重新编译,输入make clean, make depend, make
出现的问题:
原因:安装anaconda之后,很多默认的编译器都变成了anaconda自带的了,比如python和gcc等,导致无法使用原编译器。
参考:https://blog.csdn.net/Zafir_410/article/details/74357544
文中提出了两种解决方案,由于编译过程不使用cmake,故使用第二种方案:
第一种方法:
cmake 后增加
-D WITH_OPENMP=ON
第二种方法:
从系统变量中删除Anaconda路径
sudo gedit ~/.bashrc
考虑到anaconda之后还会使用,在PATH中注释掉anaconda/bin的路径即可
立即生效:
source ~/.bashrc
此时编译大概需要半小时以上。
安装Kaldi时,编译器使用的是anaconda下的编译器,不是系统自带的编译器,所以报错:
解决方法:
1.卸掉anaconda,参考有些人安装opencv的经验
2.在另一台没有anaconda的电脑上安装
我用的是解决方法2,成功!