diff --git a/.travis/unittest.sh b/.travis/unittest.sh index 2eb57477..542f64d3 100755 --- a/.travis/unittest.sh +++ b/.travis/unittest.sh @@ -9,7 +9,7 @@ abort(){ unittest(){ cd $1 > /dev/null if [ -f "setup.sh" ]; then - sh setup.sh + bash setup.sh export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH fi if [ $? != 0 ]; then diff --git a/README.md b/README.md index 98d52389..f5a5c5fb 100644 --- a/README.md +++ b/README.md @@ -18,30 +18,16 @@ * python>=3.7 * paddlepaddle>=2.0.0 -- Run the setup script for the remaining dependencies - -```bash -git clone https://github.com/PaddlePaddle/DeepSpeech.git -cd DeepSpeech -pushd tools; make; popd -source tools/venv/bin/activate -bash setup.sh -``` - -- Source venv before do experiment. - -```bash -source tools/venv/bin/activate -``` +Please see [install](docs/install.md). ## Getting Started -Please see [Getting Started](docs/geting_started.md) and [tiny egs](examples/tiny/README.md). +Please see [Getting Started](docs/getting_started.md) and [tiny egs](examples/tiny/README.md). ## More Information * [Install](docs/install.md) -* [Getting Started](docs/geting_stared.md) +* [Getting Started](docs/getting_started.md) * [Data Prepration](docs/data_preparation.md) * [Data Augmentation](docs/augmentation.md) * [Ngram LM](docs/ngram_lm.md) diff --git a/README_cn.md b/README_cn.md index 713e16eb..8a2544e4 100644 --- a/README_cn.md +++ b/README_cn.md @@ -14,33 +14,20 @@ * [Baidu's Deep Speech2](http://proceedings.mlr.press/v48/amodei16.pdf) ## 安装 + * python>=3.7 * paddlepaddle>=2.0.0 -- 安装依赖 - -```bash -git clone https://github.com/PaddlePaddle/DeepSpeech.git -cd DeepSpeech -pushd tools; make; popd -source tools/venv/bin/activate -bash setup.sh -``` - -- 开始实验前要source环境. - -```bash -source tools/venv/bin/activate -``` +参看 [安装](docs/install.md)。 ## 开始 -请查看 [Getting Started](docs/geting_started.md) 和 [tiny egs](examples/tiny/README.md)。 +请查看 [Getting Started](docs/getting_started.md) 和 [tiny egs](examples/tiny/README.md)。 ## 更多信息 * [安装](docs/install.md) -* [开始](docs/geting_stared.md) +* [开始](docs/getting_started.md) * [数据处理](docs/data_preparation.md) * [数据增强](docs/augmentation.md) * [语言模型](docs/ngram_lm.md) diff --git a/docs/geting_started.md b/docs/getting_started.md similarity index 100% rename from docs/geting_started.md rename to docs/getting_started.md diff --git a/docs/ngram_lm.md b/docs/ngram_lm.md index 48c557ce..a12e6bc5 100644 --- a/docs/ngram_lm.md +++ b/docs/ngram_lm.md @@ -1,6 +1,8 @@ # Prepare Language Model -A language model is required to improve the decoder's performance. We have prepared two language models (with lossy compression) for users to download and try. One is for English and the other is for Mandarin. Users can simply run this to download the preprared language models: +A language model is required to improve the decoder's performance. We have prepared two language models (with lossy compression) for users to download and try. One is for English and the other is for Mandarin. The bash script to download LM is example's `local/download_lm_*.sh`. + +For example, users can simply run this to download the preprared mandarin language models: ```bash cd examples/aishell @@ -8,7 +10,9 @@ source path.sh bash local/download_lm_ch.sh ``` -If you wish to train your own better language model, please refer to [KenLM](https://github.com/kpu/kenlm) for tutorials. Here we provide some tips to show how we preparing our English and Mandarin language models. You can take it as a reference when you train your own. +If you wish to train your own better language model, please refer to [KenLM](https://github.com/kpu/kenlm) for tutorials. +Here we provide some tips to show how we preparing our English and Mandarin language models. +You can take it as a reference when you train your own. ## English LM diff --git a/setup.sh b/setup.sh index e2c38af7..d0f37f90 100644 --- a/setup.sh +++ b/setup.sh @@ -1,12 +1,18 @@ #! /usr/bin/env bash +source utils/log.sh + + SUDO='sudo' if [ $(id -u) -eq 0 ]; then SUDO='' fi -if [ -e /etc/lsb-release ];then +if [ -e /etc/lsb-release ]; then ${SUDO} apt-get install -y pkg-config libflac-dev libogg-dev libvorbis-dev libboost-dev swig python3-dev +else + error_msg "Please using Ubuntu or install `pkg-config libflac-dev libogg-dev libvorbis-dev libboost-dev swig python3-dev` by user." + exit -1 fi # install python dependencies @@ -14,17 +20,17 @@ if [ -f "requirements.txt" ]; then pip3 install -r requirements.txt fi if [ $? != 0 ]; then - echo "Install python dependencies failed !!!" + error_msg "Install python dependencies failed !!!" exit 1 fi # install package libsndfile python3 -c "import soundfile" if [ $? != 0 ]; then - echo "Install package libsndfile into default system path." + info_msg "Install package libsndfile into default system path." wget "http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28.tar.gz" if [ $? != 0 ]; then - echo "Download libsndfile-1.0.28.tar.gz failed !!!" + error_msg "Download libsndfile-1.0.28.tar.gz failed !!!" exit 1 fi tar -zxvf libsndfile-1.0.28.tar.gz @@ -42,6 +48,10 @@ if [ $? != 0 ]; then sh setup.sh cd - > /dev/null fi +python3 -c "import pkg_resources; pkg_resources.require(\"swig_decoders==1.1\")" +if [ $? != 0 ]; then + error_msg "Please check why decoder install error!" + exit -1 +fi - -echo "Install all dependencies successfully." +info_msg "Install all dependencies successfully." diff --git a/utils/log.sh b/utils/log.sh new file mode 100644 index 00000000..84591b07 --- /dev/null +++ b/utils/log.sh @@ -0,0 +1,11 @@ +_HDR_FMT="%.23s %s[%s]: " +_ERR_MSG_FMT="ERROR: ${_HDR_FMT}%s\n" +_INFO_MSG_FMT="INFO: ${_HDR_FMT}%s\n" + +error_msg() { + printf "$_ERR_MSG_FMT" $(date +%F.%T.%N) ${BASH_SOURCE[1]##*/} ${BASH_LINENO[0]} "${@}" +} + +info_msg() { + printf "$_INFO_MSG_FMT" $(date +%F.%T.%N) ${BASH_SOURCE[1]##*/} ${BASH_LINENO[0]} "${@}" +}