From 51439cf1f6fc5b5d687a34e397e8d4d4b5bfb9f6 Mon Sep 17 00:00:00 2001 From: Hui Zhang Date: Thu, 5 Aug 2021 07:04:30 +0000 Subject: [PATCH] fix install and format code --- deepspeech/exps/u2_st/model.py | 3 --- deepspeech/io/collator_st.py | 1 - deepspeech/models/u2_st.py | 6 ------ deepspeech/utils/bleu_score.py | 1 - examples/librispeech/s1/README.md | 4 ++-- examples/librispeech/s2/README.md | 1 - requirements.txt | 2 ++ setup.sh | 4 +++- 8 files changed, 7 insertions(+), 15 deletions(-) diff --git a/deepspeech/exps/u2_st/model.py b/deepspeech/exps/u2_st/model.py index 867d18998..f72e2bbc6 100644 --- a/deepspeech/exps/u2_st/model.py +++ b/deepspeech/exps/u2_st/model.py @@ -18,9 +18,7 @@ import sys import time from collections import defaultdict from pathlib import Path -from typing import List from typing import Optional -from typing import Tuple import numpy as np import paddle @@ -42,7 +40,6 @@ from deepspeech.training.scheduler import WarmupLR from deepspeech.training.trainer import Trainer from deepspeech.utils import bleu_score from deepspeech.utils import ctc_utils -from deepspeech.utils import error_rate from deepspeech.utils import layer_tools from deepspeech.utils import mp_tools from deepspeech.utils import text_grid diff --git a/deepspeech/io/collator_st.py b/deepspeech/io/collator_st.py index 1be6445d7..1ee361900 100644 --- a/deepspeech/io/collator_st.py +++ b/deepspeech/io/collator_st.py @@ -14,7 +14,6 @@ import io from collections import namedtuple from typing import Optional -from typing import Tuple import kaldiio import numpy as np diff --git a/deepspeech/models/u2_st.py b/deepspeech/models/u2_st.py index 5eea139b0..a73f52e99 100644 --- a/deepspeech/models/u2_st.py +++ b/deepspeech/models/u2_st.py @@ -15,9 +15,7 @@ Unified Streaming and Non-streaming Two-pass End-to-end Model for Speech Recognition (https://arxiv.org/pdf/2012.05481.pdf) """ -import sys import time -from collections import defaultdict from typing import Dict from typing import List from typing import Optional @@ -36,18 +34,14 @@ from deepspeech.modules.decoder import TransformerDecoder from deepspeech.modules.encoder import ConformerEncoder from deepspeech.modules.encoder import TransformerEncoder from deepspeech.modules.loss import LabelSmoothingLoss -from deepspeech.modules.mask import make_pad_mask from deepspeech.modules.mask import mask_finished_preds from deepspeech.modules.mask import mask_finished_scores from deepspeech.modules.mask import subsequent_mask from deepspeech.utils import checkpoint from deepspeech.utils import layer_tools -from deepspeech.utils.ctc_utils import remove_duplicates_and_blank from deepspeech.utils.log import Log from deepspeech.utils.tensor_utils import add_sos_eos -from deepspeech.utils.tensor_utils import pad_sequence from deepspeech.utils.tensor_utils import th_accuracy -from deepspeech.utils.utility import log_add __all__ = ["U2STModel", "U2STInferModel"] diff --git a/deepspeech/utils/bleu_score.py b/deepspeech/utils/bleu_score.py index f1bf5261e..09646133a 100644 --- a/deepspeech/utils/bleu_score.py +++ b/deepspeech/utils/bleu_score.py @@ -14,7 +14,6 @@ """This module provides functions to calculate bleu score in different level. e.g. wer for word-level, cer for char-level. """ -import numpy as np import sacrebleu __all__ = ['bleu', 'char_bleu'] diff --git a/examples/librispeech/s1/README.md b/examples/librispeech/s1/README.md index 88ea216e3..daa4d175b 100644 --- a/examples/librispeech/s1/README.md +++ b/examples/librispeech/s1/README.md @@ -2,7 +2,7 @@ ## Data | Data Subset | Duration in Seconds | -| --- | --- | +| --- | --- | | data/manifest.train | 0.83s ~ 29.735s | | data/manifest.dev | 1.065 ~ 35.155s | | data/manifest.test-clean | 1.285s ~ 34.955s | @@ -39,4 +39,4 @@ ### Test w/o length filter | Model | Params | Config | Augmentation| Test set | Decode method | Loss | WER | | --- | --- | --- | --- | --- | --- | --- | --- | -| transformer | 32.52 M | conf/transformer.yaml | spec_aug + shift | test-clean-all | attention | 6.98 | 0.066500 | \ No newline at end of file +| transformer | 32.52 M | conf/transformer.yaml | spec_aug + shift | test-clean-all | attention | 6.98 | 0.066500 | diff --git a/examples/librispeech/s2/README.md b/examples/librispeech/s2/README.md index 8f092dd81..e4022f014 100644 --- a/examples/librispeech/s2/README.md +++ b/examples/librispeech/s2/README.md @@ -39,4 +39,3 @@ | Model | Params | Config | Augmentation| Test set | Decode method | Loss | WER | | --- | --- | --- | --- | --- | --- | --- | --- | | transformer | 32.52 M | conf/transformer.yaml | spec_aug + shift | test-clean-all | attention | | | - diff --git a/requirements.txt b/requirements.txt index 57a951bbd..baaa9ba9b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,9 @@ coverage +gpustat pre-commit pybind11 resampy==0.2.2 +sacrebleu scipy==1.2.1 sentencepiece snakeviz diff --git a/setup.sh b/setup.sh index 503bc6b56..6e472c47d 100644 --- a/setup.sh +++ b/setup.sh @@ -9,7 +9,7 @@ if [ $(id -u) -eq 0 ]; then fi if [ -e /etc/lsb-release ];then - #${SUDO} apt-get update + ${SUDO} apt-get update -y ${SUDO} apt-get install -y jq vim tig tree sox pkg-config libflac-dev libogg-dev libvorbis-dev libboost-dev swig python3-dev if [ $? != 0 ]; then error_msg "Please using Ubuntu or install pkg-config libflac-dev libogg-dev libvorbis-dev libboost-dev swig python3-dev by user." @@ -22,6 +22,8 @@ fi rm tools/*.done pushd tools && make && popd +source tools/venv/bin/activate + # install python dependencies if [ -f "requirements.txt" ]; then pip3 install -r requirements.txt