Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
890a28f9
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
1 年多 前同步成功
通知
208
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看板
提交
890a28f9
编写于
9月 10, 2021
作者:
H
Hui Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add more ctc conf
上级
41ed7a18
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
51 addition
and
12 deletion
+51
-12
deepspeech/models/u2.py
deepspeech/models/u2.py
+10
-5
deepspeech/models/u2_st.py
deepspeech/models/u2_st.py
+9
-7
examples/aishell/s1/conf/chunk_conformer.yaml
examples/aishell/s1/conf/chunk_conformer.yaml
+2
-0
examples/aishell/s1/conf/conformer.yaml
examples/aishell/s1/conf/conformer.yaml
+2
-0
examples/librispeech/s1/conf/chunk_conformer.yaml
examples/librispeech/s1/conf/chunk_conformer.yaml
+2
-0
examples/librispeech/s1/conf/chunk_transformer.yaml
examples/librispeech/s1/conf/chunk_transformer.yaml
+2
-0
examples/librispeech/s1/conf/conformer.yaml
examples/librispeech/s1/conf/conformer.yaml
+2
-0
examples/librispeech/s2/conf/chunk_conformer.yaml
examples/librispeech/s2/conf/chunk_conformer.yaml
+2
-0
examples/librispeech/s2/conf/chunk_transformer.yaml
examples/librispeech/s2/conf/chunk_transformer.yaml
+2
-0
examples/librispeech/s2/conf/conformer.yaml
examples/librispeech/s2/conf/conformer.yaml
+2
-0
examples/librispeech/s2/conf/transformer.yaml
examples/librispeech/s2/conf/transformer.yaml
+2
-0
examples/ted_en_zh/t0/conf/transformer.yaml
examples/ted_en_zh/t0/conf/transformer.yaml
+2
-0
examples/ted_en_zh/t0/conf/transformer_joint_noam.yaml
examples/ted_en_zh/t0/conf/transformer_joint_noam.yaml
+2
-0
examples/timit/s1/conf/transformer.yaml
examples/timit/s1/conf/transformer.yaml
+2
-0
examples/tiny/s1/conf/chunk_confermer.yaml
examples/tiny/s1/conf/chunk_confermer.yaml
+2
-0
examples/tiny/s1/conf/chunk_transformer.yaml
examples/tiny/s1/conf/chunk_transformer.yaml
+2
-0
examples/tiny/s1/conf/conformer.yaml
examples/tiny/s1/conf/conformer.yaml
+2
-0
examples/tiny/s1/conf/transformer.yaml
examples/tiny/s1/conf/transformer.yaml
+2
-0
未找到文件。
deepspeech/models/u2.py
浏览文件 @
890a28f9
...
...
@@ -661,9 +661,7 @@ class U2BaseModel(nn.Layer):
xs
,
offset
,
required_cache_size
,
subsampling_cache
,
elayers_output_cache
,
conformer_cnn_cache
)
# @jit.to_static([
# paddle.static.InputSpec(shape=[1, None, feat_dim],dtype='float32'), # audio feat, [B,T,D]
# ])
# @jit.to_static
def
ctc_activation
(
self
,
xs
:
paddle
.
Tensor
)
->
paddle
.
Tensor
:
""" Export interface for c++ call, apply linear transform and log
softmax before ctc
...
...
@@ -830,6 +828,7 @@ class U2Model(U2BaseModel):
Returns:
int, nn.Layer, nn.Layer, nn.Layer: vocab size, encoder, decoder, ctc
"""
# cmvn
if
configs
[
'cmvn_file'
]
is
not
None
:
mean
,
istd
=
load_cmvn
(
configs
[
'cmvn_file'
],
configs
[
'cmvn_file_type'
])
...
...
@@ -839,11 +838,13 @@ class U2Model(U2BaseModel):
else
:
global_cmvn
=
None
# input & output dim
input_dim
=
configs
[
'input_dim'
]
vocab_size
=
configs
[
'output_dim'
]
assert
input_dim
!=
0
,
input_dim
assert
vocab_size
!=
0
,
vocab_size
# encoder
encoder_type
=
configs
.
get
(
'encoder'
,
'transformer'
)
logger
.
info
(
f
"U2 Encoder type:
{
encoder_type
}
"
)
if
encoder_type
==
'transformer'
:
...
...
@@ -855,17 +856,21 @@ class U2Model(U2BaseModel):
else
:
raise
ValueError
(
f
"not support encoder type:
{
encoder_type
}
"
)
# decoder
decoder
=
TransformerDecoder
(
vocab_size
,
encoder
.
output_size
(),
**
configs
[
'decoder_conf'
])
# ctc decoder and ctc loss
model_conf
=
configs
[
'model_conf'
]
ctc
=
CTCDecoder
(
odim
=
vocab_size
,
enc_n_units
=
encoder
.
output_size
(),
blank_id
=
0
,
dropout_rate
=
0.0
,
dropout_rate
=
model_conf
[
'ctc_dropout_rate'
]
,
reduction
=
True
,
# sum
batch_average
=
True
,
# sum / batch_size
grad_norm_type
=
'instance'
)
grad_norm_type
=
model_conf
[
'ctc_grad_norm_type'
]
)
return
vocab_size
,
encoder
,
decoder
,
ctc
...
...
deepspeech/models/u2_st.py
浏览文件 @
890a28f9
...
...
@@ -413,26 +413,26 @@ class U2STBaseModel(nn.Layer):
best_hyps
=
best_hyps
[:,
1
:]
return
best_hyps
@
jit
.
to_static
#
@jit.to_static
def
subsampling_rate
(
self
)
->
int
:
""" Export interface for c++ call, return subsampling_rate of the
model
"""
return
self
.
encoder
.
embed
.
subsampling_rate
@
jit
.
to_static
#
@jit.to_static
def
right_context
(
self
)
->
int
:
""" Export interface for c++ call, return right_context of the model
"""
return
self
.
encoder
.
embed
.
right_context
@
jit
.
to_static
#
@jit.to_static
def
sos_symbol
(
self
)
->
int
:
""" Export interface for c++ call, return sos symbol id of the model
"""
return
self
.
sos
@
jit
.
to_static
#
@jit.to_static
def
eos_symbol
(
self
)
->
int
:
""" Export interface for c++ call, return eos symbol id of the model
"""
...
...
@@ -468,7 +468,7 @@ class U2STBaseModel(nn.Layer):
xs
,
offset
,
required_cache_size
,
subsampling_cache
,
elayers_output_cache
,
conformer_cnn_cache
)
@
jit
.
to_static
#
@jit.to_static
def
ctc_activation
(
self
,
xs
:
paddle
.
Tensor
)
->
paddle
.
Tensor
:
""" Export interface for c++ call, apply linear transform and log
softmax before ctc
...
...
@@ -643,14 +643,16 @@ class U2STModel(U2STBaseModel):
decoder
=
TransformerDecoder
(
vocab_size
,
encoder
.
output_size
(),
**
configs
[
'decoder_conf'
])
# ctc decoder and ctc loss
model_conf
=
configs
[
'model_conf'
]
ctc
=
CTCDecoder
(
odim
=
vocab_size
,
enc_n_units
=
encoder
.
output_size
(),
blank_id
=
0
,
dropout_rate
=
0.0
,
dropout_rate
=
model_conf
[
'ctc_dropout_rate'
]
,
reduction
=
True
,
# sum
batch_average
=
True
,
# sum / batch_size
grad_norm_type
=
'instance'
)
grad_norm_type
=
model_conf
[
'ctc_grad_norm_type'
]
)
return
vocab_size
,
encoder
,
(
st_decoder
,
decoder
,
ctc
)
else
:
...
...
examples/aishell/s1/conf/chunk_conformer.yaml
浏览文件 @
890a28f9
...
...
@@ -76,6 +76,8 @@ model:
# hybrid CTC/attention
model_conf
:
ctc_weight
:
0.3
ctc_dropoutrate
:
0.0
ctc_grad_norm_type
:
instance
lsm_weight
:
0.1
# label smoothing option
length_normalized_loss
:
false
...
...
examples/aishell/s1/conf/conformer.yaml
浏览文件 @
890a28f9
...
...
@@ -71,6 +71,8 @@ model:
# hybrid CTC/attention
model_conf
:
ctc_weight
:
0.3
ctc_dropoutrate
:
0.0
ctc_grad_norm_type
:
instance
lsm_weight
:
0.1
# label smoothing option
length_normalized_loss
:
false
...
...
examples/librispeech/s1/conf/chunk_conformer.yaml
浏览文件 @
890a28f9
...
...
@@ -76,6 +76,8 @@ model:
# hybrid CTC/attention
model_conf
:
ctc_weight
:
0.3
ctc_dropoutrate
:
0.0
ctc_grad_norm_type
:
instance
lsm_weight
:
0.1
# label smoothing option
length_normalized_loss
:
false
...
...
examples/librispeech/s1/conf/chunk_transformer.yaml
浏览文件 @
890a28f9
...
...
@@ -69,6 +69,8 @@ model:
# hybrid CTC/attention
model_conf
:
ctc_weight
:
0.3
ctc_dropoutrate
:
0.0
ctc_grad_norm_type
:
instance
lsm_weight
:
0.1
# label smoothing option
length_normalized_loss
:
false
...
...
examples/librispeech/s1/conf/conformer.yaml
浏览文件 @
890a28f9
...
...
@@ -72,6 +72,8 @@ model:
# hybrid CTC/attention
model_conf
:
ctc_weight
:
0.3
ctc_dropoutrate
:
0.0
ctc_grad_norm_type
:
instance
lsm_weight
:
0.1
# label smoothing option
length_normalized_loss
:
false
...
...
examples/librispeech/s2/conf/chunk_conformer.yaml
浏览文件 @
890a28f9
...
...
@@ -76,6 +76,8 @@ model:
# hybrid CTC/attention
model_conf
:
ctc_weight
:
0.3
ctc_dropoutrate
:
0.0
ctc_grad_norm_type
:
instance
lsm_weight
:
0.1
# label smoothing option
length_normalized_loss
:
false
...
...
examples/librispeech/s2/conf/chunk_transformer.yaml
浏览文件 @
890a28f9
...
...
@@ -69,6 +69,8 @@ model:
# hybrid CTC/attention
model_conf
:
ctc_weight
:
0.3
ctc_dropoutrate
:
0.0
ctc_grad_norm_type
:
instance
lsm_weight
:
0.1
# label smoothing option
length_normalized_loss
:
false
...
...
examples/librispeech/s2/conf/conformer.yaml
浏览文件 @
890a28f9
...
...
@@ -72,6 +72,8 @@ model:
# hybrid CTC/attention
model_conf
:
ctc_weight
:
0.3
ctc_dropoutrate
:
0.0
ctc_grad_norm_type
:
instance
lsm_weight
:
0.1
# label smoothing option
length_normalized_loss
:
false
...
...
examples/librispeech/s2/conf/transformer.yaml
浏览文件 @
890a28f9
...
...
@@ -58,6 +58,8 @@ model:
# hybrid CTC/attention
model_conf
:
ctc_weight
:
0.3
ctc_dropoutrate
:
0.0
ctc_grad_norm_type
:
instance
lsm_weight
:
0.1
# label smoothing option
length_normalized_loss
:
false
...
...
examples/ted_en_zh/t0/conf/transformer.yaml
浏览文件 @
890a28f9
...
...
@@ -68,6 +68,8 @@ model:
model_conf
:
asr_weight
:
0.0
ctc_weight
:
0.0
ctc_dropoutrate
:
0.0
ctc_grad_norm_type
:
instance
lsm_weight
:
0.1
# label smoothing option
length_normalized_loss
:
false
...
...
examples/ted_en_zh/t0/conf/transformer_joint_noam.yaml
浏览文件 @
890a28f9
...
...
@@ -68,6 +68,8 @@ model:
model_conf
:
asr_weight
:
0.5
ctc_weight
:
0.3
ctc_dropoutrate
:
0.0
ctc_grad_norm_type
:
instance
lsm_weight
:
0.1
# label smoothing option
length_normalized_loss
:
false
...
...
examples/timit/s1/conf/transformer.yaml
浏览文件 @
890a28f9
...
...
@@ -66,6 +66,8 @@ model:
# hybrid CTC/attention
model_conf
:
ctc_weight
:
0.3
ctc_dropoutrate
:
0.0
ctc_grad_norm_type
:
instance
lsm_weight
:
0.1
# label smoothing option
length_normalized_loss
:
false
...
...
examples/tiny/s1/conf/chunk_confermer.yaml
浏览文件 @
890a28f9
...
...
@@ -76,6 +76,8 @@ model:
# hybrid CTC/attention
model_conf
:
ctc_weight
:
0.3
ctc_dropoutrate
:
0.0
ctc_grad_norm_type
:
instance
lsm_weight
:
0.1
# label smoothing option
length_normalized_loss
:
false
...
...
examples/tiny/s1/conf/chunk_transformer.yaml
浏览文件 @
890a28f9
...
...
@@ -69,6 +69,8 @@ model:
# hybrid CTC/attention
model_conf
:
ctc_weight
:
0.3
ctc_dropoutrate
:
0.0
ctc_grad_norm_type
:
instance
lsm_weight
:
0.1
# label smoothing option
length_normalized_loss
:
false
...
...
examples/tiny/s1/conf/conformer.yaml
浏览文件 @
890a28f9
...
...
@@ -72,6 +72,8 @@ model:
# hybrid CTC/attention
model_conf
:
ctc_weight
:
0.3
ctc_dropoutrate
:
0.0
ctc_grad_norm_type
:
instance
lsm_weight
:
0.1
# label smoothing option
length_normalized_loss
:
false
...
...
examples/tiny/s1/conf/transformer.yaml
浏览文件 @
890a28f9
...
...
@@ -66,6 +66,8 @@ model:
# hybrid CTC/attention
model_conf
:
ctc_weight
:
0.3
ctc_dropoutrate
:
0.0
ctc_grad_norm_type
:
instance
lsm_weight
:
0.1
# label smoothing option
length_normalized_loss
:
false
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录