Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
fa6e3334
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
1 年多 前同步成功
通知
207
Star
8425
Fork
1598
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
245
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DeepSpeech
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
245
Issue
245
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fa6e3334
编写于
4月 15, 2021
作者:
H
Hui Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
reorder imports
上级
708b7fd3
变更
94
隐藏空白更改
内联
并排
Showing
94 changed file
with
402 addition
and
373 deletion
+402
-373
.notebook/python_test.ipynb
.notebook/python_test.ipynb
+80
-37
.pre-commit-config.yaml
.pre-commit-config.yaml
+4
-4
deepspeech/__init__.py
deepspeech/__init__.py
+4
-4
deepspeech/decoders/decoders_deprecated.py
deepspeech/decoders/decoders_deprecated.py
+3
-3
deepspeech/decoders/scorer_deprecated.py
deepspeech/decoders/scorer_deprecated.py
+1
-1
deepspeech/decoders/swig/setup.py
deepspeech/decoders/swig/setup.py
+7
-5
deepspeech/decoders/swig_wrapper.py
deepspeech/decoders/swig_wrapper.py
+0
-1
deepspeech/decoders/tests/test_decoders.py
deepspeech/decoders/tests/test_decoders.py
+1
-1
deepspeech/exps/deepspeech2/bin/deploy/client.py
deepspeech/exps/deepspeech2/bin/deploy/client.py
+3
-2
deepspeech/exps/deepspeech2/bin/deploy/record.py
deepspeech/exps/deepspeech2/bin/deploy/record.py
+2
-1
deepspeech/exps/deepspeech2/bin/deploy/runtime.py
deepspeech/exps/deepspeech2/bin/deploy/runtime.py
+11
-13
deepspeech/exps/deepspeech2/bin/deploy/server.py
deepspeech/exps/deepspeech2/bin/deploy/server.py
+9
-10
deepspeech/exps/deepspeech2/bin/export.py
deepspeech/exps/deepspeech2/bin/export.py
+2
-3
deepspeech/exps/deepspeech2/bin/infer.py
deepspeech/exps/deepspeech2/bin/infer.py
+2
-2
deepspeech/exps/deepspeech2/bin/test.py
deepspeech/exps/deepspeech2/bin/test.py
+2
-3
deepspeech/exps/deepspeech2/bin/train.py
deepspeech/exps/deepspeech2/bin/train.py
+2
-3
deepspeech/exps/deepspeech2/bin/tune.py
deepspeech/exps/deepspeech2/bin/tune.py
+7
-9
deepspeech/exps/deepspeech2/config.py
deepspeech/exps/deepspeech2/config.py
+1
-1
deepspeech/exps/deepspeech2/model.py
deepspeech/exps/deepspeech2/model.py
+10
-14
deepspeech/exps/u2/bin/export.py
deepspeech/exps/u2/bin/export.py
+2
-4
deepspeech/exps/u2/bin/test.py
deepspeech/exps/u2/bin/test.py
+3
-3
deepspeech/exps/u2/bin/train.py
deepspeech/exps/u2/bin/train.py
+4
-5
deepspeech/exps/u2/config.py
deepspeech/exps/u2/config.py
+2
-3
deepspeech/exps/u2/model.py
deepspeech/exps/u2/model.py
+11
-15
deepspeech/frontend/audio.py
deepspeech/frontend/audio.py
+6
-6
deepspeech/frontend/augmentor/augmentation.py
deepspeech/frontend/augmentor/augmentation.py
+6
-8
deepspeech/frontend/augmentor/base.py
deepspeech/frontend/augmentor/base.py
+2
-2
deepspeech/frontend/augmentor/impulse_response.py
deepspeech/frontend/augmentor/impulse_response.py
+1
-2
deepspeech/frontend/augmentor/noise_perturb.py
deepspeech/frontend/augmentor/noise_perturb.py
+1
-2
deepspeech/frontend/augmentor/online_bayesian_normalization.py
...peech/frontend/augmentor/online_bayesian_normalization.py
+0
-1
deepspeech/frontend/augmentor/resample.py
deepspeech/frontend/augmentor/resample.py
+0
-1
deepspeech/frontend/augmentor/shift_perturb.py
deepspeech/frontend/augmentor/shift_perturb.py
+0
-1
deepspeech/frontend/augmentor/spec_augment.py
deepspeech/frontend/augmentor/spec_augment.py
+1
-1
deepspeech/frontend/augmentor/speed_perturb.py
deepspeech/frontend/augmentor/speed_perturb.py
+1
-1
deepspeech/frontend/augmentor/volume_perturb.py
deepspeech/frontend/augmentor/volume_perturb.py
+0
-1
deepspeech/frontend/featurizer/audio_featurizer.py
deepspeech/frontend/featurizer/audio_featurizer.py
+2
-3
deepspeech/frontend/featurizer/speech_featurizer.py
deepspeech/frontend/featurizer/speech_featurizer.py
+0
-1
deepspeech/frontend/featurizer/text_featurizer.py
deepspeech/frontend/featurizer/text_featurizer.py
+1
-2
deepspeech/frontend/normalizer.py
deepspeech/frontend/normalizer.py
+4
-3
deepspeech/frontend/speech.py
deepspeech/frontend/speech.py
+1
-1
deepspeech/frontend/utility.py
deepspeech/frontend/utility.py
+5
-3
deepspeech/io/__init__.py
deepspeech/io/__init__.py
+2
-3
deepspeech/io/collator.py
deepspeech/io/collator.py
+2
-3
deepspeech/io/dataset.py
deepspeech/io/dataset.py
+6
-7
deepspeech/io/sampler.py
deepspeech/io/sampler.py
+4
-4
deepspeech/io/utility.py
deepspeech/io/utility.py
+3
-2
deepspeech/models/deepspeech2.py
deepspeech/models/deepspeech2.py
+3
-4
deepspeech/models/u2.py
deepspeech/models/u2.py
+18
-19
deepspeech/modules/activation.py
deepspeech/modules/activation.py
+2
-2
deepspeech/modules/attention.py
deepspeech/modules/attention.py
+4
-2
deepspeech/modules/cmvn.py
deepspeech/modules/cmvn.py
+2
-3
deepspeech/modules/conformer_convolution.py
deepspeech/modules/conformer_convolution.py
+5
-4
deepspeech/modules/conv.py
deepspeech/modules/conv.py
+2
-4
deepspeech/modules/ctc.py
deepspeech/modules/ctc.py
+5
-8
deepspeech/modules/decoder.py
deepspeech/modules/decoder.py
+7
-5
deepspeech/modules/decoder_layer.py
deepspeech/modules/decoder_layer.py
+4
-2
deepspeech/modules/embedding.py
deepspeech/modules/embedding.py
+2
-2
deepspeech/modules/encoder.py
deepspeech/modules/encoder.py
+9
-7
deepspeech/modules/encoder_layer.py
deepspeech/modules/encoder_layer.py
+4
-2
deepspeech/modules/loss.py
deepspeech/modules/loss.py
+2
-3
deepspeech/modules/mask.py
deepspeech/modules/mask.py
+1
-2
deepspeech/modules/positionwise_feed_forward.py
deepspeech/modules/positionwise_feed_forward.py
+2
-2
deepspeech/modules/rnn.py
deepspeech/modules/rnn.py
+2
-3
deepspeech/modules/subsampling.py
deepspeech/modules/subsampling.py
+1
-2
deepspeech/training/cli.py
deepspeech/training/cli.py
+0
-1
deepspeech/training/gradclip.py
deepspeech/training/gradclip.py
+4
-5
deepspeech/training/scheduler.py
deepspeech/training/scheduler.py
+3
-3
deepspeech/training/trainer.py
deepspeech/training/trainer.py
+1
-2
deepspeech/utils/checkpoint.py
deepspeech/utils/checkpoint.py
+2
-3
deepspeech/utils/ctc_utils.py
deepspeech/utils/ctc_utils.py
+3
-3
deepspeech/utils/layer_tools.py
deepspeech/utils/layer_tools.py
+0
-2
deepspeech/utils/log.py
deepspeech/utils/log.py
+2
-3
deepspeech/utils/mp_tools.py
deepspeech/utils/mp_tools.py
+1
-1
deepspeech/utils/socket_server.py
deepspeech/utils/socket_server.py
+3
-3
deepspeech/utils/tensor_utils.py
deepspeech/utils/tensor_utils.py
+4
-2
deepspeech/utils/utility.py
deepspeech/utils/utility.py
+2
-3
examples/dataset/aishell/aishell.py
examples/dataset/aishell/aishell.py
+7
-5
examples/dataset/chime3_background/chime3_background.py
examples/dataset/chime3_background/chime3_background.py
+5
-5
examples/dataset/librispeech/librispeech.py
examples/dataset/librispeech/librispeech.py
+8
-6
examples/dataset/mini_librispeech/mini_librispeech.py
examples/dataset/mini_librispeech/mini_librispeech.py
+7
-5
examples/dataset/musan/musan.py
examples/dataset/musan/musan.py
+7
-4
examples/dataset/rir_noise/rir_noise.py
examples/dataset/rir_noise/rir_noise.py
+7
-4
examples/dataset/voxforge/voxforge.py
examples/dataset/voxforge/voxforge.py
+8
-5
tests/deepspeech2_model_test.py
tests/deepspeech2_model_test.py
+3
-2
tests/error_rate_test.py
tests/error_rate_test.py
+1
-1
tests/mask_test.py
tests/mask_test.py
+4
-3
tests/u2_model_test.py
tests/u2_model_test.py
+2
-3
utils/build_vocab.py
utils/build_vocab.py
+4
-5
utils/compute_mean_std.py
utils/compute_mean_std.py
+4
-3
utils/format_data.py
utils/format_data.py
+2
-2
utils/spm_decode
utils/spm_decode
+5
-3
utils/spm_encode
utils/spm_encode
+5
-3
utils/spm_train
utils/spm_train
+1
-1
utils/utility.py
utils/utility.py
+1
-1
未找到文件。
.notebook/python_test.ipynb
浏览文件 @
fa6e3334
...
...
@@ -637,7 +637,7 @@
{
"cell_type": "code",
"execution_count": 59,
"id": "
featured-cookbook
",
"id": "
norwegian-cleveland
",
"metadata": {},
"outputs": [
{
...
...
@@ -660,7 +660,7 @@
{
"cell_type": "code",
"execution_count": 35,
"id": "
concrete-rubber
",
"id": "
endless-kidney
",
"metadata": {},
"outputs": [
{
...
...
@@ -705,7 +705,7 @@
{
"cell_type": "code",
"execution_count": 3,
"id": "
surgical-shore
",
"id": "
later-louisiana
",
"metadata": {},
"outputs": [
{
...
...
@@ -728,7 +728,7 @@
{
"cell_type": "code",
"execution_count": 4,
"id": "
medieval-daily
",
"id": "
funded-nudist
",
"metadata": {},
"outputs": [
{
...
...
@@ -748,7 +748,7 @@
{
"cell_type": "code",
"execution_count": 5,
"id": "
derived-meeting
",
"id": "
contrary-affiliation
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -758,7 +758,7 @@
{
"cell_type": "code",
"execution_count": 6,
"id": "
hawaiian-engagement
",
"id": "
friendly-interpretation
",
"metadata": {},
"outputs": [
{
...
...
@@ -776,7 +776,7 @@
{
"cell_type": "code",
"execution_count": 7,
"id": "
moderate-greece
",
"id": "
bottom-wilderness
",
"metadata": {},
"outputs": [
{
...
...
@@ -809,7 +809,7 @@
{
"cell_type": "code",
"execution_count": 17,
"id": "
duplicate-colon
",
"id": "
acquired-jacksonville
",
"metadata": {},
"outputs": [
{
...
...
@@ -839,7 +839,7 @@
{
"cell_type": "code",
"execution_count": 18,
"id": "
actual-junior
",
"id": "
entertaining-capture
",
"metadata": {},
"outputs": [
{
...
...
@@ -871,7 +871,7 @@
{
"cell_type": "code",
"execution_count": 19,
"id": "
looking-bell
e",
"id": "
amber-grad
e",
"metadata": {},
"outputs": [
{
...
...
@@ -903,7 +903,7 @@
{
"cell_type": "code",
"execution_count": 31,
"id": "
turned-friend
",
"id": "
hidden-playback
",
"metadata": {},
"outputs": [
{
...
...
@@ -935,7 +935,7 @@
{
"cell_type": "code",
"execution_count": 32,
"id": "
wrapped-foundation
",
"id": "
twelve-university
",
"metadata": {},
"outputs": [
{
...
...
@@ -966,7 +966,7 @@
{
"cell_type": "code",
"execution_count": 20,
"id": "
applied-abuse
",
"id": "
minor-endorsement
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -977,7 +977,7 @@
{
"cell_type": "code",
"execution_count": 46,
"id": "
experimental-invasion
",
"id": "
upper-majority
",
"metadata": {},
"outputs": [
{
...
...
@@ -997,7 +997,7 @@
{
"cell_type": "code",
"execution_count": 30,
"id": "
established-lunch
",
"id": "
supreme-coverage
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -1007,7 +1007,7 @@
{
"cell_type": "code",
"execution_count": 31,
"id": "
residential-logic
",
"id": "
tough-domain
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -1017,7 +1017,7 @@
{
"cell_type": "code",
"execution_count": 47,
"id": "
maritime-consequenc
e",
"id": "
indian-empir
e",
"metadata": {},
"outputs": [
{
...
...
@@ -1038,7 +1038,7 @@
{
"cell_type": "code",
"execution_count": 1,
"id": "
african-identification
",
"id": "
horizontal-paragraph
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -1049,7 +1049,7 @@
{
"cell_type": "code",
"execution_count": 56,
"id": "
upset-regard
",
"id": "
homeless-zoning
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -1059,7 +1059,7 @@
{
"cell_type": "code",
"execution_count": 58,
"id": "
wrapped-netherlands
",
"id": "
floating-atmosphere
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -1069,7 +1069,7 @@
{
"cell_type": "code",
"execution_count": 60,
"id": "
engaging-statement
",
"id": "
stupid-reducing
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -1079,7 +1079,7 @@
{
"cell_type": "code",
"execution_count": 66,
"id": "
joined-handy
",
"id": "
practical-airline
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -1089,7 +1089,7 @@
{
"cell_type": "code",
"execution_count": 95,
"id": "a
bsolute-kenya
",
"id": "a
part-comfort
",
"metadata": {},
"outputs": [
{
...
...
@@ -1110,7 +1110,7 @@
{
"cell_type": "code",
"execution_count": 81,
"id": "
integral-subsection
",
"id": "
underlying-brand
",
"metadata": {},
"outputs": [
{
...
...
@@ -1131,7 +1131,7 @@
{
"cell_type": "code",
"execution_count": 11,
"id": "
conservative-sport
",
"id": "
german-things
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -1161,7 +1161,7 @@
{
"cell_type": "code",
"execution_count": 12,
"id": "
connected-brass
",
"id": "
third-regression
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -1172,7 +1172,7 @@
{
"cell_type": "code",
"execution_count": 14,
"id": "
worse-couple
",
"id": "
thick-korea
",
"metadata": {},
"outputs": [
{
...
...
@@ -1201,7 +1201,7 @@
{
"cell_type": "code",
"execution_count": 13,
"id": "
unlimited-effect
s",
"id": "
institutional-hand
s",
"metadata": {},
"outputs": [
{
...
...
@@ -1230,7 +1230,7 @@
{
"cell_type": "code",
"execution_count": 15,
"id": "
stable-artist
",
"id": "
brave-native
",
"metadata": {},
"outputs": [
{
...
...
@@ -1260,7 +1260,7 @@
{
"cell_type": "code",
"execution_count": 29,
"id": "
romance-laser
",
"id": "
turkish-ticket
",
"metadata": {},
"outputs": [
{
...
...
@@ -1290,7 +1290,7 @@
{
"cell_type": "code",
"execution_count": 30,
"id": "
pharmaceutical-colombia
",
"id": "
executed-excerpt
",
"metadata": {},
"outputs": [
{
...
...
@@ -1308,7 +1308,7 @@
{
"cell_type": "code",
"execution_count": 22,
"id": "
forty-harvest
",
"id": "
continental-boring
",
"metadata": {},
"outputs": [
{
...
...
@@ -1343,7 +1343,7 @@
{
"cell_type": "code",
"execution_count": 23,
"id": "
thirty-software
",
"id": "
linear-assembly
",
"metadata": {},
"outputs": [
{
...
...
@@ -1376,7 +1376,7 @@
{
"cell_type": "code",
"execution_count": 33,
"id": "
portuguese-addiction
",
"id": "
applied-louis
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -1386,7 +1386,7 @@
{
"cell_type": "code",
"execution_count": 34,
"id": "
everyday-vessel
",
"id": "
historic-struggle
",
"metadata": {},
"outputs": [
{
...
...
@@ -1428,17 +1428,60 @@
{
"cell_type": "code",
"execution_count": 35,
"id": "
latter-expression
",
"id": "
monthly-roads
",
"metadata": {},
"outputs": [],
"source": [
"getpass?"
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "boxed-peoples",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Worker:"
]
}
],
"source": [
"import multiprocessing\n",
"import cProfile\n",
"import time\n",
"\n",
"def worker(num):\n",
" time.sleep(3)\n",
" print('Worker:', num)\n",
"\n",
"def profile_worker(num):\n",
" cProfile.runctx('worker(num)', globals(), locals(), 'profile-%d.out' %num)\n",
"\n",
"\n",
"\n",
"for i in range(5):\n",
" p = multiprocessing.Process(target=profile_worker, args=(i,))\n",
" p.start()"
]
},
{
"cell_type": "code",
"execution_count": 41,
"id": "fresh-tender",
"metadata": {},
"outputs": [],
"source": [
"!ls"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "
small-professor
",
"id": "
religious-peripheral
",
"metadata": {},
"outputs": [],
"source": []
.pre-commit-config.yaml
浏览文件 @
fa6e3334
...
...
@@ -52,7 +52,7 @@
language
:
system
files
:
\.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|py)$
#exclude: (?=decoders/swig).*(\.cpp|\.h)$
#
- repo: https://github.com/asottile/reorder_python_imports
#
rev: v2.4.0
#
hooks:
#
- id: reorder-python-imports
-
repo
:
https://github.com/asottile/reorder_python_imports
rev
:
v2.4.0
hooks
:
-
id
:
reorder-python-imports
deepspeech/__init__.py
浏览文件 @
fa6e3334
...
...
@@ -11,18 +11,18 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
typing
import
Union
from
typing
import
Any
from
typing
import
List
from
typing
import
Tuple
from
typing
import
Any
from
typing
import
Union
import
paddle
from
paddle
import
nn
from
paddle.nn
import
functional
as
F
#TODO(Hui Zhang): remove fluid import
from
paddle.fluid
import
core
from
paddle.nn
import
functional
as
F
from
deepspeech.utils.log
import
Log
#TODO(Hui Zhang): remove fluid import
logger
=
Log
(
__name__
).
getlog
()
########### hcak logging #############
...
...
deepspeech/decoders/decoders_deprecated.py
浏览文件 @
fa6e3334
...
...
@@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains various CTC decoders."""
import
multiprocessing
from
itertools
import
groupby
import
numpy
as
np
from
math
import
log
import
multiprocessing
import
numpy
as
np
def
ctc_greedy_decoder
(
probs_seq
,
vocabulary
):
...
...
deepspeech/decoders/scorer_deprecated.py
浏览文件 @
fa6e3334
...
...
@@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""External Scorer for Beam Search Decoder."""
import
os
import
kenlm
import
numpy
as
np
...
...
deepspeech/decoders/swig/setup.py
浏览文件 @
fa6e3334
...
...
@@ -12,14 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Script to build and install decoder package."""
from
setuptools
import
setup
,
Extension
,
distutils
import
argparse
import
glob
import
platform
import
multiprocessing.pool
import
os
import
platform
import
sys
import
multiprocessing.pool
import
argparse
from
setuptools
import
distutils
from
setuptools
import
Extension
from
setuptools
import
setup
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
parser
.
add_argument
(
...
...
deepspeech/decoders/swig_wrapper.py
浏览文件 @
fa6e3334
...
...
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Wrapper for various CTC decoders in SWIG."""
import
swig_decoders
...
...
deepspeech/decoders/tests/test_decoders.py
浏览文件 @
fa6e3334
...
...
@@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Test decoders."""
import
unittest
from
deepspeech.decoders
import
decoders_deprecated
as
decoder
...
...
deepspeech/exps/deepspeech2/bin/deploy/client.py
浏览文件 @
fa6e3334
...
...
@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Client-end for the ASR demo."""
import
keyboard
import
sys
import
argparse
import
sys
import
keyboard
import
pyaudio
from
deepspeech.utils.socket_server
import
socket_send
...
...
deepspeech/exps/deepspeech2/bin/deploy/record.py
浏览文件 @
fa6e3334
...
...
@@ -13,9 +13,10 @@
# limitations under the License.
"""Record wav from Microphone"""
# http://people.csail.mit.edu/hubert/pyaudio/
import
pyaudio
import
wave
import
pyaudio
CHUNK
=
1024
FORMAT
=
pyaudio
.
paInt16
CHANNELS
=
1
...
...
deepspeech/exps/deepspeech2/bin/deploy/runtime.py
浏览文件 @
fa6e3334
...
...
@@ -13,23 +13,21 @@
# limitations under the License.
"""Server-end for the ASR demo."""
import
functools
import
paddle
import
numpy
as
np
from
deepspeech.utils.socket_server
import
warm_up_test
from
deepspeech.utils.socket_server
import
AsrTCPServer
from
deepspeech.utils.socket_server
import
AsrRequestHandler
import
numpy
as
np
import
paddle
from
paddle.inference
import
Config
from
paddle.inference
import
create_predictor
from
deepspeech.training.cli
import
default_argument_parser
from
deepspeech.exps.deepspeech2.config
import
get_cfg_defaults
from
deepspeech.utils.utility
import
add_arguments
,
print_arguments
from
deepspeech.models.deepspeech2
import
DeepSpeech2Model
from
deepspeech.io.dataset
import
ManifestDataset
from
paddle.inference
import
Config
from
paddle.inference
import
create_predictor
from
deepspeech.models.deepspeech2
import
DeepSpeech2Model
from
deepspeech.training.cli
import
default_argument_parser
from
deepspeech.utils.socket_server
import
AsrRequestHandler
from
deepspeech.utils.socket_server
import
AsrTCPServer
from
deepspeech.utils.socket_server
import
warm_up_test
from
deepspeech.utils.utility
import
add_arguments
from
deepspeech.utils.utility
import
print_arguments
def
init_predictor
(
args
):
...
...
deepspeech/exps/deepspeech2/bin/deploy/server.py
浏览文件 @
fa6e3334
...
...
@@ -13,20 +13,19 @@
# limitations under the License.
"""Server-end for the ASR demo."""
import
functools
import
paddle
import
numpy
as
np
from
deepspeech.utils.socket_server
import
warm_up_test
from
deepspeech.utils.socket_server
import
AsrTCPServer
from
deepspeech.utils.socket_server
import
AsrRequestHandler
import
numpy
as
np
import
paddle
from
deepspeech.training.cli
import
default_argument_parser
from
deepspeech.exps.deepspeech2.config
import
get_cfg_defaults
from
deepspeech.utils.utility
import
add_arguments
,
print_arguments
from
deepspeech.models.deepspeech2
import
DeepSpeech2Model
from
deepspeech.io.dataset
import
ManifestDataset
from
deepspeech.models.deepspeech2
import
DeepSpeech2Model
from
deepspeech.training.cli
import
default_argument_parser
from
deepspeech.utils.socket_server
import
AsrRequestHandler
from
deepspeech.utils.socket_server
import
AsrTCPServer
from
deepspeech.utils.socket_server
import
warm_up_test
from
deepspeech.utils.utility
import
add_arguments
from
deepspeech.utils.utility
import
print_arguments
def
start_server
(
config
,
args
):
...
...
deepspeech/exps/deepspeech2/bin/export.py
浏览文件 @
fa6e3334
...
...
@@ -12,11 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Export for DeepSpeech2 model."""
from
deepspeech.training.cli
import
default_argument_parser
from
deepspeech.utils.utility
import
print_arguments
from
deepspeech.exps.deepspeech2.config
import
get_cfg_defaults
from
deepspeech.exps.deepspeech2.model
import
DeepSpeech2Tester
as
Tester
from
deepspeech.training.cli
import
default_argument_parser
from
deepspeech.utils.utility
import
print_arguments
def
main_sp
(
config
,
args
):
...
...
deepspeech/exps/deepspeech2/bin/infer.py
浏览文件 @
fa6e3334
...
...
@@ -12,12 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Inferer for DeepSpeech2 model."""
from
deepspeech.exps.deepspeech2.config
import
get_cfg_defaults
from
deepspeech.exps.deepspeech2.model
import
DeepSpeech2Tester
as
Tester
from
deepspeech.training.cli
import
default_argument_parser
from
deepspeech.utils.utility
import
print_arguments
# TODO(hui zhang): dynamic load
from
deepspeech.exps.deepspeech2.config
import
get_cfg_defaults
from
deepspeech.exps.deepspeech2.model
import
DeepSpeech2Tester
as
Tester
def
main_sp
(
config
,
args
):
...
...
deepspeech/exps/deepspeech2/bin/test.py
浏览文件 @
fa6e3334
...
...
@@ -12,11 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Evaluation for DeepSpeech2 model."""
from
deepspeech.training.cli
import
default_argument_parser
from
deepspeech.utils.utility
import
print_arguments
from
deepspeech.exps.deepspeech2.config
import
get_cfg_defaults
from
deepspeech.exps.deepspeech2.model
import
DeepSpeech2Tester
as
Tester
from
deepspeech.training.cli
import
default_argument_parser
from
deepspeech.utils.utility
import
print_arguments
def
main_sp
(
config
,
args
):
...
...
deepspeech/exps/deepspeech2/bin/train.py
浏览文件 @
fa6e3334
...
...
@@ -14,11 +14,10 @@
"""Trainer for DeepSpeech2 model."""
from
paddle
import
distributed
as
dist
from
deepspeech.utils.utility
import
print_arguments
from
deepspeech.training.cli
import
default_argument_parser
from
deepspeech.exps.deepspeech2.config
import
get_cfg_defaults
from
deepspeech.exps.deepspeech2.model
import
DeepSpeech2Trainer
as
Trainer
from
deepspeech.training.cli
import
default_argument_parser
from
deepspeech.utils.utility
import
print_arguments
def
main_sp
(
config
,
args
):
...
...
deepspeech/exps/deepspeech2/bin/tune.py
浏览文件 @
fa6e3334
...
...
@@ -12,22 +12,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Beam search parameters tuning for DeepSpeech2 model."""
import
sys
import
numpy
as
np
import
functools
import
sys
import
numpy
as
np
from
paddle.io
import
DataLoader
from
deepspeech.utils
import
error_rate
from
deepspeech.utils.utility
import
add_arguments
,
print_arguments
from
deepspeech.models.deepspeech2
import
DeepSpeech2Model
from
deepspeech.exps.deepspeech2.config
import
get_cfg_defaults
from
deepspeech.io.collator
import
SpeechCollator
from
deepspeech.io.dataset
import
ManifestDataset
from
deepspeech.models.deepspeech2
import
DeepSpeech2Model
from
deepspeech.training.cli
import
default_argument_parser
from
deepspeech.exps.deepspeech2.config
import
get_cfg_defaults
from
deepspeech.utils
import
error_rate
from
deepspeech.utils.utility
import
add_arguments
from
deepspeech.utils.utility
import
print_arguments
def
tune
(
config
,
args
):
...
...
deepspeech/exps/deepspeech2/config.py
浏览文件 @
fa6e3334
...
...
@@ -11,8 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
yacs.config
import
CfgNode
as
CN
from
deepspeech.models.deepspeech2
import
DeepSpeech2Model
_C
=
CN
()
...
...
deepspeech/exps/deepspeech2/model.py
浏览文件 @
fa6e3334
...
...
@@ -12,31 +12,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains DeepSpeech2 model."""
import
time
from
deepspeech.utils.log
import
Log
import
numpy
as
np
from
collections
import
defaultdict
from
pathlib
import
Path
import
numpy
as
np
import
paddle
from
paddle
import
distributed
as
dist
from
paddle.io
import
DataLoader
from
deepspeech.training.trainer
import
Trainer
from
deepspeech.training.gradclip
import
ClipGradByGlobalNormWithLog
from
deepspeech.utils
import
mp_tools
from
deepspeech.utils
import
layer_tools
from
deepspeech.utils
import
error_rate
from
deepspeech.io.collator
import
SpeechCollator
from
deepspeech.io.sampler
import
SortagradDistributedBatchSampler
from
deepspeech.io.sampler
import
SortagradBatchSampler
from
deepspeech.io.dataset
import
ManifestDataset
from
deepspeech.
models.deepspeech2
import
DeepSpeech2Model
from
deepspeech.io.sampler
import
SortagradBatchSampler
from
deepspeech.
io.sampler
import
SortagradDistributedBatchSampler
from
deepspeech.models.deepspeech2
import
DeepSpeech2InferModel
from
deepspeech.models.deepspeech2
import
DeepSpeech2Model
from
deepspeech.training.gradclip
import
ClipGradByGlobalNormWithLog
from
deepspeech.training.trainer
import
Trainer
from
deepspeech.utils
import
error_rate
from
deepspeech.utils
import
layer_tools
from
deepspeech.utils
import
mp_tools
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
...
...
deepspeech/exps/u2/bin/export.py
浏览文件 @
fa6e3334
...
...
@@ -12,12 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Export for U2 model."""
from
deepspeech.training.cli
import
default_argument_parser
from
deepspeech.utils.utility
import
print_arguments
from
deepspeech.exps.u2.config
import
get_cfg_defaults
from
deepspeech.exps.u2.model
import
U2Tester
as
Tester
from
deepspeech.training.cli
import
default_argument_parser
from
deepspeech.utils.utility
import
print_arguments
def
main_sp
(
config
,
args
):
...
...
deepspeech/exps/u2/bin/test.py
浏览文件 @
fa6e3334
...
...
@@ -12,15 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Evaluation for U2 model."""
import
os
import
cProfile
import
os
from
deepspeech.exps.u2.config
import
get_cfg_defaults
from
deepspeech.exps.u2.model
import
U2Tester
as
Tester
from
deepspeech.training.cli
import
default_argument_parser
from
deepspeech.utils.utility
import
print_arguments
# TODO(hui zhang): dynamic load
from
deepspeech.exps.u2.config
import
get_cfg_defaults
from
deepspeech.exps.u2.model
import
U2Tester
as
Tester
def
main_sp
(
config
,
args
):
...
...
deepspeech/exps/u2/bin/train.py
浏览文件 @
fa6e3334
...
...
@@ -12,16 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Trainer for U2 model."""
import
os
import
cProfile
from
paddle
import
distributed
as
dist
import
os
from
deepspeech.utils.utility
import
print_arguments
from
deepspeech.training.cli
import
default_argument_parser
from
paddle
import
distributed
as
dist
from
deepspeech.exps.u2.config
import
get_cfg_defaults
from
deepspeech.exps.u2.model
import
U2Trainer
as
Trainer
from
deepspeech.training.cli
import
default_argument_parser
from
deepspeech.utils.utility
import
print_arguments
def
main_sp
(
config
,
args
):
...
...
deepspeech/exps/u2/config.py
浏览文件 @
fa6e3334
...
...
@@ -11,13 +11,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
yacs.config
import
CfgNode
from
deepspeech.exps.u2.model
import
U2Tester
from
deepspeech.exps.u2.model
import
U2Trainer
from
deepspeech.io.dataset
import
ManifestDataset
from
deepspeech.models.u2
import
U2Model
from
deepspeech.exps.u2.model
import
U2Trainer
from
deepspeech.exps.u2.model
import
U2Tester
_C
=
CfgNode
()
...
...
deepspeech/exps/u2/model.py
浏览文件 @
fa6e3334
...
...
@@ -12,34 +12,30 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains U2 model."""
import
sys
import
time
from
deepspeech.utils.log
import
Log
import
numpy
as
np
from
collections
import
defaultdict
from
pathlib
import
Path
from
typing
import
Optional
from
yacs.config
import
CfgNode
import
numpy
as
np
import
paddle
from
paddle
import
distributed
as
dist
from
paddle.io
import
DataLoader
from
deepspeech.training.trainer
import
Trainer
from
deepspeech.training.gradclip
import
ClipGradByGlobalNormWithLog
from
deepspeech.training.scheduler
import
WarmupLR
from
deepspeech.utils
import
mp_tools
from
deepspeech.utils
import
layer_tools
from
deepspeech.utils
import
error_rate
from
yacs.config
import
CfgNode
from
deepspeech.io.collator
import
SpeechCollator
from
deepspeech.io.sampler
import
SortagradDistributedBatchSampler
from
deepspeech.io.sampler
import
SortagradBatchSampler
from
deepspeech.io.dataset
import
ManifestDataset
from
deepspeech.io.sampler
import
SortagradBatchSampler
from
deepspeech.io.sampler
import
SortagradDistributedBatchSampler
from
deepspeech.models.u2
import
U2Model
from
deepspeech.training.gradclip
import
ClipGradByGlobalNormWithLog
from
deepspeech.training.scheduler
import
WarmupLR
from
deepspeech.training.trainer
import
Trainer
from
deepspeech.utils
import
error_rate
from
deepspeech.utils
import
layer_tools
from
deepspeech.utils
import
mp_tools
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
...
...
deepspeech/frontend/audio.py
浏览文件 @
fa6e3334
...
...
@@ -12,16 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains the audio segment class."""
import
numpy
as
np
import
copy
import
io
import
struct
import
random
import
re
import
soundfile
import
struct
import
numpy
as
np
import
resampy
import
soundfile
from
scipy
import
signal
import
random
import
copy
class
AudioSegment
(
object
):
...
...
deepspeech/frontend/augmentor/augmentation.py
浏览文件 @
fa6e3334
...
...
@@ -12,21 +12,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains the data augmentation pipeline."""
import
json
import
numpy
as
np
# audio augment
from
deepspeech.frontend.augmentor.volume_perturb
import
VolumePerturbAugmentor
from
deepspeech.frontend.augmentor.shift_perturb
import
ShiftPerturbAugmentor
from
deepspeech.frontend.augmentor.speed_perturb
import
SpeedPerturbAugmentor
from
deepspeech.frontend.augmentor.noise_perturb
import
NoisePerturbAugmentor
from
deepspeech.frontend.augmentor.impulse_response
import
ImpulseResponseAugmentor
from
deepspeech.frontend.augmentor.
resample
import
Resample
Augmentor
from
deepspeech.frontend.augmentor.
noise_perturb
import
NoisePerturb
Augmentor
from
deepspeech.frontend.augmentor.online_bayesian_normalization
import
\
OnlineBayesianNormalizationAugmentor
# feature augment
from
deepspeech.frontend.augmentor.resample
import
ResampleAugmentor
from
deepspeech.frontend.augmentor.shift_perturb
import
ShiftPerturbAugmentor
from
deepspeech.frontend.augmentor.spec_augment
import
SpecAugmentor
from
deepspeech.frontend.augmentor.speed_perturb
import
SpeedPerturbAugmentor
from
deepspeech.frontend.augmentor.volume_perturb
import
VolumePerturbAugmentor
class
AugmentationPipeline
():
...
...
deepspeech/frontend/augmentor/base.py
浏览文件 @
fa6e3334
...
...
@@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains the abstract base class for augmentation models."""
from
abc
import
ABCMeta
,
abstractmethod
from
abc
import
ABCMeta
from
abc
import
abstractmethod
class
AugmentorBase
():
...
...
deepspeech/frontend/augmentor/impulse_response.py
浏览文件 @
fa6e3334
...
...
@@ -12,10 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains the impulse response augmentation model."""
from
deepspeech.frontend.audio
import
AudioSegment
from
deepspeech.frontend.augmentor.base
import
AugmentorBase
from
deepspeech.frontend.utility
import
read_manifest
from
deepspeech.frontend.audio
import
AudioSegment
class
ImpulseResponseAugmentor
(
AugmentorBase
):
...
...
deepspeech/frontend/augmentor/noise_perturb.py
浏览文件 @
fa6e3334
...
...
@@ -12,10 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains the noise perturb augmentation model."""
from
deepspeech.frontend.audio
import
AudioSegment
from
deepspeech.frontend.augmentor.base
import
AugmentorBase
from
deepspeech.frontend.utility
import
read_manifest
from
deepspeech.frontend.audio
import
AudioSegment
class
NoisePerturbAugmentor
(
AugmentorBase
):
...
...
deepspeech/frontend/augmentor/online_bayesian_normalization.py
浏览文件 @
fa6e3334
...
...
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contain the online bayesian normalization augmentation model."""
from
deepspeech.frontend.augmentor.base
import
AugmentorBase
...
...
deepspeech/frontend/augmentor/resample.py
浏览文件 @
fa6e3334
...
...
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contain the resample augmentation model."""
from
deepspeech.frontend.augmentor.base
import
AugmentorBase
...
...
deepspeech/frontend/augmentor/shift_perturb.py
浏览文件 @
fa6e3334
...
...
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains the volume perturb augmentation model."""
from
deepspeech.frontend.augmentor.base
import
AugmentorBase
...
...
deepspeech/frontend/augmentor/spec_augment.py
浏览文件 @
fa6e3334
...
...
@@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains the volume perturb augmentation model."""
from
deepspeech.utils.log
import
Log
import
numpy
as
np
from
deepspeech.frontend.augmentor.base
import
AugmentorBase
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
...
...
deepspeech/frontend/augmentor/speed_perturb.py
浏览文件 @
fa6e3334
...
...
@@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contain the speech perturbation augmentation model."""
import
numpy
as
np
from
deepspeech.frontend.augmentor.base
import
AugmentorBase
...
...
deepspeech/frontend/augmentor/volume_perturb.py
浏览文件 @
fa6e3334
...
...
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains the volume perturb augmentation model."""
from
deepspeech.frontend.augmentor.base
import
AugmentorBase
...
...
deepspeech/frontend/featurizer/audio_featurizer.py
浏览文件 @
fa6e3334
...
...
@@ -12,11 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains the audio featurizer class."""
import
numpy
as
np
from
python_speech_features
import
mfcc
from
python_speech_features
import
logfbank
from
python_speech_features
import
delta
from
python_speech_features
import
logfbank
from
python_speech_features
import
mfcc
class
AudioFeaturizer
(
object
):
...
...
deepspeech/frontend/featurizer/speech_featurizer.py
浏览文件 @
fa6e3334
...
...
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains the speech featurizer class."""
from
deepspeech.frontend.featurizer.audio_featurizer
import
AudioFeaturizer
from
deepspeech.frontend.featurizer.text_featurizer
import
TextFeaturizer
...
...
deepspeech/frontend/featurizer/text_featurizer.py
浏览文件 @
fa6e3334
...
...
@@ -12,11 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains the text featurizer class."""
import
sentencepiece
as
spm
from
deepspeech.frontend.utility
import
UNK
from
deepspeech.frontend.utility
import
EOS
from
deepspeech.frontend.utility
import
UNK
class
TextFeaturizer
(
object
):
...
...
deepspeech/frontend/normalizer.py
浏览文件 @
fa6e3334
...
...
@@ -12,12 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains feature normalizers."""
import
random
import
numpy
as
np
import
random
from
deepspeech.frontend.utility
import
read_manifest
from
deepspeech.frontend.utility
import
load_cmvn
from
deepspeech.frontend.audio
import
AudioSegment
from
deepspeech.frontend.utility
import
load_cmvn
from
deepspeech.frontend.utility
import
read_manifest
class
FeatureNormalizer
(
object
):
...
...
deepspeech/frontend/speech.py
浏览文件 @
fa6e3334
...
...
@@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains the speech segment class."""
import
numpy
as
np
from
deepspeech.frontend.audio
import
AudioSegment
...
...
deepspeech/frontend/utility.py
浏览文件 @
fa6e3334
...
...
@@ -12,10 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains data helper functions."""
import
numpy
as
np
import
math
import
json
import
codecs
import
json
import
math
import
numpy
as
np
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
...
...
deepspeech/io/__init__.py
浏览文件 @
fa6e3334
...
...
@@ -11,14 +11,13 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
numpy
as
np
from
paddle.io
import
DataLoader
from
deepspeech.io.collator
import
SpeechCollator
from
deepspeech.io.sampler
import
SortagradDistributedBatchSampler
from
deepspeech.io.sampler
import
SortagradBatchSampler
from
deepspeech.io.dataset
import
ManifestDataset
from
deepspeech.io.sampler
import
SortagradBatchSampler
from
deepspeech.io.sampler
import
SortagradDistributedBatchSampler
def
create_dataloader
(
manifest_path
,
...
...
deepspeech/io/collator.py
浏览文件 @
fa6e3334
...
...
@@ -11,12 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
deepspeech.utils.log
import
Log
import
numpy
as
np
from
deepspeech.io.utility
import
pad_sequence
from
deepspeech.frontend.utility
import
IGNORE_ID
from
deepspeech.io.utility
import
pad_sequence
from
deepspeech.utils.log
import
Log
__all__
=
[
"SpeechCollator"
]
...
...
deepspeech/io/dataset.py
浏览文件 @
fa6e3334
...
...
@@ -11,23 +11,22 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
time
import
io
import
random
import
tarfile
from
deepspeech.utils.log
import
Log
from
typing
import
Optional
from
yacs.config
import
CfgNode
import
time
from
collections
import
namedtuple
from
typing
import
Optional
from
paddle.io
import
Dataset
from
yacs.config
import
CfgNode
from
deepspeech.frontend.utility
import
read_manifest
from
deepspeech.frontend.augmentor.augmentation
import
AugmentationPipeline
from
deepspeech.frontend.featurizer.speech_featurizer
import
SpeechFeaturizer
from
deepspeech.frontend.speech
import
SpeechSegment
from
deepspeech.frontend.normalizer
import
FeatureNormalizer
from
deepspeech.frontend.speech
import
SpeechSegment
from
deepspeech.frontend.utility
import
read_manifest
from
deepspeech.utils.log
import
Log
__all__
=
[
"ManifestDataset"
,
...
...
deepspeech/io/sampler.py
浏览文件 @
fa6e3334
...
...
@@ -11,14 +11,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
math
from
deepspeech.utils.log
import
Log
import
numpy
as
np
import
numpy
as
np
from
paddle
import
distributed
as
dist
from
paddle.io
import
BatchSampler
from
paddle.io
import
DistributedBatchSampler
from
paddle
import
distributed
as
dist
from
deepspeech.utils.log
import
Log
__all__
=
[
"SortagradDistributedBatchSampler"
,
...
...
deepspeech/io/utility.py
浏览文件 @
fa6e3334
...
...
@@ -11,10 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
typing
import
List
from
deepspeech.utils.log
import
Log
import
numpy
as
np
from
typing
import
List
from
deepspeech.utils.log
import
Log
__all__
=
[
"pad_sequence"
]
...
...
deepspeech/models/deepspeech2.py
浏览文件 @
fa6e3334
...
...
@@ -12,19 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Deepspeech2 ASR Model"""
from
deepspeech.utils.log
import
Log
from
typing
import
Optional
from
yacs.config
import
CfgNode
import
paddle
from
paddle
import
nn
from
yacs.config
import
CfgNode
from
deepspeech.modules.conv
import
ConvStack
from
deepspeech.modules.rnn
import
RNNStack
from
deepspeech.modules.ctc
import
CTCDecoder
from
deepspeech.modules.rnn
import
RNNStack
from
deepspeech.utils
import
checkpoint
from
deepspeech.utils
import
layer_tools
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
...
...
deepspeech/models/u2.py
浏览文件 @
fa6e3334
...
...
@@ -15,40 +15,39 @@
Unified Streaming and Non-streaming Two-pass End-to-end Model for Speech Recognition
(https://arxiv.org/pdf/2012.05481.pdf)
"""
import
time
import
sys
import
time
from
collections
import
defaultdict
from
deepspeech.utils.log
import
Log
from
yacs.config
import
CfgNode
from
typing
import
List
,
Optional
,
Tuple
,
Dict
from
typing
import
Dict
from
typing
import
List
from
typing
import
Optional
from
typing
import
Tuple
import
paddle
from
paddle
import
jit
from
paddle
import
nn
from
yacs.config
import
CfgNode
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.frontend.utility
import
IGNORE_ID
from
deepspeech.frontend.utility
import
load_cmvn
from
deepspeech.modules.cmvn
import
GlobalCMVN
from
deepspeech.modules.encoder
import
ConformerEncoder
from
deepspeech.modules.encoder
import
TransformerEncoder
from
deepspeech.modules.ctc
import
CTCDecoder
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.
frontend.utility
import
load_cmvn
from
deepspeech.
frontend.utility
import
IGNORE_ID
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.utility
import
log_add
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
th_accuracy
from
deepspeech.utils.tensor_utils
import
pad_sequence
from
deepspeech.utils.ctc_utils
import
remove_duplicates_and_blank
from
deepspeech.utils.tensor_utils
import
th_accuracy
from
deepspeech.utils.utility
import
log_add
logger
=
Log
(
__name__
).
getlog
()
...
...
deepspeech/modules/activation.py
浏览文件 @
fa6e3334
...
...
@@ -11,13 +11,13 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
deepspeech.utils.log
import
Log
from
collections
import
OrderedDict
import
paddle
from
paddle
import
nn
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
__all__
=
[
"get_activation"
,
"brelu"
,
"LinearGLUBlock"
,
"ConvGLUBlock"
]
...
...
deepspeech/modules/attention.py
浏览文件 @
fa6e3334
...
...
@@ -13,13 +13,15 @@
# limitations under the License.
"""Multi-Head Attention layer definition."""
import
math
from
deepspeech.utils.log
import
Log
from
typing
import
Optional
,
Tuple
from
typing
import
Optional
from
typing
import
Tuple
import
paddle
from
paddle
import
nn
from
paddle.nn
import
initializer
as
I
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
__all__
=
[
"MultiHeadedAttention"
,
"RelPositionMultiHeadedAttention"
]
...
...
deepspeech/modules/cmvn.py
浏览文件 @
fa6e3334
...
...
@@ -11,12 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
deepspeech.utils.log
import
Log
import
paddle
from
paddle
import
nn
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
__all__
=
[
'GlobalCMVN'
]
...
...
deepspeech/modules/conformer_convolution.py
浏览文件 @
fa6e3334
...
...
@@ -12,13 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""ConvolutionModule definition."""
from
typing
import
Optional
,
Tuple
from
typeguard
import
check_argument_types
from
deepspeech.utils.log
import
Log
from
typing
import
Optional
from
typing
import
Tuple
import
paddle
from
paddle
import
nn
from
typeguard
import
check_argument_types
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
...
...
deepspeech/modules/conv.py
浏览文件 @
fa6e3334
...
...
@@ -11,14 +11,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
deepspeech.utils.log
import
Log
from
paddle
import
nn
from
paddle.nn
import
functional
as
F
from
deepspeech.modules.mask
import
sequence_mask
from
deepspeech.modules.activation
import
brelu
from
deepspeech.modules.mask
import
sequence_mask
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
...
...
deepspeech/modules/ctc.py
浏览文件 @
fa6e3334
...
...
@@ -11,20 +11,17 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
deepspeech.utils.log
import
Log
from
typeguard
import
check_argument_types
import
paddle
from
paddle
import
nn
from
paddle.nn
import
functional
as
F
from
typeguard
import
check_argument_types
from
deepspeech.decoders.swig_wrapper
import
ctc_beam_search_decoder_batch
from
deepspeech.decoders.swig_wrapper
import
ctc_greedy_decoder
from
deepspeech.decoders.swig_wrapper
import
Scorer
from
deepspeech.modules.loss
import
CTCLoss
from
deepspeech.utils
import
ctc_utils
from
deepspeech.decoders.swig_wrapper
import
Scorer
from
deepspeech.decoders.swig_wrapper
import
ctc_greedy_decoder
from
deepspeech.decoders.swig_wrapper
import
ctc_beam_search_decoder_batch
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
...
...
deepspeech/modules/decoder.py
浏览文件 @
fa6e3334
...
...
@@ -12,19 +12,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Decoder definition."""
from
typing
import
Tuple
,
List
,
Optional
from
typ
eguard
import
check_argument_types
from
deepspeech.utils.log
import
Log
from
typing
import
List
from
typ
ing
import
Optional
from
typing
import
Tuple
import
paddle
from
paddle
import
nn
from
typeguard
import
check_argument_types
from
deepspeech.modules.attention
import
MultiHeadedAttention
from
deepspeech.modules.decoder_layer
import
DecoderLayer
from
deepspeech.modules.embedding
import
PositionalEncoding
from
deepspeech.modules.positionwise_feed_forward
import
PositionwiseFeedForward
from
deepspeech.modules.mask
import
subsequent_mask
from
deepspeech.modules.mask
import
make_non_pad_mask
from
deepspeech.modules.mask
import
subsequent_mask
from
deepspeech.modules.positionwise_feed_forward
import
PositionwiseFeedForward
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
...
...
deepspeech/modules/decoder_layer.py
浏览文件 @
fa6e3334
...
...
@@ -12,12 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Decoder self-attention layer definition."""
from
typing
import
Optional
,
Tuple
from
deepspeech.utils.log
import
Log
from
typing
import
Optional
from
typing
import
Tuple
import
paddle
from
paddle
import
nn
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
__all__
=
[
"DecoderLayer"
]
...
...
deepspeech/modules/embedding.py
浏览文件 @
fa6e3334
...
...
@@ -12,14 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Positonal Encoding Module."""
import
math
from
deepspeech.utils.log
import
Log
from
typing
import
Tuple
import
paddle
from
paddle
import
nn
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
__all__
=
[
"PositionalEncoding"
,
"RelPositionalEncoding"
]
...
...
deepspeech/modules/encoder.py
浏览文件 @
fa6e3334
...
...
@@ -12,28 +12,30 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Encoder definition."""
from
deepspeech.utils.log
import
Log
from
typing
import
Tuple
,
List
,
Optional
from
typ
eguard
import
check_argument_types
from
typing
import
List
from
typing
import
Optional
from
typ
ing
import
Tuple
import
paddle
from
paddle
import
nn
from
typeguard
import
check_argument_types
from
deepspeech.modules.activation
import
get_activation
from
deepspeech.modules.attention
import
MultiHeadedAttention
from
deepspeech.modules.attention
import
RelPositionMultiHeadedAttention
from
deepspeech.modules.conformer_convolution
import
ConvolutionModule
from
deepspeech.modules.embedding
import
PositionalEncoding
from
deepspeech.modules.embedding
import
RelPositionalEncoding
from
deepspeech.modules.encoder_layer
import
TransformerEncoderLayer
from
deepspeech.modules.encoder_layer
import
ConformerEncoderLayer
from
deepspeech.modules.encoder_layer
import
TransformerEncoderLayer
from
deepspeech.modules.mask
import
add_optional_chunk_mask
from
deepspeech.modules.mask
import
make_non_pad_mask
from
deepspeech.modules.positionwise_feed_forward
import
PositionwiseFeedForward
from
deepspeech.modules.subsampling
import
Conv2dSubsampling4
from
deepspeech.modules.subsampling
import
Conv2dSubsampling6
from
deepspeech.modules.subsampling
import
Conv2dSubsampling8
from
deepspeech.modules.subsampling
import
LinearNoSubsampling
from
deepspeech.modules.mask
import
make_non_pad_mask
from
deepspeech.modules.mask
import
add_optional_chunk_mask
from
deepspeech.modules.activation
import
get_activation
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
...
...
deepspeech/modules/encoder_layer.py
浏览文件 @
fa6e3334
...
...
@@ -12,12 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Encoder self-attention layer definition."""
from
typing
import
Optional
,
Tuple
from
deepspeech.utils.log
import
Log
from
typing
import
Optional
from
typing
import
Tuple
import
paddle
from
paddle
import
nn
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
__all__
=
[
"TransformerEncoderLayer"
,
"ConformerEncoderLayer"
]
...
...
deepspeech/modules/loss.py
浏览文件 @
fa6e3334
...
...
@@ -11,13 +11,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
deepspeech.utils.log
import
Log
import
paddle
from
paddle
import
nn
from
paddle.nn
import
functional
as
F
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
__all__
=
[
'CTCLoss'
,
"LabelSmoothingLoss"
]
...
...
deepspeech/modules/mask.py
浏览文件 @
fa6e3334
...
...
@@ -11,11 +11,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
paddle
from
deepspeech.utils.log
import
Log
import
paddle
logger
=
Log
(
__name__
).
getlog
()
__all__
=
[
...
...
deepspeech/modules/positionwise_feed_forward.py
浏览文件 @
fa6e3334
...
...
@@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Positionwise feed forward layer definition."""
from
deepspeech.utils.log
import
Log
import
paddle
from
paddle
import
nn
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
__all__
=
[
"PositionwiseFeedForward"
]
...
...
deepspeech/modules/rnn.py
浏览文件 @
fa6e3334
...
...
@@ -11,17 +11,16 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
math
from
deepspeech.utils.log
import
Log
import
paddle
from
paddle
import
nn
from
paddle.nn
import
functional
as
F
from
paddle.nn
import
initializer
as
I
from
deepspeech.modules.mask
import
sequence_mask
from
deepspeech.modules.activation
import
brelu
from
deepspeech.modules.mask
import
sequence_mask
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
...
...
deepspeech/modules/subsampling.py
浏览文件 @
fa6e3334
...
...
@@ -12,14 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Subsampling layer definition."""
from
typing
import
Tuple
from
deepspeech.utils.log
import
Log
import
paddle
from
paddle
import
nn
from
deepspeech.modules.embedding
import
PositionalEncoding
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
...
...
deepspeech/training/cli.py
浏览文件 @
fa6e3334
...
...
@@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
argparse
...
...
deepspeech/training/gradclip.py
浏览文件 @
fa6e3334
...
...
@@ -11,13 +11,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
deepspeech.utils.log
import
Log
import
paddle
from
paddle.fluid.dygraph
import
base
as
imperative_base
from
paddle.fluid
import
layers
from
paddle.fluid
import
core
from
paddle.fluid
import
layers
from
paddle.fluid.dygraph
import
base
as
imperative_base
from
deepspeech.utils.log
import
Log
__all__
=
[
"ClipGradByGlobalNormWithLog"
]
...
...
deepspeech/training/scheduler.py
浏览文件 @
fa6e3334
...
...
@@ -11,12 +11,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
deepspeech.utils.log
import
Log
from
typing
import
Union
from
typeguard
import
check_argument_types
from
paddle.optimizer.lr
import
LRScheduler
from
typeguard
import
check_argument_types
from
deepspeech.utils.log
import
Log
__all__
=
[
"WarmupLR"
]
...
...
deepspeech/training/trainer.py
浏览文件 @
fa6e3334
...
...
@@ -11,9 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
time
from
deepspeech.utils.log
import
Log
from
pathlib
import
Path
import
paddle
...
...
@@ -22,6 +20,7 @@ from tensorboardX import SummaryWriter
from
deepspeech.utils
import
checkpoint
from
deepspeech.utils
import
mp_tools
from
deepspeech.utils.log
import
Log
__all__
=
[
"Trainer"
]
...
...
deepspeech/utils/checkpoint.py
浏览文件 @
fa6e3334
...
...
@@ -11,11 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
json
import
os
from
deepspeech.utils.log
import
Log
import
re
import
json
from
typing
import
Union
import
paddle
...
...
@@ -23,6 +21,7 @@ from paddle import distributed as dist
from
paddle.optimizer
import
Optimizer
from
deepspeech.utils
import
mp_tools
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
...
...
deepspeech/utils/ctc_utils.py
浏览文件 @
fa6e3334
...
...
@@ -11,13 +11,13 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
deepspeech.utils.log
import
Log
import
numpy
as
np
from
typing
import
List
import
numpy
as
np
import
paddle
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
__all__
=
[
"forced_align"
,
"remove_duplicates_and_blank"
,
"insert_blank"
]
...
...
deepspeech/utils/layer_tools.py
浏览文件 @
fa6e3334
...
...
@@ -11,9 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
numpy
as
np
from
paddle
import
nn
__all__
=
[
...
...
deepspeech/utils/log.py
浏览文件 @
fa6e3334
...
...
@@ -11,12 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
getpass
import
logging
import
os
import
sys
import
getpass
import
socket
import
sys
import
time
...
...
deepspeech/utils/mp_tools.py
浏览文件 @
fa6e3334
...
...
@@ -11,9 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
functools
import
wraps
from
paddle
import
distributed
as
dist
from
functools
import
wraps
__all__
=
[
"rank_zero_only"
]
...
...
deepspeech/utils/socket_server.py
浏览文件 @
fa6e3334
...
...
@@ -11,15 +11,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
os
import
random
import
time
from
time
import
gmtime
,
strftime
import
socket
import
socketserver
import
struct
import
time
import
wave
from
time
import
gmtime
from
time
import
strftime
from
deepspeech.frontend.utility
import
read_manifest
...
...
deepspeech/utils/tensor_utils.py
浏览文件 @
fa6e3334
...
...
@@ -12,11 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Unility functions for Transformer."""
from
deepspeech.utils.log
import
Log
from
typing
import
Tuple
,
List
from
typing
import
List
from
typing
import
Tuple
import
paddle
from
deepspeech.utils.log
import
Log
__all__
=
[
"pad_sequence"
,
"add_sos_eos"
,
"th_accuracy"
]
logger
=
Log
(
__name__
).
getlog
()
...
...
deepspeech/utils/utility.py
浏览文件 @
fa6e3334
...
...
@@ -12,10 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains common utility functions."""
import
os
import
math
import
distutils.util
import
math
import
os
from
typing
import
List
__all__
=
[
'print_arguments'
,
'add_arguments'
,
"log_add"
]
...
...
examples/dataset/aishell/aishell.py
浏览文件 @
fa6e3334
...
...
@@ -18,13 +18,15 @@ Manifest file is a json-format file with each line containing the
meta data (i.e. audio filepath, transcript and audio duration)
of each audio file in the data set.
"""
import
os
import
argparse
import
codecs
import
soundfile
import
json
import
argparse
from
utils.utility
import
download
,
unpack
import
os
import
soundfile
from
utils.utility
import
download
from
utils.utility
import
unpack
DATA_HOME
=
os
.
path
.
expanduser
(
'~/.cache/paddle/dataset/speech'
)
...
...
examples/dataset/chime3_background/chime3_background.py
浏览文件 @
fa6e3334
...
...
@@ -18,14 +18,14 @@ Manifest file is a json-format file with each line containing the
meta data (i.e. audio filepath, transcript and audio duration)
of each audio file in the data set.
"""
import
argparse
import
io
import
json
import
os
import
wget
import
zipfile
import
argparse
import
soundfile
import
json
import
io
import
wget
from
paddle.v2.dataset.common
import
md5file
# DATA_HOME = os.path.expanduser('~/.cache/paddle/dataset/speech')
...
...
examples/dataset/librispeech/librispeech.py
浏览文件 @
fa6e3334
...
...
@@ -18,15 +18,17 @@ Manifest file is a json-format file with each line containing the
meta data (i.e. audio filepath, transcript and audio duration)
of each audio file in the data set.
"""
import
distutils.util
import
os
import
argparse
import
soundfile
import
json
import
codecs
import
distutils.util
import
io
from
utils.utility
import
download
,
unpack
import
json
import
os
import
soundfile
from
utils.utility
import
download
from
utils.utility
import
unpack
URL_ROOT
=
"http://www.openslr.org/resources/12"
#URL_ROOT = "https://openslr.magicdatatech.com/resources/12"
...
...
examples/dataset/mini_librispeech/mini_librispeech.py
浏览文件 @
fa6e3334
...
...
@@ -18,14 +18,16 @@ Manifest file is a json-format file with each line containing the
meta data (i.e. audio filepath, transcript and audio duration)
of each audio file in the data set.
"""
import
os
import
argparse
import
soundfile
import
json
import
codecs
import
io
from
utils.utility
import
download
,
unpack
import
json
import
os
import
soundfile
from
utils.utility
import
download
from
utils.utility
import
unpack
URL_ROOT
=
"http://www.openslr.org/resources/31"
URL_TRAIN_CLEAN
=
URL_ROOT
+
"/train-clean-5.tar.gz"
...
...
examples/dataset/musan/musan.py
浏览文件 @
fa6e3334
...
...
@@ -22,12 +22,15 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
os
import
argparse
import
codecs
import
soundfile
import
json
import
argparse
from
utils.utility
import
download
,
unpack
import
os
import
soundfile
from
utils.utility
import
download
from
utils.utility
import
unpack
DATA_HOME
=
os
.
path
.
expanduser
(
'~/.cache/paddle/dataset/speech'
)
...
...
examples/dataset/rir_noise/rir_noise.py
浏览文件 @
fa6e3334
...
...
@@ -22,12 +22,15 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
os
import
argparse
import
codecs
import
soundfile
import
json
import
argparse
from
utils.utility
import
download
,
unzip
import
os
import
soundfile
from
utils.utility
import
download
from
utils.utility
import
unzip
DATA_HOME
=
os
.
path
.
expanduser
(
'~/.cache/paddle/dataset/speech'
)
...
...
examples/dataset/voxforge/voxforge.py
浏览文件 @
fa6e3334
...
...
@@ -18,16 +18,19 @@ Manifest file is a json-format file with each line containing the
meta data (i.e. audio filepath, transcript and audio duration)
of each audio file in the data set.
"""
import
os
import
argparse
import
codecs
import
datetime
import
soundfile
import
json
import
argparse
import
os
import
shutil
import
subprocess
from
utils.utility
import
download_multi
,
unpack
,
getfile_insensitive
import
soundfile
from
utils.utility
import
download_multi
from
utils.utility
import
getfile_insensitive
from
utils.utility
import
unpack
DATA_HOME
=
os
.
path
.
expanduser
(
'~/.cache/paddle/dataset/speech'
)
...
...
tests/deepspeech2_model_test.py
浏览文件 @
fa6e3334
...
...
@@ -11,10 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
unittest
import
paddle
import
numpy
as
np
import
unittest
import
paddle
from
deepspeech.models.deepspeech2
import
DeepSpeech2Model
...
...
tests/error_rate_test.py
浏览文件 @
fa6e3334
...
...
@@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Test error rate."""
import
unittest
from
deepspeech.utils
import
error_rate
...
...
tests/mask_test.py
浏览文件 @
fa6e3334
...
...
@@ -11,13 +11,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
unittest
import
paddle
import
numpy
as
np
import
unittest
from
deepspeech.modules.mask
import
sequence_mask
import
paddle
from
deepspeech.modules.mask
import
make_non_pad_mask
from
deepspeech.modules.mask
import
make_pad_mask
from
deepspeech.modules.mask
import
sequence_mask
class
TestU2Model
(
unittest
.
TestCase
):
...
...
tests/u2_model_test.py
浏览文件 @
fa6e3334
...
...
@@ -11,11 +11,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
paddle
import
unittest
import
numpy
as
np
import
paddle
from
yacs.config
import
CfgNode
as
CN
from
deepspeech.models.u2
import
U2Model
...
...
utils/build_vocab.py
浏览文件 @
fa6e3334
...
...
@@ -14,20 +14,19 @@
"""Build vocabulary from manifest files.
Each item in vocabulary file is a character.
"""
import
argparse
import
functools
from
collections
import
Counter
import
os
import
tempfile
from
collections
import
Counter
from
deepspeech.frontend.utility
import
read_manifest
from
deepspeech.frontend.utility
import
UNK
from
deepspeech.frontend.featurizer.text_featurizer
import
TextFeaturizer
from
deepspeech.frontend.utility
import
BLANK
from
deepspeech.frontend.utility
import
read_manifest
from
deepspeech.frontend.utility
import
SOS
from
deepspeech.frontend.utility
import
UNK
from
deepspeech.utils.utility
import
add_arguments
from
deepspeech.utils.utility
import
print_arguments
from
deepspeech.frontend.featurizer.text_featurizer
import
TextFeaturizer
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
add_arg
=
functools
.
partial
(
add_arguments
,
argparser
=
parser
)
...
...
utils/compute_mean_std.py
浏览文件 @
fa6e3334
...
...
@@ -12,13 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Compute mean and std for feature normalizer, and save to file."""
import
argparse
import
functools
from
deepspeech.frontend.normalizer
import
FeatureNormalizer
from
deepspeech.frontend.augmentor.augmentation
import
AugmentationPipeline
from
deepspeech.frontend.featurizer.audio_featurizer
import
AudioFeaturizer
from
deepspeech.utils.utility
import
add_arguments
,
print_arguments
from
deepspeech.frontend.normalizer
import
FeatureNormalizer
from
deepspeech.utils.utility
import
add_arguments
from
deepspeech.utils.utility
import
print_arguments
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
add_arg
=
functools
.
partial
(
add_arguments
,
argparser
=
parser
)
...
...
utils/format_data.py
浏览文件 @
fa6e3334
...
...
@@ -16,11 +16,11 @@ import argparse
import
functools
import
json
from
deepspeech.frontend.
utility
import
read_manifest
from
deepspeech.frontend.
featurizer.text_featurizer
import
TextFeaturizer
from
deepspeech.frontend.utility
import
load_cmvn
from
deepspeech.frontend.utility
import
read_manifest
from
deepspeech.utils.utility
import
add_arguments
from
deepspeech.utils.utility
import
print_arguments
from
deepspeech.frontend.featurizer.text_featurizer
import
TextFeaturizer
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
add_arg
=
functools
.
partial
(
add_arguments
,
argparser
=
parser
)
...
...
utils/spm_decode
浏览文件 @
fa6e3334
...
...
@@ -4,8 +4,10 @@
#
# This source code is licensed under the license found in the
# https://github.com/pytorch/fairseq/blob/master/LICENSE
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
from
__future__
import
absolute_import
from
__future__
import
division
from
__future__
import
print_function
from
__future__
import
unicode_literals
import
argparse
import
sys
...
...
@@ -46,4 +48,4 @@ def main():
if
__name__
==
"__main__"
:
main
()
\ No newline at end of file
main
()
utils/spm_encode
浏览文件 @
fa6e3334
...
...
@@ -4,8 +4,10 @@
#
# This source code is licensed under the license found in
# https://github.com/pytorch/fairseq/blob/master/LICENSE
from
__future__
import
absolute_import
,
division
,
print_function
,
unicode_literals
from
__future__
import
absolute_import
from
__future__
import
division
from
__future__
import
print_function
from
__future__
import
unicode_literals
import
argparse
import
contextlib
...
...
@@ -96,4 +98,4 @@ def main():
if
__name__
==
"__main__"
:
main
()
\ No newline at end of file
main
()
utils/spm_train
浏览文件 @
fa6e3334
...
...
@@ -10,4 +10,4 @@ import sentencepiece as spm
if
__name__
==
"__main__"
:
spm
.
SentencePieceTrainer
.
Train
(
" "
.
join
(
sys
.
argv
[
1
:]))
\ No newline at end of file
spm
.
SentencePieceTrainer
.
Train
(
" "
.
join
(
sys
.
argv
[
1
:]))
utils/utility.py
浏览文件 @
fa6e3334
...
...
@@ -11,10 +11,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
os
import
tarfile
import
zipfile
from
paddle.dataset.common
import
md5file
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录