Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
1f5f34a8
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 2 年 前同步成功
通知
210
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看板
未验证
提交
1f5f34a8
编写于
6月 08, 2022
作者:
H
Hui Zhang
提交者:
GitHub
6月 08, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2016 from Jackwaterveg/develop_dev
[ASR] Support editing num_decode_left_chunks in cli and server
上级
894edf05
6ebe4765
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
23 addition
and
4 deletion
+23
-4
demos/streaming_asr_server/conf/ws_conformer_application.yaml
...s/streaming_asr_server/conf/ws_conformer_application.yaml
+1
-0
demos/streaming_asr_server/conf/ws_conformer_wenetspeech_application.yaml
...asr_server/conf/ws_conformer_wenetspeech_application.yaml
+1
-1
demos/streaming_asr_server/conf/ws_ds2_application.yaml
demos/streaming_asr_server/conf/ws_ds2_application.yaml
+1
-0
paddlespeech/cli/asr/infer.py
paddlespeech/cli/asr/infer.py
+11
-1
paddlespeech/server/conf/ws_application.yaml
paddlespeech/server/conf/ws_application.yaml
+1
-0
paddlespeech/server/conf/ws_conformer_application.yaml
paddlespeech/server/conf/ws_conformer_application.yaml
+2
-1
paddlespeech/server/engine/asr/online/asr_engine.py
paddlespeech/server/engine/asr/online/asr_engine.py
+6
-1
未找到文件。
demos/streaming_asr_server/conf/ws_conformer_application.yaml
浏览文件 @
1f5f34a8
...
@@ -28,6 +28,7 @@ asr_online:
...
@@ -28,6 +28,7 @@ asr_online:
sample_rate
:
16000
sample_rate
:
16000
cfg_path
:
cfg_path
:
decode_method
:
decode_method
:
num_decoding_left_chunks
:
-1
force_yes
:
True
force_yes
:
True
device
:
'
cpu'
# cpu or gpu:id
device
:
'
cpu'
# cpu or gpu:id
decode_method
:
"
attention_rescoring"
decode_method
:
"
attention_rescoring"
...
...
demos/streaming_asr_server/conf/ws_conformer_wenetspeech_application.yaml
浏览文件 @
1f5f34a8
...
@@ -32,7 +32,7 @@ asr_online:
...
@@ -32,7 +32,7 @@ asr_online:
device
:
'
cpu'
# cpu or gpu:id
device
:
'
cpu'
# cpu or gpu:id
decode_method
:
"
attention_rescoring"
decode_method
:
"
attention_rescoring"
continuous_decoding
:
True
# enable continue decoding when endpoint detected
continuous_decoding
:
True
# enable continue decoding when endpoint detected
num_decoding_left_chunks
:
-1
am_predictor_conf
:
am_predictor_conf
:
device
:
# set 'gpu:id' or 'cpu'
device
:
# set 'gpu:id' or 'cpu'
switch_ir_optim
:
True
switch_ir_optim
:
True
...
...
demos/streaming_asr_server/conf/ws_ds2_application.yaml
浏览文件 @
1f5f34a8
...
@@ -28,6 +28,7 @@ asr_online:
...
@@ -28,6 +28,7 @@ asr_online:
sample_rate
:
16000
sample_rate
:
16000
cfg_path
:
cfg_path
:
decode_method
:
decode_method
:
num_decoding_left_chunks
:
force_yes
:
True
force_yes
:
True
device
:
'
cpu'
# cpu or gpu:id
device
:
'
cpu'
# cpu or gpu:id
...
...
paddlespeech/cli/asr/infer.py
浏览文件 @
1f5f34a8
...
@@ -83,6 +83,12 @@ class ASRExecutor(BaseExecutor):
...
@@ -83,6 +83,12 @@ class ASRExecutor(BaseExecutor):
'attention_rescoring'
'attention_rescoring'
],
],
help
=
'only support transformer and conformer model'
)
help
=
'only support transformer and conformer model'
)
self
.
parser
.
add_argument
(
'--num_decoding_left_chunks'
,
'-num_left'
,
type
=
str
,
default
=-
1
,
help
=
'only support transformer and conformer model'
)
self
.
parser
.
add_argument
(
self
.
parser
.
add_argument
(
'--ckpt_path'
,
'--ckpt_path'
,
type
=
str
,
type
=
str
,
...
@@ -122,6 +128,7 @@ class ASRExecutor(BaseExecutor):
...
@@ -122,6 +128,7 @@ class ASRExecutor(BaseExecutor):
sample_rate
:
int
=
16000
,
sample_rate
:
int
=
16000
,
cfg_path
:
Optional
[
os
.
PathLike
]
=
None
,
cfg_path
:
Optional
[
os
.
PathLike
]
=
None
,
decode_method
:
str
=
'attention_rescoring'
,
decode_method
:
str
=
'attention_rescoring'
,
num_decoding_left_chunks
:
int
=-
1
,
ckpt_path
:
Optional
[
os
.
PathLike
]
=
None
):
ckpt_path
:
Optional
[
os
.
PathLike
]
=
None
):
"""
"""
Init model and other resources from a specific path.
Init model and other resources from a specific path.
...
@@ -129,6 +136,7 @@ class ASRExecutor(BaseExecutor):
...
@@ -129,6 +136,7 @@ class ASRExecutor(BaseExecutor):
logger
.
info
(
"start to init the model"
)
logger
.
info
(
"start to init the model"
)
# default max_len: unit:second
# default max_len: unit:second
self
.
max_len
=
50
self
.
max_len
=
50
assert
num_decoding_left_chunks
==
-
1
or
num_decoding_left_chunks
>=
0
if
hasattr
(
self
,
'model'
):
if
hasattr
(
self
,
'model'
):
logger
.
info
(
'Model had been initialized.'
)
logger
.
info
(
'Model had been initialized.'
)
return
return
...
@@ -179,6 +187,7 @@ class ASRExecutor(BaseExecutor):
...
@@ -179,6 +187,7 @@ class ASRExecutor(BaseExecutor):
elif
"conformer"
in
model_type
or
"transformer"
in
model_type
:
elif
"conformer"
in
model_type
or
"transformer"
in
model_type
:
self
.
config
.
decode
.
decoding_method
=
decode_method
self
.
config
.
decode
.
decoding_method
=
decode_method
self
.
config
.
num_decoding_left_chunks
=
num_decoding_left_chunks
else
:
else
:
raise
Exception
(
"wrong type"
)
raise
Exception
(
"wrong type"
)
...
@@ -451,6 +460,7 @@ class ASRExecutor(BaseExecutor):
...
@@ -451,6 +460,7 @@ class ASRExecutor(BaseExecutor):
config
:
os
.
PathLike
=
None
,
config
:
os
.
PathLike
=
None
,
ckpt_path
:
os
.
PathLike
=
None
,
ckpt_path
:
os
.
PathLike
=
None
,
decode_method
:
str
=
'attention_rescoring'
,
decode_method
:
str
=
'attention_rescoring'
,
num_decoding_left_chunks
:
int
=-
1
,
force_yes
:
bool
=
False
,
force_yes
:
bool
=
False
,
rtf
:
bool
=
False
,
rtf
:
bool
=
False
,
device
=
paddle
.
get_device
()):
device
=
paddle
.
get_device
()):
...
@@ -460,7 +470,7 @@ class ASRExecutor(BaseExecutor):
...
@@ -460,7 +470,7 @@ class ASRExecutor(BaseExecutor):
audio_file
=
os
.
path
.
abspath
(
audio_file
)
audio_file
=
os
.
path
.
abspath
(
audio_file
)
paddle
.
set_device
(
device
)
paddle
.
set_device
(
device
)
self
.
_init_from_path
(
model
,
lang
,
sample_rate
,
config
,
decode_method
,
self
.
_init_from_path
(
model
,
lang
,
sample_rate
,
config
,
decode_method
,
ckpt_path
)
num_decoding_left_chunks
,
ckpt_path
)
if
not
self
.
_check
(
audio_file
,
sample_rate
,
force_yes
):
if
not
self
.
_check
(
audio_file
,
sample_rate
,
force_yes
):
sys
.
exit
(
-
1
)
sys
.
exit
(
-
1
)
if
rtf
:
if
rtf
:
...
...
paddlespeech/server/conf/ws_application.yaml
浏览文件 @
1f5f34a8
...
@@ -28,6 +28,7 @@ asr_online:
...
@@ -28,6 +28,7 @@ asr_online:
sample_rate
:
16000
sample_rate
:
16000
cfg_path
:
cfg_path
:
decode_method
:
decode_method
:
num_decoding_left_chunks
:
force_yes
:
True
force_yes
:
True
device
:
# cpu or gpu:id
device
:
# cpu or gpu:id
...
...
paddlespeech/server/conf/ws_conformer_application.yaml
浏览文件 @
1f5f34a8
...
@@ -28,6 +28,7 @@ asr_online:
...
@@ -28,6 +28,7 @@ asr_online:
sample_rate
:
16000
sample_rate
:
16000
cfg_path
:
cfg_path
:
decode_method
:
decode_method
:
num_decoding_left_chunks
:
-1
force_yes
:
True
force_yes
:
True
device
:
# cpu or gpu:id
device
:
# cpu or gpu:id
continuous_decoding
:
True
# enable continue decoding when endpoint detected
continuous_decoding
:
True
# enable continue decoding when endpoint detected
...
@@ -44,4 +45,4 @@ asr_online:
...
@@ -44,4 +45,4 @@ asr_online:
window_ms
:
25
# ms
window_ms
:
25
# ms
shift_ms
:
10
# ms
shift_ms
:
10
# ms
sample_rate
:
16000
sample_rate
:
16000
sample_width
:
2
sample_width
:
2
\ No newline at end of file
paddlespeech/server/engine/asr/online/asr_engine.py
浏览文件 @
1f5f34a8
...
@@ -705,6 +705,7 @@ class ASRServerExecutor(ASRExecutor):
...
@@ -705,6 +705,7 @@ class ASRServerExecutor(ASRExecutor):
sample_rate
:
int
=
16000
,
sample_rate
:
int
=
16000
,
cfg_path
:
Optional
[
os
.
PathLike
]
=
None
,
cfg_path
:
Optional
[
os
.
PathLike
]
=
None
,
decode_method
:
str
=
'attention_rescoring'
,
decode_method
:
str
=
'attention_rescoring'
,
num_decoding_left_chunks
:
int
=-
1
,
am_predictor_conf
:
dict
=
None
):
am_predictor_conf
:
dict
=
None
):
"""
"""
Init model and other resources from a specific path.
Init model and other resources from a specific path.
...
@@ -790,7 +791,10 @@ class ASRServerExecutor(ASRExecutor):
...
@@ -790,7 +791,10 @@ class ASRServerExecutor(ASRExecutor):
# update the decoding method
# update the decoding method
if
decode_method
:
if
decode_method
:
self
.
config
.
decode
.
decoding_method
=
decode_method
self
.
config
.
decode
.
decoding_method
=
decode_method
# update num_decoding_left_chunks
if
num_decoding_left_chunks
:
self
.
config
.
decode
.
num_decoding_left_chunks
=
num_decoding_left_chunks
assert
self
.
config
.
decode
.
num_decoding_left_chunks
==
-
1
or
self
.
config
.
decode
.
num_decoding_left_chunks
>=
0
,
f
"num_decoding_left_chunks should be -1 or >=0"
# we only support ctc_prefix_beam_search and attention_rescoring dedoding method
# we only support ctc_prefix_beam_search and attention_rescoring dedoding method
# Generally we set the decoding_method to attention_rescoring
# Generally we set the decoding_method to attention_rescoring
if
self
.
config
.
decode
.
decoding_method
not
in
[
if
self
.
config
.
decode
.
decoding_method
not
in
[
...
@@ -864,6 +868,7 @@ class ASREngine(BaseEngine):
...
@@ -864,6 +868,7 @@ class ASREngine(BaseEngine):
sample_rate
=
self
.
config
.
sample_rate
,
sample_rate
=
self
.
config
.
sample_rate
,
cfg_path
=
self
.
config
.
cfg_path
,
cfg_path
=
self
.
config
.
cfg_path
,
decode_method
=
self
.
config
.
decode_method
,
decode_method
=
self
.
config
.
decode_method
,
num_decoding_left_chunks
=
self
.
config
.
num_decoding_left_chunks
,
am_predictor_conf
=
self
.
config
.
am_predictor_conf
):
am_predictor_conf
=
self
.
config
.
am_predictor_conf
):
logger
.
error
(
logger
.
error
(
"Init the ASR server occurs error, please check the server configuration yaml"
"Init the ASR server occurs error, please check the server configuration yaml"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录