Skip to content

Commit

Permalink
fix doc link and enhance install (#570)
Browse files Browse the repository at this point in the history
* fix doc link

* fix install

* fix install doc

* fix typo

* fix lm doc
  • Loading branch information
zh794390558 committed Mar 23, 2021
1 parent e0a87a5 commit d4e84f9
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .travis/unittest.sh
Expand Up @@ -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
Expand Down
20 changes: 3 additions & 17 deletions README.md
Expand Up @@ -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)
Expand Down
21 changes: 4 additions & 17 deletions README_cn.md
Expand Up @@ -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)
Expand Down
File renamed without changes.
8 changes: 6 additions & 2 deletions docs/ngram_lm.md
@@ -1,14 +1,18 @@
# 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
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

Expand Down
22 changes: 16 additions & 6 deletions setup.sh
@@ -1,30 +1,36 @@
#! /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
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
Expand All @@ -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."
11 changes: 11 additions & 0 deletions 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]} "${@}"
}

0 comments on commit d4e84f9

Please sign in to comment.