diff --git a/tools/install/install_gcc.sh b/tools/install/install_gcc.sh new file mode 100755 index 0000000000000000000000000000000000000000..6eda8ea71fb52352ab2e10d0c30b6dab60ead07f --- /dev/null +++ b/tools/install/install_gcc.sh @@ -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 diff --git a/tools/install/install_kaldi.sh b/tools/install/install_kaldi.sh new file mode 100755 index 0000000000000000000000000000000000000000..545fbe4ee95eb15f6a5ef19c454f4854f7073c81 --- /dev/null +++ b/tools/install/install_kaldi.sh @@ -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." diff --git a/tools/install/install_openblas.sh b/tools/install/install_openblas.sh new file mode 100755 index 0000000000000000000000000000000000000000..b1e4d3da8de7aab3a6b02f8c729c18805c1bec04 --- /dev/null +++ b/tools/install/install_openblas.sh @@ -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 diff --git a/tools/install/ngram.sh b/tools/install/ngram.sh new file mode 100755 index 0000000000000000000000000000000000000000..304bb93d0d14ba04f4c967568f3a62bbb9b78ac1 --- /dev/null +++ b/tools/install/ngram.sh @@ -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 diff --git a/tools/install/openfst.sh b/tools/install/openfst.sh new file mode 100755 index 0000000000000000000000000000000000000000..8c6a457482b5174064b5c6fab2410b83bbb49552 --- /dev/null +++ b/tools/install/openfst.sh @@ -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"])') diff --git a/tools/install/pynini.sh b/tools/install/pynini.sh new file mode 100755 index 0000000000000000000000000000000000000000..a6f86f5502bffa4f1f4d9254326e082f0a6a3c63 --- /dev/null +++ b/tools/install/pynini.sh @@ -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"])')