Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
b3c03d73
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
11 个月 前同步成功
通知
202
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,发现更多精彩内容 >>
未验证
提交
b3c03d73
编写于
1月 12, 2022
作者:
J
Jackwaterveg
提交者:
GitHub
1月 12, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1312 from Jackwaterveg/new_config
[CLI] st: unified config for st
上级
e7189b21
2728ec15
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
34 deletion
+34
-34
paddlespeech/cli/st/infer.py
paddlespeech/cli/st/infer.py
+15
-20
utils/generate_infer_yaml.py
utils/generate_infer_yaml.py
+19
-14
未找到文件。
paddlespeech/cli/st/infer.py
浏览文件 @
b3c03d73
...
...
@@ -40,11 +40,11 @@ __all__ = ["STExecutor"]
pretrained_models
=
{
"fat_st_ted-en-zh"
:
{
"url"
:
"https://paddlespeech.bj.bcebos.com/s2t/ted_en_zh/st1/
fat_st_ted-en-zh
.tar.gz"
,
"https://paddlespeech.bj.bcebos.com/s2t/ted_en_zh/st1/
st1_transformer_mtl_noam_ted-en-zh_ckpt_0.1.1.model
.tar.gz"
,
"md5"
:
"
fa0a7425b91b4f8d259c70b2aca5ae6
7"
,
"
d62063f35a16d91210a71081bd2dd55
7"
,
"cfg_path"
:
"
conf/transformer_mtl_noam
.yaml"
,
"
model
.yaml"
,
"ckpt_path"
:
"exp/transformer_mtl_noam/checkpoints/fat_st_ted-en-zh.pdparams"
,
}
...
...
@@ -170,24 +170,19 @@ class STExecutor(BaseExecutor):
#Init body.
self
.
config
=
CfgNode
(
new_allowed
=
True
)
self
.
config
.
merge_from_file
(
self
.
cfg_path
)
self
.
config
.
decod
ing
.
decoding_method
=
"fullsentence"
self
.
config
.
decod
e
.
decoding_method
=
"fullsentence"
with
UpdateConfig
(
self
.
config
):
self
.
config
.
collator
.
vocab_filepath
=
os
.
path
.
join
(
res_path
,
self
.
config
.
collator
.
vocab_filepath
)
self
.
config
.
collator
.
cmvn_path
=
os
.
path
.
join
(
res_path
,
self
.
config
.
collator
.
cmvn_path
)
self
.
config
.
collator
.
spm_model_prefix
=
os
.
path
.
join
(
res_path
,
self
.
config
.
collator
.
spm_model_prefix
)
self
.
config
.
cmvn_path
=
os
.
path
.
join
(
res_path
,
self
.
config
.
cmvn_path
)
self
.
config
.
spm_model_prefix
=
os
.
path
.
join
(
res_path
,
self
.
config
.
spm_model_prefix
)
self
.
text_feature
=
TextFeaturizer
(
unit_type
=
self
.
config
.
collator
.
unit_type
,
vocab
=
self
.
config
.
collator
.
vocab_filepath
,
spm_model_prefix
=
self
.
config
.
collator
.
spm_model_prefix
)
self
.
config
.
model
.
input_dim
=
self
.
config
.
collator
.
feat_dim
self
.
config
.
model
.
output_dim
=
self
.
text_feature
.
vocab_size
model_conf
=
self
.
config
.
model
logger
.
info
(
model_conf
)
unit_type
=
self
.
config
.
unit_type
,
vocab
=
self
.
config
.
vocab_filepath
,
spm_model_prefix
=
self
.
config
.
spm_model_prefix
)
model_conf
=
self
.
config
model_name
=
model_type
[:
model_type
.
rindex
(
'_'
)]
# model_type: {model_name}_{dataset}
model_class
=
dynamic_import
(
model_name
,
model_alias
)
...
...
@@ -218,7 +213,7 @@ class STExecutor(BaseExecutor):
logger
.
info
(
"Preprocess audio_file:"
+
audio_file
)
if
"fat_st"
in
model_type
:
cmvn
=
self
.
config
.
c
ollator
.
c
mvn_path
cmvn
=
self
.
config
.
cmvn_path
utt_name
=
"_tmp"
# Get the object for feature extraction
...
...
@@ -284,7 +279,7 @@ class STExecutor(BaseExecutor):
"""
Model inference and result stored in self.output.
"""
cfg
=
self
.
config
.
decod
ing
cfg
=
self
.
config
.
decod
e
audio
=
self
.
_inputs
[
"audio"
]
audio_len
=
self
.
_inputs
[
"audio_len"
]
if
model_type
==
"fat_st_ted"
:
...
...
utils/generate_infer_yaml.py
浏览文件 @
b3c03d73
...
...
@@ -67,21 +67,26 @@ def merge_configs(
config
=
load
(
conf_path
)
decode_config
=
load
(
decode_path
)
vocab_list
=
load_dict
(
vocab_path
)
cmvn_stats
=
load_json
(
cmvn_path
)
if
os
.
path
.
exists
(
preprocess_path
):
preprocess_config
=
load
(
preprocess_path
)
for
idx
,
process
in
enumerate
(
preprocess_config
[
"process"
]):
if
process
[
'type'
]
==
"cmvn_json"
:
preprocess_config
[
"process"
][
idx
][
"cmvn_path"
]
=
cmvn_stats
break
config
.
preprocess_config
=
preprocess_config
else
:
cmvn_stats
=
load_cmvn_from_json
(
cmvn_stats
)
config
.
mean_std_filepath
=
[{
"cmvn_stats"
:
cmvn_stats
}]
config
.
augmentation_config
=
''
# If use the kaldi feature, do not load the cmvn file
if
cmvn_path
.
split
(
"."
)[
-
1
]
==
'json'
:
cmvn_stats
=
load_json
(
cmvn_path
)
if
os
.
path
.
exists
(
preprocess_path
):
preprocess_config
=
load
(
preprocess_path
)
for
idx
,
process
in
enumerate
(
preprocess_config
[
"process"
]):
if
process
[
'type'
]
==
"cmvn_json"
:
preprocess_config
[
"process"
][
idx
][
"cmvn_path"
]
=
cmvn_stats
break
config
.
preprocess_config
=
preprocess_config
else
:
cmvn_stats
=
load_cmvn_from_json
(
cmvn_stats
)
config
.
mean_std_filepath
=
[{
"cmvn_stats"
:
cmvn_stats
}]
config
.
augmentation_config
=
''
# the cmvn file is end with .ark
else
:
config
.
cmvn_path
=
cmvn_path
# Updata the config
config
.
vocab_filepath
=
vocab_list
config
.
input_dim
=
config
.
feat_dim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录