Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
d25871a7
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看板
提交
d25871a7
编写于
9月 21, 2022
作者:
H
Hui Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
format
上级
b10512eb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
10 deletion
+13
-10
paddlespeech/s2t/models/u2/u2.py
paddlespeech/s2t/models/u2/u2.py
+13
-10
未找到文件。
paddlespeech/s2t/models/u2/u2.py
浏览文件 @
d25871a7
...
...
@@ -571,8 +571,8 @@ class U2BaseModel(ASRInterface, nn.Layer):
# ctc score in ln domain
# (beam_size, max_hyps_len, vocab_size)
decoder_out
,
r_decoder_out
=
self
.
forward_attention_decoder
(
hyps_pad
,
hyps_lens
,
encoder_out
,
reverse_weight
)
decoder_out
,
r_decoder_out
=
self
.
forward_attention_decoder
(
hyps_pad
,
hyps_lens
,
encoder_out
,
reverse_weight
)
decoder_out
=
decoder_out
.
numpy
()
# r_decoder_out will be 0.0, if reverse_weight is 0.0 or decoder is a
...
...
@@ -590,7 +590,9 @@ class U2BaseModel(ASRInterface, nn.Layer):
# last decoder output token is `eos`, for laste decoder input token.
score
+=
decoder_out
[
i
][
len
(
hyp
[
0
])][
self
.
eos
]
logger
.
debug
(
f
"hyp
{
i
}
len
{
len
(
hyp
[
0
])
}
l2r score:
{
score
}
ctc_score:
{
hyp
[
1
]
}
reverse_weight:
{
reverse_weight
}
"
)
logger
.
debug
(
f
"hyp
{
i
}
len
{
len
(
hyp
[
0
])
}
l2r score:
{
score
}
ctc_score:
{
hyp
[
1
]
}
reverse_weight:
{
reverse_weight
}
"
)
if
reverse_weight
>
0
:
r_score
=
0.0
...
...
@@ -598,7 +600,9 @@ class U2BaseModel(ASRInterface, nn.Layer):
r_score
+=
r_decoder_out
[
i
][
len
(
hyp
[
0
])
-
j
-
1
][
w
]
r_score
+=
r_decoder_out
[
i
][
len
(
hyp
[
0
])][
self
.
eos
]
logger
.
info
(
f
"hyp
{
i
}
len
{
len
(
hyp
[
0
])
}
r2l score:
{
r_score
}
ctc_score:
{
hyp
[
1
]
}
reverse_weight:
{
reverse_weight
}
"
)
logger
.
info
(
f
"hyp
{
i
}
len
{
len
(
hyp
[
0
])
}
r2l score:
{
r_score
}
ctc_score:
{
hyp
[
1
]
}
reverse_weight:
{
reverse_weight
}
"
)
score
=
score
*
(
1
-
reverse_weight
)
+
r_score
*
reverse_weight
...
...
@@ -702,12 +706,11 @@ class U2BaseModel(ASRInterface, nn.Layer):
return
self
.
ctc
.
log_softmax
(
xs
)
# @jit.to_static
def
forward_attention_decoder
(
self
,
hyps
:
paddle
.
Tensor
,
hyps_lens
:
paddle
.
Tensor
,
encoder_out
:
paddle
.
Tensor
,
reverse_weight
:
float
=
0.0
)
->
paddle
.
Tensor
:
def
forward_attention_decoder
(
self
,
hyps
:
paddle
.
Tensor
,
hyps_lens
:
paddle
.
Tensor
,
encoder_out
:
paddle
.
Tensor
,
reverse_weight
:
float
=
0.0
)
->
paddle
.
Tensor
:
""" Export interface for c++ call, forward decoder with multiple
hypothesis from ctc prefix beam search and one encoder output
Args:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录