Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
sherpaonnx
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Fangjun Kuang
2023-08-09 12:33:47 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2023-08-09 12:33:47 +0800
Commit
aa48b76d4b6781266d140f0b4f83c449a07cd579
aa48b76d
1 parent
aeb112dd
Fix initial tokens to decoding (#246)
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
10 行增加
和
5 行删除
CMakeLists.txt
sherpa-onnx/csrc/offline-transducer-greedy-search-decoder.cc
sherpa-onnx/csrc/offline-transducer-modified-beam-search-decoder.cc
sherpa-onnx/csrc/online-transducer-greedy-search-decoder.cc
sherpa-onnx/csrc/online-transducer-modified-beam-search-decoder.cc
CMakeLists.txt
查看文件 @
aa48b76
cmake_minimum_required
(
VERSION 3.13 FATAL_ERROR
)
project
(
sherpa-onnx
)
set
(
SHERPA_ONNX_VERSION
"1.6.
1
"
)
set
(
SHERPA_ONNX_VERSION
"1.6.
2
"
)
# Disable warning about
#
...
...
sherpa-onnx/csrc/offline-transducer-greedy-search-decoder.cc
查看文件 @
aa48b76
...
...
@@ -30,8 +30,9 @@ OfflineTransducerGreedySearchDecoder::Decode(Ort::Value encoder_out,
std
::
vector
<
OfflineTransducerDecoderResult
>
ans
(
batch_size
);
for
(
auto
&
r
:
ans
)
{
r
.
tokens
.
resize
(
context_size
,
-
1
);
// 0 is the ID of the blank token
r
.
tokens
.
resize
(
context_size
,
0
)
;
r
.
tokens
.
back
()
=
0
;
}
auto
decoder_input
=
model_
->
BuildDecoderInput
(
ans
,
ans
.
size
());
...
...
sherpa-onnx/csrc/offline-transducer-modified-beam-search-decoder.cc
查看文件 @
aa48b76
...
...
@@ -32,7 +32,8 @@ OfflineTransducerModifiedBeamSearchDecoder::Decode(
int32_t
vocab_size
=
model_
->
VocabSize
();
int32_t
context_size
=
model_
->
ContextSize
();
std
::
vector
<
int64_t
>
blanks
(
context_size
,
0
);
std
::
vector
<
int64_t
>
blanks
(
context_size
,
-
1
);
blanks
.
back
()
=
0
;
std
::
deque
<
Hypotheses
>
finalized
;
std
::
vector
<
Hypotheses
>
cur
;
...
...
sherpa-onnx/csrc/online-transducer-greedy-search-decoder.cc
查看文件 @
aa48b76
...
...
@@ -55,7 +55,8 @@ OnlineTransducerGreedySearchDecoder::GetEmptyResult() const {
int32_t
context_size
=
model_
->
ContextSize
();
int32_t
blank_id
=
0
;
// always 0
OnlineTransducerDecoderResult
r
;
r
.
tokens
.
resize
(
context_size
,
blank_id
);
r
.
tokens
.
resize
(
context_size
,
-
1
);
r
.
tokens
.
back
()
=
blank_id
;
return
r
;
}
...
...
sherpa-onnx/csrc/online-transducer-modified-beam-search-decoder.cc
查看文件 @
aa48b76
...
...
@@ -42,7 +42,9 @@ OnlineTransducerModifiedBeamSearchDecoder::GetEmptyResult() const {
int32_t
context_size
=
model_
->
ContextSize
();
int32_t
blank_id
=
0
;
// always 0
OnlineTransducerDecoderResult
r
;
std
::
vector
<
int64_t
>
blanks
(
context_size
,
blank_id
);
std
::
vector
<
int64_t
>
blanks
(
context_size
,
-
1
);
blanks
.
back
()
=
blank_id
;
Hypotheses
blank_hyp
({{
blanks
,
0
}});
r
.
hyps
=
std
::
move
(
blank_hyp
);
r
.
tokens
=
std
::
move
(
blanks
);
...
...
请
注册
或
登录
后发表评论