mfa and kaldi deps install

pull/696/head
Hui Zhang 4 years ago
parent 43b52082c3
commit ccfecd17b2

@ -0,0 +1,15 @@
set -e
set -x
# gcc
apt update -y
apt install build-essential -y
apt install software-properties-common -y
add-apt-repository ppa:ubuntu-toolchain-r/test
apt install gcc-8 g++-8 -y
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 80
update-alternatives --config gcc
# gfortran
apt-get install gfortran-8

@ -0,0 +1,34 @@
#!/bin/bash
# Installation script for Kaldi
#
set -e
apt-get install subversion -y
KALDI_GIT="--depth 1 -b master https://github.com/kaldi-asr/kaldi.git"
KALDI_DIR="$PWD/kaldi"
if [ ! -d "$KALDI_DIR" ]; then
git clone $KALDI_GIT $KALDI_DIR
else
echo "$KALDI_DIR already exists!"
fi
cd "$KALDI_DIR/tools"
git pull
# Prevent kaldi from switching default python version
mkdir -p "python"
touch "python/.use_default_python"
./extras/check_dependencies.sh
make -j4
cd ../src
./configure --shared --use-cuda=no --static-math
make clean -j && make depend -j && make -j4
echo "Done installing Kaldi."

@ -0,0 +1,39 @@
#!/usr/bin/env bash
OPENBLAS_VERSION=0.3.13
WGET=${WGET:-wget}
set -e
if ! command -v gfortran 2>/dev/null; then
echo "$0: gfortran is not installed. Please install it, e.g. by:"
echo " apt-get install gfortran"
echo "(if on Debian or Ubuntu), or:"
echo " yum install gcc-gfortran"
echo "(if on RedHat/CentOS). On a Mac, if brew is installed, it's:"
echo " brew install gfortran"
exit 1
fi
tarball=OpenBLAS-$OPENBLAS_VERSION.tar.gz
rm -rf xianyi-OpenBLAS-* OpenBLAS OpenBLAS-*.tar.gz
if [ -d "$DOWNLOAD_DIR" ]; then
cp -p "$DOWNLOAD_DIR/$tarball" .
else
url=$($WGET -qO- "https://api.github.com/repos/xianyi/OpenBLAS/releases/tags/v${OPENBLAS_VERSION}" | python -c 'import sys,json;print(json.load(sys.stdin)["tarball_url"])')
test -n "$url"
$WGET -t3 -nv -O $tarball "$url"
fi
tar xzf $tarball
mv xianyi-OpenBLAS-* OpenBLAS
make PREFIX=$(pwd)/OpenBLAS/install USE_LOCKING=1 USE_THREAD=0 -C OpenBLAS all install
if [ $? -eq 0 ]; then
echo "OpenBLAS is installed successfully."
rm $tarball
fi

@ -0,0 +1,17 @@
set -e
set -x
# need support c++17, so need gcc >= 8
# openfst
ngram=ngram-1.3.13
shared=true
test -e ${ngram}.tar.gz || wget http://www.openfst.org/twiki/pub/GRM/NGramDownload/${ngram}.tar.gz
test -d ${ngram} || tar -xvf ${ngram}.tar.gz && chown -R root:root ${ngram}
if [ $shared == true ];then
pushd ${ngram} && ./configure --enable-shared && popd
else
pushd ${ngram} && ./configure --enable-static && popd
fi
pushd ${ngram} && make -j && make install && popd

@ -0,0 +1,21 @@
set -e
set -x
# need support c++17, so need gcc >= 8
# openfst
openfst=openfst-1.8.1
shared=true
test -e ${openfst}.tar.gz || wget http://www.openfst.org/twiki/pub/FST/FstDownload/${openfst}.tar.gz
test -d ${openfst} || tar -xvf ${openfst}.tar.gz && chown -R root:root ${openfst}
wfst_so_path=$(python3 -c 'import sysconfig; import os; from pathlib import Path; site = sysconfig.get_paths()["purelib"]; site=Path(site); suffix = ("/usr/local/lib",) + site.parts[-2:]; print(os.path.join(*suffix));')
if [ $shared == true ];then
pushd ${openfst} && ./configure --enable-shared --enable-compact-fsts --enable-compress --enable-const-fsts --enable-far --enable-linear-fsts --enable-lookahead-fsts --enable-mpdt --enable-ngram-fsts --enable-pdt --enable-python --enable-special --enable-bin --enable-grm --prefix ${PWD}/output && popd
else
pushd ${openfst} && ./configure --enable-static --enable-compact-fsts --enable-compress --enable-const-fsts --enable-far --enable-linear-fsts --enable-lookahead-fsts --enable-mpdt --enable-ngram-fsts --enable-pdt --enable-python --enable-special --enable-bin --enable-grm --prefix ${PWD}/output && popd
fi
pushd ${openfst} && make -j && make install && popd
cp ${wfst_so_path}/pywrapfst.* $(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')

@ -0,0 +1,13 @@
set -e
set -x
pynini=pynini-2.1.4
test -e ${pynini}.tar.gz || wget http://www.openfst.org/twiki/pub/GRM/PyniniDownload/${pynini}.tar.gz
test -d ${pynini} || tar -xvf ${pynini}.tar.gz && chown -R root:root ${pynini}
#wfst_so_path=$(python3 -c 'import sysconfig; import os; from pathlib import Path; site = sysconfig.get_paths()["purelib"]; site=Path(site); suffix = ("/usr/local/lib",) + site.parts[-2:]; print(os.path.join(*suffix));')
pushd ${pynini} && python setup.py install && popd
#cp ${wfst_so_path}/pywrapfst.* $(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')
Loading…
Cancel
Save