From 1ae1ead80fe45cd665654eb8c346dfc060f3017f Mon Sep 17 00:00:00 2001 From: Hui Zhang Date: Wed, 10 Nov 2021 12:18:05 +0000 Subject: [PATCH] more install scripts --- paddlespeech/s2t/exps/u2/model.py | 3 +- requirements.txt | 1 + tools/extras/install_mfa_v1.sh | 4 +++ .../{install_mfa.sh => install_mfa_v2.sh} | 0 tools/extras/install_sclite.sh | 26 ++++++++++++++ tools/extras/install_sox.sh | 6 ++++ tools/extras/install_venv.sh | 36 +++++++++++++++++++ 7 files changed, 75 insertions(+), 1 deletion(-) create mode 100755 tools/extras/install_mfa_v1.sh rename tools/extras/{install_mfa.sh => install_mfa_v2.sh} (100%) create mode 100755 tools/extras/install_sclite.sh create mode 100755 tools/extras/install_sox.sh create mode 100755 tools/extras/install_venv.sh diff --git a/paddlespeech/s2t/exps/u2/model.py b/paddlespeech/s2t/exps/u2/model.py index 32311c88..22d4238a 100644 --- a/paddlespeech/s2t/exps/u2/model.py +++ b/paddlespeech/s2t/exps/u2/model.py @@ -212,7 +212,8 @@ class U2Trainer(Trainer): msg += f" {k.split(',')[0]}: " msg += f"{v:>.8f}" if isinstance(v, float) else f"{v}" - msg += f" {k.split(',')[1]}" if len(k.split(',')) == 2 else f"" + msg += f" {k.split(',')[1]}" if len( + k.split(',')) == 2 else f"" msg += "," msg = msg[:-1] # remove the last "," if (batch_index + 1 diff --git a/requirements.txt b/requirements.txt index 08f68449..2b34d36b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -33,6 +33,7 @@ sentencepiece snakeviz soundfile~=0.10 sox +soxbindings tensorboardX textgrid timer diff --git a/tools/extras/install_mfa_v1.sh b/tools/extras/install_mfa_v1.sh new file mode 100755 index 00000000..fa5b4801 --- /dev/null +++ b/tools/extras/install_mfa_v1.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +test -d montreal-forced-aligner || wget --no-check-certificate https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/releases/download/v1.0.1/montreal-forced-aligner_linux.tar.gz +tar xvf montreal-forced-aligner_linux.tar.gz \ No newline at end of file diff --git a/tools/extras/install_mfa.sh b/tools/extras/install_mfa_v2.sh similarity index 100% rename from tools/extras/install_mfa.sh rename to tools/extras/install_mfa_v2.sh diff --git a/tools/extras/install_sclite.sh b/tools/extras/install_sclite.sh new file mode 100755 index 00000000..da89e60d --- /dev/null +++ b/tools/extras/install_sclite.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +WGET="wget --no-check-certificate" + +# SCTK official repo does not have version tags. Here's the mapping: +# # 2.4.9 = 659bc36; 2.4.10 = d914e1b; 2.4.11 = 20159b5. +SCTK_GITHASH=20159b5 +SCTK_CXFLAGS="-w -march=native" +CFLAGS="CFLAGS=${SCTK_CXFLAGS}" +CXXFLAGS="CXXFLAGS=-std=c++11 ${SCTK_CXFLAGS}" + +MAKE=make + + +${WGET} -nv -T 10 -t 3 -O sctk-${SCTK_GITHASH}.tar.gz https://github.com/usnistgov/SCTK/archive/${SCTK_GITHASH}.tar.gz; +tar zxvf sctk-${SCTK_GITHASH}.tar.gz +rm -rf sctk-${SCTK_GITHASH} sctk +mv SCTK-${SCTK_GITHASH}* sctk-${SCTK_GITHASH} +ln -s sctk-${SCTK_GITHASH} sctk +touch sctk-${SCTK_GITHASH}.tar.gz + +rm -f sctk/.compiled +CFLAGS="${SCTK_CXFLAGS}" CXXFLAGS="-std=c++11 ${SCTK_CXFLAGS}" ${MAKE} -C sctk config +CFLAGS="${SCTK_CXFLAGS}" CXXFLAGS="-std=c++11 ${SCTK_CXFLAGS}" ${MAKE} -C sctk all doc +${MAKE} -C sctk install +touch sctk/.compiled \ No newline at end of file diff --git a/tools/extras/install_sox.sh b/tools/extras/install_sox.sh new file mode 100755 index 00000000..ddb1151c --- /dev/null +++ b/tools/extras/install_sox.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +apt install -y libvorbis-dev libmp3lame-dev libmad-ocaml-dev +test -d sox-14.4.2 || wget --no-check-certificate https://nchc.dl.sourceforge.net/project/sox/sox/14.4.2/sox-14.4.2.tar.gz +tar -xvzf sox-14.4.2.tar.gz -C . +cd sox-14.4.2 && ./configure --prefix=/usr/ && make -j4 && make install \ No newline at end of file diff --git a/tools/extras/install_venv.sh b/tools/extras/install_venv.sh new file mode 100755 index 00000000..16679b79 --- /dev/null +++ b/tools/extras/install_venv.sh @@ -0,0 +1,36 @@ + +#!/bin/bash +# copy from Espnet + +set -euo pipefail + +if [ $# -eq 0 ] || [ $# -gt 2 ]; then + echo "Usage: $0 [venv-path]" + echo "e.g." + echo "$0 \$(which python3)" + exit 1; +elif [ $# -eq 2 ]; then + PYTHON="$1" + VENV="$2" +elif [ $# -eq 1 ]; then + PYTHON="$1" + VENV="venv" +fi + +if ! "${PYTHON}" -m venv --help > /dev/null 2>&1; then + echo "Error: ${PYTHON} is not Python3?" + exit 1 +fi +if [ -e activate_python.sh ]; then + echo "Warning: activate_python.sh already exists. It will be overwritten" +fi + +"${PYTHON}" -m venv ${VENV} +cat << EOF > activate_python.sh +#!/usr/bin/env bash +# THIS FILE IS GENERATED BY tools/setup_venv.sh +. $(cd ${VENV}; pwd)/bin/activate +EOF + +. ./activate_python.sh +python3 -m pip install -U pip wheel \ No newline at end of file -- GitLab