Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
642e0840
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看板
提交
642e0840
编写于
4月 07, 2022
作者:
Y
Yang Zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dev ing
上级
c2ee6bc6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
7 deletion
+19
-7
speechx/examples/decoder/offline_wfst_decoder_main.cc
speechx/examples/decoder/offline_wfst_decoder_main.cc
+5
-4
speechx/speechx/nnet/decodable.cc
speechx/speechx/nnet/decodable.cc
+14
-3
未找到文件。
speechx/examples/decoder/offline_wfst_decoder_main.cc
浏览文件 @
642e0840
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
#include "base/flags.h"
#include "base/flags.h"
#include "base/log.h"
#include "base/log.h"
#include "decoder/ctc_tlg_decoder.h"
#include "decoder/ctc_tlg_decoder.h"
#include "frontend/
raw_audio
.h"
#include "frontend/
audio/data_cache
.h"
#include "kaldi/util/table-types.h"
#include "kaldi/util/table-types.h"
#include "nnet/decodable.h"
#include "nnet/decodable.h"
#include "nnet/paddle_nnet.h"
#include "nnet/paddle_nnet.h"
...
@@ -27,7 +27,7 @@ DEFINE_string(model_path, "avg_1.jit.pdmodel", "paddle nnet model");
...
@@ -27,7 +27,7 @@ DEFINE_string(model_path, "avg_1.jit.pdmodel", "paddle nnet model");
DEFINE_string
(
param_path
,
"avg_1.jit.pdiparams"
,
"paddle nnet model param"
);
DEFINE_string
(
param_path
,
"avg_1.jit.pdiparams"
,
"paddle nnet model param"
);
DEFINE_string
(
word_symbol_table
,
"vocab.txt"
,
"word symbol table"
);
DEFINE_string
(
word_symbol_table
,
"vocab.txt"
,
"word symbol table"
);
DEFINE_string
(
graph_path
,
"TLG"
,
"decoder graph"
);
DEFINE_string
(
graph_path
,
"TLG"
,
"decoder graph"
);
DEFINE_double
(
acoustic_scale
,
1.0
,
"acoustic scale"
);
DEFINE_double
(
acoustic_scale
,
1
0
.0
,
"acoustic scale"
);
DEFINE_int32
(
max_active
,
5000
,
"decoder graph"
);
DEFINE_int32
(
max_active
,
5000
,
"decoder graph"
);
...
@@ -52,6 +52,7 @@ int main(int argc, char* argv[]) {
...
@@ -52,6 +52,7 @@ int main(int argc, char* argv[]) {
opts
.
word_symbol_table
=
word_symbol_table
;
opts
.
word_symbol_table
=
word_symbol_table
;
opts
.
fst_path
=
graph_path
;
opts
.
fst_path
=
graph_path
;
opts
.
opts
.
max_active
=
FLAGS_max_active
;
opts
.
opts
.
max_active
=
FLAGS_max_active
;
opts
.
opts
.
beam
=
ppspeech
::
TLGDecoder
decoder
(
opts
);
ppspeech
::
TLGDecoder
decoder
(
opts
);
ppspeech
::
ModelOptions
model_opts
;
ppspeech
::
ModelOptions
model_opts
;
...
@@ -60,8 +61,8 @@ int main(int argc, char* argv[]) {
...
@@ -60,8 +61,8 @@ int main(int argc, char* argv[]) {
model_opts
.
cache_shape
=
"5-1-1024,5-1-1024"
;
model_opts
.
cache_shape
=
"5-1-1024,5-1-1024"
;
std
::
shared_ptr
<
ppspeech
::
PaddleNnet
>
nnet
(
std
::
shared_ptr
<
ppspeech
::
PaddleNnet
>
nnet
(
new
ppspeech
::
PaddleNnet
(
model_opts
));
new
ppspeech
::
PaddleNnet
(
model_opts
));
std
::
shared_ptr
<
ppspeech
::
Raw
DataCache
>
raw_data
(
std
::
shared_ptr
<
ppspeech
::
DataCache
>
raw_data
(
new
ppspeech
::
Raw
DataCache
());
new
ppspeech
::
DataCache
());
std
::
shared_ptr
<
ppspeech
::
Decodable
>
decodable
(
std
::
shared_ptr
<
ppspeech
::
Decodable
>
decodable
(
new
ppspeech
::
Decodable
(
nnet
,
raw_data
));
new
ppspeech
::
Decodable
(
nnet
,
raw_data
));
...
...
speechx/speechx/nnet/decodable.cc
浏览文件 @
642e0840
...
@@ -48,7 +48,7 @@ BaseFloat Decodable::LogLikelihood(int32 frame, int32 index) {
...
@@ -48,7 +48,7 @@ BaseFloat Decodable::LogLikelihood(int32 frame, int32 index) {
CHECK_LE
(
index
,
nnet_cache_
.
NumCols
());
CHECK_LE
(
index
,
nnet_cache_
.
NumCols
());
CHECK_LE
(
frame
,
frames_ready_
);
CHECK_LE
(
frame
,
frames_ready_
);
int32
frame_idx
=
frame
-
frame_offset_
;
int32
frame_idx
=
frame
-
frame_offset_
;
return
nnet_cache_
(
frame_idx
,
index
);
return
std
::
log
(
nnet_cache_
(
frame_idx
,
index
)
+
std
::
numeric_limits
<
float
>::
min
()
);
}
}
bool
Decodable
::
EnsureFrameHaveComputed
(
int32
frame
)
{
bool
Decodable
::
EnsureFrameHaveComputed
(
int32
frame
)
{
...
@@ -65,9 +65,20 @@ bool Decodable::AdvanceChunk() {
...
@@ -65,9 +65,20 @@ bool Decodable::AdvanceChunk() {
}
}
int32
nnet_dim
=
0
;
int32
nnet_dim
=
0
;
Vector
<
BaseFloat
>
inferences
;
Vector
<
BaseFloat
>
inferences
;
Matrix
<
BaseFloat
>
nnet_cache_tmp
;
nnet_
->
FeedForward
(
features
,
frontend_
->
Dim
(),
&
inferences
,
&
nnet_dim
);
nnet_
->
FeedForward
(
features
,
frontend_
->
Dim
(),
&
inferences
,
&
nnet_dim
);
nnet_cache_
.
Resize
(
inferences
.
Dim
()
/
nnet_dim
,
nnet_dim
);
nnet_cache_tmp
.
Resize
(
inferences
.
Dim
()
/
nnet_dim
,
nnet_dim
);
nnet_cache_
.
CopyRowsFromVec
(
inferences
);
nnet_cache_tmp
.
CopyRowsFromVec
(
inferences
);
// skip blank
vector
<
int
>
no_blank_record
;
BaseFloat
blank_threshold
=
0.98
;
for
(
int32
idx
=
0
;
idx
<
nnet_cache_
.
NumRows
();
++
idx
)
{
if
(
nnet_cache_
(
idx
,
0
)
>
blank_threshold
)
{
}
}
frame_offset_
=
frames_ready_
;
frame_offset_
=
frames_ready_
;
frames_ready_
+=
nnet_cache_
.
NumRows
();
frames_ready_
+=
nnet_cache_
.
NumRows
();
return
true
;
return
true
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录