Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
9dace625
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 1 年 前同步成功
通知
206
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9dace625
编写于
8月 19, 2021
作者:
H
Hui Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix augmentation
上级
0ab299a8
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
29 addition
and
116 deletion
+29
-116
deepspeech/exps/u2_kaldi/bin/alignment.py
deepspeech/exps/u2_kaldi/bin/alignment.py
+0
-54
deepspeech/exps/u2_kaldi/bin/export.py
deepspeech/exps/u2_kaldi/bin/export.py
+0
-48
deepspeech/exps/u2_kaldi/bin/test.py
deepspeech/exps/u2_kaldi/bin/test.py
+14
-3
deepspeech/exps/u2_kaldi/bin/train.py
deepspeech/exps/u2_kaldi/bin/train.py
+2
-2
deepspeech/frontend/augmentor/augmentation.py
deepspeech/frontend/augmentor/augmentation.py
+7
-7
examples/librispeech/s2/local/align.sh
examples/librispeech/s2/local/align.sh
+2
-1
examples/librispeech/s2/local/export.sh
examples/librispeech/s2/local/export.sh
+2
-1
examples/librispeech/s2/local/test.sh
examples/librispeech/s2/local/test.sh
+2
-0
未找到文件。
deepspeech/exps/u2_kaldi/bin/alignment.py
已删除
100644 → 0
浏览文件 @
0ab299a8
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.
"""Alignment for U2 model."""
from
deepspeech.exps.u2.model
import
get_cfg_defaults
from
deepspeech.exps.u2.model
import
U2Tester
as
Tester
from
deepspeech.training.cli
import
default_argument_parser
from
deepspeech.utils.dynamic_import
import
dynamic_import
from
deepspeech.utils.utility
import
print_arguments
def
main_sp
(
config
,
args
):
exp
=
Tester
(
config
,
args
)
exp
.
setup
()
exp
.
run_align
()
def
main
(
config
,
args
):
main_sp
(
config
,
args
)
if
__name__
==
"__main__"
:
parser
=
default_argument_parser
()
parser
.
add_arguments
(
'--model-name'
,
type
=
str
,
default
=
'u2'
,
help
=
'model name, e.g: deepspeech2, u2, u2_kaldi, u2_st'
)
args
=
parser
.
parse_args
()
print_arguments
(
args
,
globals
())
# https://yaml.org/type/float.html
config
=
get_cfg_defaults
()
if
args
.
config
:
config
.
merge_from_file
(
args
.
config
)
if
args
.
opts
:
config
.
merge_from_list
(
args
.
opts
)
config
.
freeze
()
print
(
config
)
if
args
.
dump_config
:
with
open
(
args
.
dump_config
,
'w'
)
as
f
:
print
(
config
,
file
=
f
)
main
(
config
,
args
)
deepspeech/exps/u2_kaldi/bin/export.py
已删除
100644 → 0
浏览文件 @
0ab299a8
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.
"""Export for U2 model."""
from
deepspeech.exps.u2.model
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
):
exp
=
Tester
(
config
,
args
)
exp
.
setup
()
exp
.
run_export
()
def
main
(
config
,
args
):
main_sp
(
config
,
args
)
if
__name__
==
"__main__"
:
parser
=
default_argument_parser
()
args
=
parser
.
parse_args
()
print_arguments
(
args
,
globals
())
# https://yaml.org/type/float.html
config
=
get_cfg_defaults
()
if
args
.
config
:
config
.
merge_from_file
(
args
.
config
)
if
args
.
opts
:
config
.
merge_from_list
(
args
.
opts
)
config
.
freeze
()
print
(
config
)
if
args
.
dump_config
:
with
open
(
args
.
dump_config
,
'w'
)
as
f
:
print
(
config
,
file
=
f
)
main
(
config
,
args
)
deepspeech/exps/u2_kaldi/bin/test.py
浏览文件 @
9dace625
...
...
@@ -18,17 +18,23 @@ from deepspeech.training.cli import default_argument_parser
from
deepspeech.utils.dynamic_import
import
dynamic_import
from
deepspeech.utils.utility
import
print_arguments
model_alias
=
{
model_
test_
alias
=
{
"u2"
:
"deepspeech.exps.u2.model:U2Tester"
,
"u2_kaldi"
:
"deepspeech.exps.u2_kaldi.model:U2Tester"
,
}
def
main_sp
(
config
,
args
):
class_obj
=
dynamic_import
(
args
.
model_name
,
model_alias
)
class_obj
=
dynamic_import
(
args
.
model_name
,
model_
test_
alias
)
exp
=
class_obj
(
config
,
args
)
exp
.
setup
()
exp
.
run_test
()
if
args
.
run_mode
==
'test'
:
exp
.
run_test
()
elif
args
.
run_mode
==
'export'
:
exp
.
run_export
()
elif
args
.
run_mode
==
'align'
:
exp
.
run_align
()
def
main
(
config
,
args
):
...
...
@@ -42,6 +48,11 @@ if __name__ == "__main__":
type
=
str
,
default
=
'u2_kaldi'
,
help
=
'model name, e.g: deepspeech2, u2, u2_kaldi, u2_st'
)
parser
.
add_argument
(
'--run-mode'
,
type
=
str
,
default
=
'test'
,
help
=
'run mode, e.g. test, align, export'
)
args
=
parser
.
parse_args
()
print_arguments
(
args
,
globals
())
...
...
deepspeech/exps/u2_kaldi/bin/train.py
浏览文件 @
9dace625
...
...
@@ -22,14 +22,14 @@ from deepspeech.training.cli import default_argument_parser
from
deepspeech.utils.dynamic_import
import
dynamic_import
from
deepspeech.utils.utility
import
print_arguments
model_alias
=
{
model_
train_
alias
=
{
"u2"
:
"deepspeech.exps.u2.model:U2Trainer"
,
"u2_kaldi"
:
"deepspeech.exps.u2_kaldi.model:U2Trainer"
,
}
def
main_sp
(
config
,
args
):
class_obj
=
dynamic_import
(
args
.
model_name
,
model_alias
)
class_obj
=
dynamic_import
(
args
.
model_name
,
model_
train_
alias
)
exp
=
class_obj
(
config
,
args
)
exp
.
setup
()
exp
.
run
()
...
...
deepspeech/frontend/augmentor/augmentation.py
浏览文件 @
9dace625
...
...
@@ -97,14 +97,14 @@ class AugmentationPipeline():
ValueError: If the augmentation json config is in incorrect format".
"""
SPEC_TYPES
=
(
'specaug'
)
def
__init__
(
self
,
augmentation_config
:
str
,
random_seed
:
int
=
0
):
self
.
_rng
=
np
.
random
.
RandomState
(
random_seed
)
self
.
_spec_types
=
(
'specaug'
)
if
augmentation_config
is
None
:
self
.
conf
=
{}
else
:
self
.
conf
=
json
.
loads
(
augmentation_config
)
self
.
conf
=
{
'mode'
:
'sequential'
,
'process'
:
[]}
if
augmentation_config
:
process
=
json
.
loads
(
augmentation_config
)
self
.
conf
[
'process'
]
+=
process
self
.
_augmentors
,
self
.
_rates
=
self
.
_parse_pipeline_from
(
'all'
)
self
.
_audio_augmentors
,
self
.
_audio_rates
=
self
.
_parse_pipeline_from
(
...
...
@@ -188,7 +188,7 @@ class AugmentationPipeline():
all_confs
=
[]
for
config
in
self
.
conf
:
all_confs
.
append
(
config
)
if
config
[
"type"
]
in
self
.
_spec_types
:
if
config
[
"type"
]
in
self
.
SPEC_TYPES
:
feature_confs
.
append
(
config
)
else
:
audio_confs
.
append
(
config
)
...
...
examples/librispeech/s2/local/align.sh
浏览文件 @
9dace625
...
...
@@ -21,7 +21,8 @@ mkdir -p ${output_dir}
# align dump in `result_file`
# .tier, .TextGrid dump in `dir of result_file`
python3
-u
${
BIN_DIR
}
/alignment.py
\
python3
-u
${
BIN_DIR
}
/test.py
\
--run_mode
'align'
\
--device
${
device
}
\
--nproc
1
\
--config
${
config_path
}
\
...
...
examples/librispeech/s2/local/export.sh
浏览文件 @
9dace625
...
...
@@ -17,7 +17,8 @@ if [ ${ngpu} == 0 ];then
device
=
cpu
fi
python3
-u
${
BIN_DIR
}
/export.py
\
python3
-u
${
BIN_DIR
}
/test.py
\
--run_mode
'export'
\
--device
${
device
}
\
--nproc
${
ngpu
}
\
--config
${
config_path
}
\
...
...
examples/librispeech/s2/local/test.sh
浏览文件 @
9dace625
...
...
@@ -38,6 +38,7 @@ for type in attention ctc_greedy_search; do
batch_size
=
64
fi
python3
-u
${
BIN_DIR
}
/test.py
\
--run_mode
test
\
--device
${
device
}
\
--nproc
1
\
--config
${
config_path
}
\
...
...
@@ -55,6 +56,7 @@ for type in ctc_prefix_beam_search attention_rescoring; do
echo
"decoding
${
type
}
"
batch_size
=
1
python3
-u
${
BIN_DIR
}
/test.py
\
--run_mode
test
\
--device
${
device
}
\
--nproc
1
\
--config
${
config_path
}
\
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录