Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
123c1a4f
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
1 年多 前同步成功
通知
207
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看板
提交
123c1a4f
编写于
10月 09, 2021
作者:
H
Hui Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
format
上级
17092cbb
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
26 addition
and
17 deletion
+26
-17
deepspeech/exps/deepspeech2/model.py
deepspeech/exps/deepspeech2/model.py
+4
-2
deepspeech/exps/u2/model.py
deepspeech/exps/u2/model.py
+4
-2
deepspeech/frontend/augmentor/augmentation.py
deepspeech/frontend/augmentor/augmentation.py
+4
-3
deepspeech/frontend/featurizer/text_featurizer.py
deepspeech/frontend/featurizer/text_featurizer.py
+6
-6
deepspeech/io/collator.py
deepspeech/io/collator.py
+1
-1
deepspeech/modules/loss.py
deepspeech/modules/loss.py
+5
-1
deepspeech/training/trainer.py
deepspeech/training/trainer.py
+2
-2
未找到文件。
deepspeech/exps/deepspeech2/model.py
浏览文件 @
123c1a4f
...
...
@@ -187,7 +187,8 @@ class DeepSpeech2Trainer(Trainer):
sortagrad
=
config
.
data
.
sortagrad
,
shuffle_method
=
config
.
data
.
shuffle_method
)
collate_fn
=
SpeechCollator
(
keep_transcription_text
=
False
,
return_utts
=
False
)
collate_fn
=
SpeechCollator
(
keep_transcription_text
=
False
,
return_utts
=
False
)
self
.
train_loader
=
DataLoader
(
train_dataset
,
batch_sampler
=
batch_sampler
,
...
...
@@ -220,7 +221,8 @@ class DeepSpeech2Trainer(Trainer):
batch_size
=
config
.
decoding
.
batch_size
,
shuffle
=
False
,
drop_last
=
False
,
collate_fn
=
SpeechCollator
(
keep_transcription_text
=
True
,
return_utts
=
True
))
collate_fn
=
SpeechCollator
(
keep_transcription_text
=
True
,
return_utts
=
True
))
logger
.
info
(
"Setup test Dataloader!"
)
...
...
deepspeech/exps/u2/model.py
浏览文件 @
123c1a4f
...
...
@@ -222,7 +222,8 @@ class U2Trainer(Trainer):
config
.
data
.
augmentation_config
=
""
dev_dataset
=
ManifestDataset
.
from_config
(
config
)
collate_fn
=
SpeechCollator
(
keep_transcription_text
=
False
,
return_utts
=
False
)
collate_fn
=
SpeechCollator
(
keep_transcription_text
=
False
,
return_utts
=
False
)
if
self
.
parallel
:
batch_sampler
=
SortagradDistributedBatchSampler
(
train_dataset
,
...
...
@@ -272,7 +273,8 @@ class U2Trainer(Trainer):
batch_size
=
config
.
decoding
.
batch_size
,
shuffle
=
False
,
drop_last
=
False
,
collate_fn
=
SpeechCollator
(
keep_transcription_text
=
True
,
return_utts
=
True
))
collate_fn
=
SpeechCollator
(
keep_transcription_text
=
True
,
return_utts
=
True
))
logger
.
info
(
"Setup train/valid/test Dataloader!"
)
def
setup_model
(
self
):
...
...
deepspeech/frontend/augmentor/augmentation.py
浏览文件 @
123c1a4f
...
...
@@ -13,9 +13,9 @@
# limitations under the License.
"""Contains the data augmentation pipeline."""
import
json
from
pprint
import
pformat
from
collections.abc
import
Sequence
from
inspect
import
signature
from
pprint
import
pformat
import
numpy
as
np
...
...
@@ -112,7 +112,8 @@ class AugmentationPipeline():
'audio'
)
self
.
_spec_augmentors
,
self
.
_spec_rates
=
self
.
_parse_pipeline_from
(
'feature'
)
logger
.
info
(
f
"Augmentation:
{
pformat
(
list
(
zip
(
self
.
_augmentors
,
self
.
_rates
)))
}
"
)
logger
.
info
(
f
"Augmentation:
{
pformat
(
list
(
zip
(
self
.
_augmentors
,
self
.
_rates
)))
}
"
)
def
__call__
(
self
,
xs
,
uttid_list
=
None
,
**
kwargs
):
if
not
isinstance
(
xs
,
Sequence
):
...
...
@@ -203,7 +204,7 @@ class AugmentationPipeline():
aug_confs
=
all_confs
else
:
raise
ValueError
(
f
"Not support:
{
aug_type
}
"
)
augmentors
=
[
self
.
_get_augmentor
(
config
[
"type"
],
config
[
"params"
])
for
config
in
aug_confs
...
...
deepspeech/frontend/featurizer/text_featurizer.py
浏览文件 @
123c1a4f
...
...
@@ -12,17 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains the text featurizer class."""
import
sentencepiece
as
spm
from
pprint
import
pformat
import
sentencepiece
as
spm
from
..utility
import
BLANK
from
..utility
import
EOS
from
..utility
import
load_dict
from
..utility
import
MASKCTC
from
..utility
import
SOS
from
..utility
import
SPACE
from
..utility
import
UNK
from
..utility
import
SOS
from
..utility
import
BLANK
from
..utility
import
MASKCTC
from
..utility
import
load_dict
from
deepspeech.utils.log
import
Log
logger
=
Log
(
__name__
).
getlog
()
...
...
deepspeech/io/collator.py
浏览文件 @
123c1a4f
...
...
@@ -81,4 +81,4 @@ class SpeechCollator():
if
self
.
return_utts
:
return
padded_audios
,
audio_lens
,
padded_texts
,
text_lens
,
utts
else
:
return
padded_audios
,
audio_lens
,
padded_texts
,
text_lens
\ No newline at end of file
return
padded_audios
,
audio_lens
,
padded_texts
,
text_lens
deepspeech/modules/loss.py
浏览文件 @
123c1a4f
...
...
@@ -23,7 +23,11 @@ __all__ = ['CTCLoss', "LabelSmoothingLoss"]
class
CTCLoss
(
nn
.
Layer
):
def
__init__
(
self
,
blank
=
0
,
reduction
=
'sum'
,
batch_average
=
False
,
grad_norm_type
=
None
):
def
__init__
(
self
,
blank
=
0
,
reduction
=
'sum'
,
batch_average
=
False
,
grad_norm_type
=
None
):
super
().
__init__
()
# last token id as blank id
self
.
loss
=
nn
.
CTCLoss
(
blank
=
blank
,
reduction
=
reduction
)
...
...
deepspeech/training/trainer.py
浏览文件 @
123c1a4f
...
...
@@ -148,8 +148,8 @@ class Trainer():
"lr"
:
self
.
optimizer
.
get_lr
()
})
Checkpoint
().
save_parameters
(
self
.
checkpoint_dir
,
self
.
iteration
if
tag
is
None
else
tag
,
self
.
model
,
self
.
optimizer
,
infos
)
if
tag
is
None
else
tag
,
self
.
model
,
self
.
optimizer
,
infos
)
def
resume_or_scratch
(
self
):
"""Resume from latest checkpoint at checkpoints in the output
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录