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-11-05 11:10:24 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2023-11-05 11:10:24 +0800
Commit
606cb26a626801aa41666a78aa3596440dd98a12
606cb26a
1 parent
d1a450bf
Catch exception from whisper (#408)
显示空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
12 行增加
和
4 行删除
sherpa-onnx/csrc/offline-recognizer-whisper-impl.h
sherpa-onnx/csrc/offline-recognizer-whisper-impl.h
查看文件 @
606cb26
...
...
@@ -107,8 +107,10 @@ class OfflineRecognizerWhisperImpl : public OfflineRecognizerImpl {
int32_t
num_frames
=
f
.
size
()
/
feat_dim
;
if
(
num_frames
>
max_num_frames
)
{
SHERPA_ONNX_LOGE
(
"Only waves less than 30 seconds are supported."
);
exit
(
-
1
);
SHERPA_ONNX_LOGE
(
"Only waves less than 30 seconds are supported. We process only the "
"first 30 seconds and discard the remaining data"
);
num_frames
=
max_num_frames
;
}
NormalizeFeatures
(
f
.
data
(),
num_frames
,
feat_dim
);
...
...
@@ -124,13 +126,19 @@ class OfflineRecognizerWhisperImpl : public OfflineRecognizerImpl {
(
max_num_frames
-
num_frames
)
*
feat_dim
*
sizeof
(
float
));
mel
=
Transpose12
(
model_
->
Allocator
(),
&
mel
);
try
{
auto
cross_kv
=
model_
->
ForwardEncoder
(
std
::
move
(
mel
));
auto
results
=
decoder_
->
Decode
(
std
::
move
(
cross_kv
.
first
),
std
::
move
(
cross_kv
.
second
));
auto
results
=
decoder_
->
Decode
(
std
::
move
(
cross_kv
.
first
),
std
::
move
(
cross_kv
.
second
));
auto
r
=
Convert
(
results
[
0
],
symbol_table_
);
s
->
SetResult
(
r
);
}
catch
(
const
Ort
::
Exception
&
ex
)
{
SHERPA_ONNX_LOGE
(
"
\n\n
Caught exception:
\n\n
%s
\n\n
Return an empty result"
,
ex
.
what
());
return
;
}
}
private
:
...
...
请
注册
或
登录
后发表评论