Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
a75abc18
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看板
提交
a75abc18
编写于
10月 11, 2022
作者:
H
Hui Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix u2 nnet out frames num
上级
cd1ced4e
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
26 addition
and
20 deletion
+26
-20
speechx/.gitignore
speechx/.gitignore
+1
-0
speechx/speechx/nnet/nnet_itf.h
speechx/speechx/nnet/nnet_itf.h
+7
-7
speechx/speechx/nnet/u2_nnet.cc
speechx/speechx/nnet/u2_nnet.cc
+3
-3
speechx/speechx/nnet/u2_nnet.h
speechx/speechx/nnet/u2_nnet.h
+3
-1
speechx/speechx/nnet/u2_nnet_main.cc
speechx/speechx/nnet/u2_nnet_main.cc
+9
-9
speechx/tools/clang-format.sh
speechx/tools/clang-format.sh
+3
-0
未找到文件。
speechx/.gitignore
浏览文件 @
a75abc18
tools/valgrind*
*log
speechx/speechx/nnet/nnet_itf.h
浏览文件 @
a75abc18
...
...
@@ -21,7 +21,7 @@
namespace
ppspeech
{
struct
NnetOut
{
struct
NnetOut
{
// nnet out, maybe logprob or prob
kaldi
::
Vector
<
kaldi
::
BaseFloat
>
logprobs
;
int32
vocab_dim
;
...
...
speechx/speechx/nnet/u2_nnet.cc
浏览文件 @
a75abc18
...
...
@@ -313,10 +313,8 @@ void U2Nnet::ForwardEncoderChunkImpl(
// call.
std
::
vector
<
paddle
::
Tensor
>
inputs
=
{
feats
,
offset
,
/*required_cache_size, */
att_cache_
,
cnn_cache_
};
VLOG
(
3
)
<<
"inputs size: "
<<
inputs
.
size
();
CHECK
(
inputs
.
size
()
==
4
);
std
::
vector
<
paddle
::
Tensor
>
outputs
=
forward_encoder_chunk_
(
inputs
);
VLOG
(
3
)
<<
"outputs size: "
<<
outputs
.
size
();
CHECK
(
outputs
.
size
()
==
3
);
#ifdef USE_GPU
...
...
@@ -351,10 +349,12 @@ void U2Nnet::ForwardEncoderChunkImpl(
// current offset in decoder frame
// not used in nnet
offset_
+=
chunk_out
.
shape
()[
1
];
VLOG
(
2
)
<<
"encoder out chunk size: "
<<
chunk_out
.
shape
()[
1
]
<<
" total: "
<<
offset_
;
// collects encoder outs.
VLOG
(
2
)
<<
"encoder_outs_ size: "
<<
encoder_outs_
.
size
();
encoder_outs_
.
push_back
(
chunk_out
);
VLOG
(
2
)
<<
"encoder_outs_ size: "
<<
encoder_outs_
.
size
();
#ifdef TEST_DEBUG
{
...
...
speechx/speechx/nnet/u2_nnet.h
浏览文件 @
a75abc18
...
...
@@ -137,7 +137,9 @@ class U2Nnet : public U2NnetBase {
// debug
void
FeedEncoderOuts
(
paddle
::
Tensor
&
encoder_out
);
const
std
::
vector
<
paddle
::
Tensor
>&
EncoderOuts
()
const
{
return
encoder_outs_
;
}
const
std
::
vector
<
paddle
::
Tensor
>&
EncoderOuts
()
const
{
return
encoder_outs_
;
}
private:
U2ModelOptions
opts_
;
...
...
speechx/speechx/nnet/u2_nnet_main.cc
浏览文件 @
a75abc18
...
...
@@ -95,29 +95,29 @@ int main(int argc, char* argv[]) {
// kaldi::kCopyData);
// }
int32
num_chunks
=
(
feature
.
NumRows
()
-
chunk_size
)
/
chunk_stride
+
1
;
int32
frame_idx
=
0
;
std
::
vector
<
kaldi
::
Vector
<
kaldi
::
BaseFloat
>>
prob_vec
;
int32
ori_feature_len
=
feature
.
NumRows
();
int32
num_chunks
=
feature
.
NumRows
()
/
chunk_stride
+
1
;
LOG
(
INFO
)
<<
"num_chunks: "
<<
num_chunks
;
for
(
int
chunk_idx
=
0
;
chunk_idx
<
num_chunks
;
++
chunk_idx
)
{
kaldi
::
Vector
<
kaldi
::
BaseFloat
>
feature_chunk
(
chunk_size
*
feat_dim
);
int32
feature_chunk_size
=
0
;
int32
this_chunk_size
=
0
;
if
(
ori_feature_len
>
chunk_idx
*
chunk_stride
)
{
feature
_chunk_size
=
std
::
min
(
this
_chunk_size
=
std
::
min
(
ori_feature_len
-
chunk_idx
*
chunk_stride
,
chunk_size
);
}
if
(
feature
_chunk_size
<
receptive_field_length
)
{
if
(
this
_chunk_size
<
receptive_field_length
)
{
LOG
(
WARNING
)
<<
"utt: "
<<
utt
<<
" skip last "
<<
feature
_chunk_size
<<
" frames, expect is "
<<
this
_chunk_size
<<
" frames, expect is "
<<
receptive_field_length
;
break
;
}
kaldi
::
Vector
<
kaldi
::
BaseFloat
>
feature_chunk
(
this_chunk_size
*
feat_dim
);
int32
start
=
chunk_idx
*
chunk_stride
;
for
(
int
row_id
=
0
;
row_id
<
chunk_size
;
++
row_id
)
{
for
(
int
row_id
=
0
;
row_id
<
this_
chunk_size
;
++
row_id
)
{
kaldi
::
SubVector
<
kaldi
::
BaseFloat
>
feat_row
(
feature
,
start
);
kaldi
::
SubVector
<
kaldi
::
BaseFloat
>
feature_chunk_row
(
feature_chunk
.
Data
()
+
row_id
*
feat_dim
,
feat_dim
);
...
...
speechx/tools/clang-format.sh
0 → 100755
浏览文件 @
a75abc18
#!/bin/bash
find speechx
-name
'*.c'
-o
-name
'*.h'
-not
-path
"*kaldi*"
| xargs
-I
{}
clang-format
-i
{}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录