Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
00029413
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看板
提交
00029413
编写于
11月 30, 2021
作者:
K
KP
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename s2t to asr.
上级
03f5c7a5
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
20 addition
and
21 deletion
+20
-21
paddlespeech/cli/README.md
paddlespeech/cli/README.md
+2
-2
paddlespeech/cli/__init__.py
paddlespeech/cli/__init__.py
+1
-1
paddlespeech/cli/asr/__init__.py
paddlespeech/cli/asr/__init__.py
+1
-1
paddlespeech/cli/asr/infer.py
paddlespeech/cli/asr/infer.py
+11
-15
paddlespeech/cli/entry.py
paddlespeech/cli/entry.py
+4
-1
paddlespeech/cli/executor.py
paddlespeech/cli/executor.py
+1
-1
paddlespeech/cli/tts/__init.__py
paddlespeech/cli/tts/__init.__py
+0
-0
未找到文件。
paddlespeech/cli/README.md
浏览文件 @
00029413
...
...
@@ -5,5 +5,5 @@
## Help
`paddlespeech help`
##
S2T
`paddlespeech
s2t --config ./s2t.yaml --input ./zh
.wav --device gpu`
##
ASR
`paddlespeech
asr --input ./test_audio
.wav --device gpu`
paddlespeech/cli/__init__.py
浏览文件 @
00029413
...
...
@@ -11,6 +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.
from
.asr
import
ASRExecutor
from
.base_commands
import
BaseCommand
from
.base_commands
import
HelpCommand
from
.s2t
import
S2TExecutor
paddlespeech/cli/
s2t
/__init__.py
→
paddlespeech/cli/
asr
/__init__.py
浏览文件 @
00029413
...
...
@@ -11,4 +11,4 @@
# 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
.infer
import
S2T
Executor
from
.infer
import
ASR
Executor
paddlespeech/cli/
s2t
/infer.py
→
paddlespeech/cli/
asr
/infer.py
浏览文件 @
00029413
...
...
@@ -33,7 +33,7 @@ from paddlespeech.s2t.transform.transformation import Transformation
from
paddlespeech.s2t.utils.dynamic_import
import
dynamic_import
from
paddlespeech.s2t.utils.utility
import
UpdateConfig
__all__
=
[
'
S2T
Executor'
]
__all__
=
[
'
ASR
Executor'
]
pretrained_models
=
{
"wenetspeech_zh"
:
{
...
...
@@ -58,13 +58,15 @@ model_alias = {
@
cli_register
(
name
=
'paddlespeech.
s2t
'
,
description
=
'Speech to text infer command.'
)
class
S2T
Executor
(
BaseExecutor
):
name
=
'paddlespeech.
asr
'
,
description
=
'Speech to text infer command.'
)
class
ASR
Executor
(
BaseExecutor
):
def
__init__
(
self
):
super
(
S2T
Executor
,
self
).
__init__
()
super
(
ASR
Executor
,
self
).
__init__
()
self
.
parser
=
argparse
.
ArgumentParser
(
prog
=
'paddlespeech.s2t'
,
add_help
=
True
)
prog
=
'paddlespeech.asr'
,
add_help
=
True
)
self
.
parser
.
add_argument
(
'--input'
,
type
=
str
,
required
=
True
,
help
=
'Audio file to recognize.'
)
self
.
parser
.
add_argument
(
'--model'
,
type
=
str
,
...
...
@@ -76,16 +78,12 @@ class S2TExecutor(BaseExecutor):
'--config'
,
type
=
str
,
default
=
None
,
help
=
'Config of
s2t
task. Use deault config when it is None.'
)
help
=
'Config of
asr
task. Use deault config when it is None.'
)
self
.
parser
.
add_argument
(
'--ckpt_path'
,
type
=
str
,
default
=
None
,
help
=
'Checkpoint file of model.'
)
self
.
parser
.
add_argument
(
'--input'
,
type
=
str
,
help
=
'Audio file to recognize.'
)
self
.
parser
.
add_argument
(
'--device'
,
type
=
str
,
...
...
@@ -178,13 +176,12 @@ class S2TExecutor(BaseExecutor):
def
preprocess
(
self
,
input
:
Union
[
str
,
os
.
PathLike
]):
"""
Input preprocess and return paddle.Tensor stored in self.input.
Input content can be a text(t
2s), a file(s2t
, cls) or a streaming(not supported yet).
Input content can be a text(t
ts), a file(asr
, cls) or a streaming(not supported yet).
"""
parser_args
=
self
.
parser_args
config
=
self
.
config
audio_file
=
input
#print("audio_file", audio_file)
logger
.
info
(
"audio_file"
+
audio_file
)
self
.
sr
=
config
.
collator
.
target_sample_rate
...
...
@@ -290,7 +287,6 @@ class S2TExecutor(BaseExecutor):
Command line entry.
"""
self
.
parser_args
=
self
.
parser
.
parse_args
(
argv
)
print
(
self
.
parser_args
)
model
=
self
.
parser_args
.
model
lang
=
self
.
parser_args
.
lang
...
...
@@ -301,7 +297,7 @@ class S2TExecutor(BaseExecutor):
try
:
res
=
self
(
model
,
lang
,
config
,
ckpt_path
,
audio_file
,
device
)
print
(
res
)
logger
.
info
(
'ASR Result: {}'
.
format
(
res
)
)
return
True
except
Exception
as
e
:
print
(
e
)
...
...
@@ -314,6 +310,6 @@ class S2TExecutor(BaseExecutor):
self
.
_init_from_path
(
model
,
lang
,
config
,
ckpt_path
)
self
.
preprocess
(
audio_file
)
self
.
infer
()
res
=
self
.
postprocess
()
# Retrieve result of
s2t
.
res
=
self
.
postprocess
()
# Retrieve result of
asr
.
return
res
paddlespeech/cli/entry.py
浏览文件 @
00029413
...
...
@@ -23,9 +23,12 @@ def _CommandDict():
def
_execute
():
com
=
commands
for
idx
,
_argv
in
enumerate
([
'paddlespeech'
]
+
sys
.
argv
[
1
:]):
idx
=
0
for
_argv
in
([
'paddlespeech'
]
+
sys
.
argv
[
1
:]):
if
_argv
not
in
com
:
break
idx
+=
1
com
=
com
[
_argv
]
# The method 'execute' of a command instance returns 'True' for a success
...
...
paddlespeech/cli/executor.py
浏览文件 @
00029413
...
...
@@ -47,7 +47,7 @@ class BaseExecutor(ABC):
def
preprocess
(
self
,
input
:
Union
[
str
,
os
.
PathLike
]):
"""
Input preprocess and return paddle.Tensor stored in self.input.
Input content can be a text(t
2s), a file(s2t
, cls) or a streaming(not supported yet).
Input content can be a text(t
ts), a file(asr
, cls) or a streaming(not supported yet).
"""
pass
...
...
paddlespeech/cli/t
2
s/__init.__py
→
paddlespeech/cli/t
t
s/__init.__py
浏览文件 @
00029413
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录