Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
39228864
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看板
提交
39228864
编写于
11月 30, 2021
作者:
H
Hui Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
format code
上级
d395c2b8
变更
20
显示空白变更内容
内联
并排
Showing
20 changed file
with
51 addition
and
32 deletion
+51
-32
examples/aishell/asr1/READEME.md
examples/aishell/asr1/READEME.md
+0
-3
paddlespeech/s2t/exps/u2/model.py
paddlespeech/s2t/exps/u2/model.py
+6
-4
paddlespeech/s2t/exps/u2_kaldi/model.py
paddlespeech/s2t/exps/u2_kaldi/model.py
+7
-4
paddlespeech/s2t/exps/u2_st/model.py
paddlespeech/s2t/exps/u2_st/model.py
+7
-4
paddlespeech/s2t/frontend/augmentor/impulse_response.py
paddlespeech/s2t/frontend/augmentor/impulse_response.py
+1
-0
paddlespeech/s2t/frontend/augmentor/noise_perturb.py
paddlespeech/s2t/frontend/augmentor/noise_perturb.py
+1
-0
paddlespeech/s2t/frontend/normalizer.py
paddlespeech/s2t/frontend/normalizer.py
+4
-2
paddlespeech/s2t/frontend/utility.py
paddlespeech/s2t/frontend/utility.py
+1
-1
paddlespeech/s2t/io/dataloader.py
paddlespeech/s2t/io/dataloader.py
+2
-2
paddlespeech/s2t/io/dataset.py
paddlespeech/s2t/io/dataset.py
+1
-0
paddlespeech/s2t/io/sampler.py
paddlespeech/s2t/io/sampler.py
+1
-1
paddlespeech/s2t/training/trainer.py
paddlespeech/s2t/training/trainer.py
+4
-2
paddlespeech/s2t/utils/socket_server.py
paddlespeech/s2t/utils/socket_server.py
+1
-0
paddlespeech/text/speechtask/punctuation_restoration/training/trainer.py
...xt/speechtask/punctuation_restoration/training/trainer.py
+4
-2
utils/build_vocab.py
utils/build_vocab.py
+4
-3
utils/dump_manifest.py
utils/dump_manifest.py
+2
-1
utils/format_data.py
utils/format_data.py
+3
-2
utils/format_triplet_data.py
utils/format_triplet_data.py
+1
-0
utils/manifest_key_value.py
utils/manifest_key_value.py
+1
-0
utils/utility.py
utils/utility.py
+0
-1
未找到文件。
examples/aishell/asr1/READEME.md
浏览文件 @
39228864
...
@@ -339,6 +339,3 @@ You need to prepare an audio file, please confirm the sample rate of the audio i
...
@@ -339,6 +339,3 @@ You need to prepare an audio file, please confirm the sample rate of the audio i
```
bash
```
bash
CUDA_VISIBLE_DEVICES= ./local/test_hub.sh conf/transformer.yaml exp/transformer/checkpoints/avg_20 data/test_audio.wav
CUDA_VISIBLE_DEVICES= ./local/test_hub.sh conf/transformer.yaml exp/transformer/checkpoints/avg_20 data/test_audio.wav
```
```
paddlespeech/s2t/exps/u2/model.py
浏览文件 @
39228864
...
@@ -129,8 +129,8 @@ class U2Trainer(Trainer):
...
@@ -129,8 +129,8 @@ class U2Trainer(Trainer):
losses_np_v
=
losses_np
.
copy
()
losses_np_v
=
losses_np
.
copy
()
losses_np_v
.
update
({
"lr"
:
self
.
lr_scheduler
()})
losses_np_v
.
update
({
"lr"
:
self
.
lr_scheduler
()})
for
key
,
val
in
losses_np_v
.
items
():
for
key
,
val
in
losses_np_v
.
items
():
self
.
visualizer
.
add_scalar
(
tag
=
'train/'
+
key
,
value
=
val
,
step
=
self
.
iteration
-
1
)
self
.
visualizer
.
add_scalar
(
tag
=
'train/'
+
key
,
value
=
val
,
step
=
self
.
iteration
-
1
)
@
paddle
.
no_grad
()
@
paddle
.
no_grad
()
def
valid
(
self
):
def
valid
(
self
):
...
@@ -238,8 +238,10 @@ class U2Trainer(Trainer):
...
@@ -238,8 +238,10 @@ class U2Trainer(Trainer):
logger
.
info
(
logger
.
info
(
'Epoch {} Val info val_loss {}'
.
format
(
self
.
epoch
,
cv_loss
))
'Epoch {} Val info val_loss {}'
.
format
(
self
.
epoch
,
cv_loss
))
if
self
.
visualizer
:
if
self
.
visualizer
:
self
.
visualizer
.
add_scalar
(
tag
=
'eval/cv_loss'
,
value
=
cv_loss
,
step
=
self
.
epoch
)
self
.
visualizer
.
add_scalar
(
self
.
visualizer
.
add_scalar
(
tag
=
'eval/lr'
,
value
=
self
.
lr_scheduler
(),
step
=
self
.
epoch
)
tag
=
'eval/cv_loss'
,
value
=
cv_loss
,
step
=
self
.
epoch
)
self
.
visualizer
.
add_scalar
(
tag
=
'eval/lr'
,
value
=
self
.
lr_scheduler
(),
step
=
self
.
epoch
)
self
.
save
(
tag
=
self
.
epoch
,
infos
=
{
'val_loss'
:
cv_loss
})
self
.
save
(
tag
=
self
.
epoch
,
infos
=
{
'val_loss'
:
cv_loss
})
self
.
new_epoch
()
self
.
new_epoch
()
...
...
paddlespeech/s2t/exps/u2_kaldi/model.py
浏览文件 @
39228864
...
@@ -132,7 +132,8 @@ class U2Trainer(Trainer):
...
@@ -132,7 +132,8 @@ class U2Trainer(Trainer):
losses_np_v
=
losses_np
.
copy
()
losses_np_v
=
losses_np
.
copy
()
losses_np_v
.
update
({
"lr"
:
self
.
lr_scheduler
()})
losses_np_v
.
update
({
"lr"
:
self
.
lr_scheduler
()})
for
key
,
val
in
losses_np_v
.
items
():
for
key
,
val
in
losses_np_v
.
items
():
self
.
visualizer
.
add_scalar
(
tag
=
"train/"
+
key
,
value
=
val
,
step
=
self
.
iteration
-
1
)
self
.
visualizer
.
add_scalar
(
tag
=
"train/"
+
key
,
value
=
val
,
step
=
self
.
iteration
-
1
)
@
paddle
.
no_grad
()
@
paddle
.
no_grad
()
def
valid
(
self
):
def
valid
(
self
):
...
@@ -222,8 +223,10 @@ class U2Trainer(Trainer):
...
@@ -222,8 +223,10 @@ class U2Trainer(Trainer):
logger
.
info
(
logger
.
info
(
'Epoch {} Val info val_loss {}'
.
format
(
self
.
epoch
,
cv_loss
))
'Epoch {} Val info val_loss {}'
.
format
(
self
.
epoch
,
cv_loss
))
if
self
.
visualizer
:
if
self
.
visualizer
:
self
.
visualizer
.
add_scalar
(
tag
=
'eval/cv_loss'
,
value
=
cv_loss
,
step
=
self
.
epoch
)
self
.
visualizer
.
add_scalar
(
self
.
visualizer
.
add_scalar
(
tag
=
'eval/lr'
,
value
=
self
.
lr_scheduler
(),
step
=
self
.
epoch
)
tag
=
'eval/cv_loss'
,
value
=
cv_loss
,
step
=
self
.
epoch
)
self
.
visualizer
.
add_scalar
(
tag
=
'eval/lr'
,
value
=
self
.
lr_scheduler
(),
step
=
self
.
epoch
)
self
.
save
(
tag
=
self
.
epoch
,
infos
=
{
'val_loss'
:
cv_loss
})
self
.
save
(
tag
=
self
.
epoch
,
infos
=
{
'val_loss'
:
cv_loss
})
self
.
new_epoch
()
self
.
new_epoch
()
...
...
paddlespeech/s2t/exps/u2_st/model.py
浏览文件 @
39228864
...
@@ -139,7 +139,8 @@ class U2STTrainer(Trainer):
...
@@ -139,7 +139,8 @@ class U2STTrainer(Trainer):
losses_np_v
=
losses_np
.
copy
()
losses_np_v
=
losses_np
.
copy
()
losses_np_v
.
update
({
"lr"
:
self
.
lr_scheduler
()})
losses_np_v
.
update
({
"lr"
:
self
.
lr_scheduler
()})
for
key
,
val
in
losses_np_v
.
items
():
for
key
,
val
in
losses_np_v
.
items
():
self
.
visualizer
.
add_scalar
(
tag
=
"train/"
+
key
,
value
=
val
,
step
=
self
.
iteration
-
1
)
self
.
visualizer
.
add_scalar
(
tag
=
"train/"
+
key
,
value
=
val
,
step
=
self
.
iteration
-
1
)
@
paddle
.
no_grad
()
@
paddle
.
no_grad
()
def
valid
(
self
):
def
valid
(
self
):
...
@@ -235,8 +236,10 @@ class U2STTrainer(Trainer):
...
@@ -235,8 +236,10 @@ class U2STTrainer(Trainer):
logger
.
info
(
logger
.
info
(
'Epoch {} Val info val_loss {}'
.
format
(
self
.
epoch
,
cv_loss
))
'Epoch {} Val info val_loss {}'
.
format
(
self
.
epoch
,
cv_loss
))
if
self
.
visualizer
:
if
self
.
visualizer
:
self
.
visualizer
.
add_scalar
(
tag
=
'eval/cv_loss'
,
value
=
cv_loss
,
step
=
self
.
epoch
)
self
.
visualizer
.
add_scalar
(
self
.
visualizer
.
add_scalar
(
tag
=
'eval/lr'
,
value
=
self
.
lr_scheduler
(),
step
=
self
.
epoch
)
tag
=
'eval/cv_loss'
,
value
=
cv_loss
,
step
=
self
.
epoch
)
self
.
visualizer
.
add_scalar
(
tag
=
'eval/lr'
,
value
=
self
.
lr_scheduler
(),
step
=
self
.
epoch
)
self
.
save
(
tag
=
self
.
epoch
,
infos
=
{
'val_loss'
:
cv_loss
})
self
.
save
(
tag
=
self
.
epoch
,
infos
=
{
'val_loss'
:
cv_loss
})
self
.
new_epoch
()
self
.
new_epoch
()
...
...
paddlespeech/s2t/frontend/augmentor/impulse_response.py
浏览文件 @
39228864
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
# limitations under the License.
# limitations under the License.
"""Contains the impulse response augmentation model."""
"""Contains the impulse response augmentation model."""
import
jsonlines
import
jsonlines
from
paddlespeech.s2t.frontend.audio
import
AudioSegment
from
paddlespeech.s2t.frontend.audio
import
AudioSegment
from
paddlespeech.s2t.frontend.augmentor.base
import
AugmentorBase
from
paddlespeech.s2t.frontend.augmentor.base
import
AugmentorBase
...
...
paddlespeech/s2t/frontend/augmentor/noise_perturb.py
浏览文件 @
39228864
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
# limitations under the License.
# limitations under the License.
"""Contains the noise perturb augmentation model."""
"""Contains the noise perturb augmentation model."""
import
jsonlines
import
jsonlines
from
paddlespeech.s2t.frontend.audio
import
AudioSegment
from
paddlespeech.s2t.frontend.audio
import
AudioSegment
from
paddlespeech.s2t.frontend.augmentor.base
import
AugmentorBase
from
paddlespeech.s2t.frontend.augmentor.base
import
AugmentorBase
...
...
paddlespeech/s2t/frontend/normalizer.py
浏览文件 @
39228864
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
# limitations under the License.
# limitations under the License.
"""Contains feature normalizers."""
"""Contains feature normalizers."""
import
json
import
json
import
jsonlines
import
jsonlines
import
numpy
as
np
import
numpy
as
np
import
paddle
import
paddle
...
@@ -27,6 +28,7 @@ __all__ = ["FeatureNormalizer"]
...
@@ -27,6 +28,7 @@ __all__ = ["FeatureNormalizer"]
logger
=
Log
(
__name__
).
getlog
()
logger
=
Log
(
__name__
).
getlog
()
# https://github.com/PaddlePaddle/Paddle/pull/31481
# https://github.com/PaddlePaddle/Paddle/pull/31481
class
CollateFunc
(
object
):
class
CollateFunc
(
object
):
def
__init__
(
self
,
feature_func
):
def
__init__
(
self
,
feature_func
):
...
...
paddlespeech/s2t/frontend/utility.py
浏览文件 @
39228864
paddlespeech/s2t/io/dataloader.py
浏览文件 @
39228864
...
@@ -15,8 +15,8 @@ from typing import Any
...
@@ -15,8 +15,8 @@ from typing import Any
from
typing
import
Dict
from
typing
import
Dict
from
typing
import
List
from
typing
import
List
from
typing
import
Text
from
typing
import
Text
import
jsonlines
import
jsonlines
import
numpy
as
np
import
numpy
as
np
from
paddle.io
import
DataLoader
from
paddle.io
import
DataLoader
...
...
paddlespeech/s2t/io/dataset.py
浏览文件 @
39228864
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
# Modified from espnet(https://github.com/espnet/espnet)
# Modified from espnet(https://github.com/espnet/espnet)
# Modified from wenet(https://github.com/wenet-e2e/wenet)
# Modified from wenet(https://github.com/wenet-e2e/wenet)
from
typing
import
Optional
from
typing
import
Optional
import
jsonlines
import
jsonlines
from
paddle.io
import
Dataset
from
paddle.io
import
Dataset
from
yacs.config
import
CfgNode
from
yacs.config
import
CfgNode
...
...
paddlespeech/s2t/io/sampler.py
浏览文件 @
39228864
...
@@ -51,7 +51,7 @@ def _batch_shuffle(indices, batch_size, epoch, clipped=False):
...
@@ -51,7 +51,7 @@ def _batch_shuffle(indices, batch_size, epoch, clipped=False):
"""
"""
rng
=
np
.
random
.
RandomState
(
epoch
)
rng
=
np
.
random
.
RandomState
(
epoch
)
shift_len
=
rng
.
randint
(
0
,
batch_size
-
1
)
shift_len
=
rng
.
randint
(
0
,
batch_size
-
1
)
batch_indices
=
list
(
zip
(
*
[
iter
(
indices
[
shift_len
:])]
*
batch_size
))
batch_indices
=
list
(
zip
(
*
[
iter
(
indices
[
shift_len
:])]
*
batch_size
))
rng
.
shuffle
(
batch_indices
)
rng
.
shuffle
(
batch_indices
)
batch_indices
=
[
item
for
batch
in
batch_indices
for
item
in
batch
]
batch_indices
=
[
item
for
batch
in
batch_indices
for
item
in
batch
]
assert
clipped
is
False
assert
clipped
is
False
...
...
paddlespeech/s2t/training/trainer.py
浏览文件 @
39228864
...
@@ -309,8 +309,10 @@ class Trainer():
...
@@ -309,8 +309,10 @@ class Trainer():
logger
.
info
(
logger
.
info
(
'Epoch {} Val info val_loss {}'
.
format
(
self
.
epoch
,
cv_loss
))
'Epoch {} Val info val_loss {}'
.
format
(
self
.
epoch
,
cv_loss
))
if
self
.
visualizer
:
if
self
.
visualizer
:
self
.
visualizer
.
add_scalar
(
tag
=
'eval/cv_loss'
,
value
=
cv_loss
,
step
=
self
.
epoch
)
self
.
visualizer
.
add_scalar
(
self
.
visualizer
.
add_scalar
(
tag
=
'eval/lr'
,
value
=
self
.
lr_scheduler
(),
step
=
self
.
epoch
)
tag
=
'eval/cv_loss'
,
value
=
cv_loss
,
step
=
self
.
epoch
)
self
.
visualizer
.
add_scalar
(
tag
=
'eval/lr'
,
value
=
self
.
lr_scheduler
(),
step
=
self
.
epoch
)
# after epoch
# after epoch
self
.
save
(
tag
=
self
.
epoch
,
infos
=
{
'val_loss'
:
cv_loss
})
self
.
save
(
tag
=
self
.
epoch
,
infos
=
{
'val_loss'
:
cv_loss
})
...
...
paddlespeech/s2t/utils/socket_server.py
浏览文件 @
39228864
...
@@ -20,6 +20,7 @@ import time
...
@@ -20,6 +20,7 @@ import time
import
wave
import
wave
from
time
import
gmtime
from
time
import
gmtime
from
time
import
strftime
from
time
import
strftime
import
jsonlines
import
jsonlines
__all__
=
[
"socket_send"
,
"warm_up_test"
,
"AsrTCPServer"
,
"AsrRequestHandler"
]
__all__
=
[
"socket_send"
,
"warm_up_test"
,
"AsrTCPServer"
,
"AsrRequestHandler"
]
...
...
paddlespeech/text/speechtask/punctuation_restoration/training/trainer.py
浏览文件 @
39228864
...
@@ -252,8 +252,10 @@ class Trainer():
...
@@ -252,8 +252,10 @@ class Trainer():
self
.
logger
.
info
(
"Epoch {} Val info val_loss {}, F1_score {}"
.
self
.
logger
.
info
(
"Epoch {} Val info val_loss {}, F1_score {}"
.
format
(
self
.
epoch
,
total_loss
,
F1_score
))
format
(
self
.
epoch
,
total_loss
,
F1_score
))
if
self
.
visualizer
:
if
self
.
visualizer
:
self
.
visualizer
.
add_scalar
(
tag
=
'eval/cv_loss'
,
value
=
cv_loss
,
step
=
self
.
epoch
)
self
.
visualizer
.
add_scalar
(
self
.
visualizer
.
add_scalar
(
tag
=
'eval/lr'
,
value
=
self
.
lr_scheduler
(),
step
=
self
.
epoch
)
tag
=
'eval/cv_loss'
,
value
=
cv_loss
,
step
=
self
.
epoch
)
self
.
visualizer
.
add_scalar
(
tag
=
'eval/lr'
,
value
=
self
.
lr_scheduler
(),
step
=
self
.
epoch
)
self
.
save
(
self
.
save
(
tag
=
self
.
epoch
,
infos
=
{
"val_loss"
:
total_loss
,
tag
=
self
.
epoch
,
infos
=
{
"val_loss"
:
total_loss
,
...
...
utils/build_vocab.py
浏览文件 @
39228864
...
@@ -19,9 +19,10 @@ import argparse
...
@@ -19,9 +19,10 @@ import argparse
import
functools
import
functools
import
os
import
os
import
tempfile
import
tempfile
import
jsonlines
from
collections
import
Counter
from
collections
import
Counter
import
jsonlines
from
paddlespeech.s2t.frontend.featurizer.text_featurizer
import
TextFeaturizer
from
paddlespeech.s2t.frontend.featurizer.text_featurizer
import
TextFeaturizer
from
paddlespeech.s2t.frontend.utility
import
BLANK
from
paddlespeech.s2t.frontend.utility
import
BLANK
from
paddlespeech.s2t.frontend.utility
import
SOS
from
paddlespeech.s2t.frontend.utility
import
SOS
...
...
utils/dump_manifest.py
浏览文件 @
39228864
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
import
argparse
import
argparse
from
pathlib
import
Path
from
pathlib
import
Path
from
typing
import
Union
from
typing
import
Union
import
jsonlines
import
jsonlines
key_whitelist
=
set
([
'feat'
,
'text'
,
'syllable'
,
'phone'
])
key_whitelist
=
set
([
'feat'
,
'text'
,
'syllable'
,
'phone'
])
...
...
utils/format_data.py
浏览文件 @
39228864
...
@@ -15,9 +15,10 @@
...
@@ -15,9 +15,10 @@
"""format manifest with more metadata."""
"""format manifest with more metadata."""
import
argparse
import
argparse
import
functools
import
functools
import
jsonlines
import
json
import
json
import
jsonlines
from
paddlespeech.s2t.frontend.featurizer.text_featurizer
import
TextFeaturizer
from
paddlespeech.s2t.frontend.featurizer.text_featurizer
import
TextFeaturizer
from
paddlespeech.s2t.frontend.utility
import
load_cmvn
from
paddlespeech.s2t.frontend.utility
import
load_cmvn
from
paddlespeech.s2t.io.utility
import
feat_type
from
paddlespeech.s2t.io.utility
import
feat_type
...
...
utils/format_triplet_data.py
浏览文件 @
39228864
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
import
argparse
import
argparse
import
functools
import
functools
import
json
import
json
import
jsonlines
import
jsonlines
from
paddlespeech.s2t.frontend.featurizer.text_featurizer
import
TextFeaturizer
from
paddlespeech.s2t.frontend.featurizer.text_featurizer
import
TextFeaturizer
...
...
utils/manifest_key_value.py
浏览文件 @
39228864
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
import
argparse
import
argparse
import
functools
import
functools
from
pathlib
import
Path
from
pathlib
import
Path
import
jsonlines
import
jsonlines
from
utils.utility
import
add_arguments
from
utils.utility
import
add_arguments
...
...
utils/utility.py
浏览文件 @
39228864
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
import
hashlib
import
hashlib
import
json
import
os
import
os
import
sys
import
sys
import
tarfile
import
tarfile
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录