Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
wenet_onnxruntime
Commits
d6085cc0
Commit
d6085cc0
authored
Apr 02, 2025
by
lijian6
Browse files
fix run core dump in the end
Signed-off-by:
lijian
<
lijian6@sugon.com
>
parent
64a2c29b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
Src/bin/decoder_main.cc
Src/bin/decoder_main.cc
+9
-9
No files found.
Src/bin/decoder_main.cc
View file @
d6085cc0
...
@@ -19,16 +19,16 @@ DEFINE_bool(continuous_decoding, false, "continuous decoding mode");
...
@@ -19,16 +19,16 @@ DEFINE_bool(continuous_decoding, false, "continuous decoding mode");
DEFINE_int32
(
thread_num
,
1
,
"num of decode thread"
);
DEFINE_int32
(
thread_num
,
1
,
"num of decode thread"
);
DEFINE_int32
(
warmup
,
0
,
"num of warmup decode, 0 means no warmup"
);
DEFINE_int32
(
warmup
,
0
,
"num of warmup decode, 0 means no warmup"
);
std
::
shared_ptr
<
wenet
::
DecodeOptions
>
g_decode_config
;
//
std::shared_ptr<wenet::DecodeOptions> g_decode_config;
std
::
shared_ptr
<
wenet
::
FeaturePipelineConfig
>
g_feature_config
;
//
std::shared_ptr<wenet::FeaturePipelineConfig> g_feature_config;
std
::
shared_ptr
<
wenet
::
DecodeResource
>
g_decode_resource
;
//
std::shared_ptr<wenet::DecodeResource> g_decode_resource;
std
::
ofstream
g_result
;
std
::
ofstream
g_result
;
std
::
mutex
g_mutex
;
std
::
mutex
g_mutex
;
int
g_total_waves_dur
=
0
;
int
g_total_waves_dur
=
0
;
int
g_total_decode_time
=
0
;
int
g_total_decode_time
=
0
;
void
Decode
(
std
::
pair
<
std
::
string
,
std
::
string
>
wav
,
bool
warmup
=
fals
e
)
{
void
Decode
(
std
::
pair
<
std
::
string
,
std
::
string
>
wav
,
bool
warmup
,
std
::
shared_ptr
<
wenet
::
DecodeOptions
>
g_decode_config
,
std
::
shared_ptr
<
wenet
::
FeaturePipelineConfig
>
g_feature_config
,
std
::
shared_ptr
<
wenet
::
DecodeResource
>
g_decode_resourc
e
)
{
wenet
::
WavReader
wav_reader
(
wav
.
second
);
wenet
::
WavReader
wav_reader
(
wav
.
second
);
int
num_samples
=
wav_reader
.
num_samples
();
int
num_samples
=
wav_reader
.
num_samples
();
CHECK_EQ
(
wav_reader
.
sample_rate
(),
FLAGS_sample_rate
);
CHECK_EQ
(
wav_reader
.
sample_rate
(),
FLAGS_sample_rate
);
...
@@ -120,9 +120,9 @@ int main(int argc, char* argv[]) {
...
@@ -120,9 +120,9 @@ int main(int argc, char* argv[]) {
gflags
::
ParseCommandLineFlags
(
&
argc
,
&
argv
,
false
);
gflags
::
ParseCommandLineFlags
(
&
argc
,
&
argv
,
false
);
google
::
InitGoogleLogging
(
argv
[
0
]);
google
::
InitGoogleLogging
(
argv
[
0
]);
g_decode_config
=
wenet
::
InitDecodeOptionsFromFlags
();
std
::
shared_ptr
<
wenet
::
DecodeOptions
>
g_decode_config
=
wenet
::
InitDecodeOptionsFromFlags
();
g_feature_config
=
wenet
::
InitFeaturePipelineConfigFromFlags
();
std
::
shared_ptr
<
wenet
::
FeaturePipelineConfig
>
g_feature_config
=
wenet
::
InitFeaturePipelineConfigFromFlags
();
g_decode_resource
=
wenet
::
InitDecodeResourceFromFlags
();
std
::
shared_ptr
<
wenet
::
DecodeResource
>
g_decode_resource
=
wenet
::
InitDecodeResourceFromFlags
();
if
(
FLAGS_wav_path
.
empty
()
&&
FLAGS_wav_scp
.
empty
())
{
if
(
FLAGS_wav_path
.
empty
()
&&
FLAGS_wav_scp
.
empty
())
{
LOG
(
FATAL
)
<<
"Please provide the wave path or the wav scp."
;
LOG
(
FATAL
)
<<
"Please provide the wave path or the wav scp."
;
...
@@ -156,7 +156,7 @@ int main(int argc, char* argv[]) {
...
@@ -156,7 +156,7 @@ int main(int argc, char* argv[]) {
ThreadPool
pool
(
FLAGS_thread_num
);
ThreadPool
pool
(
FLAGS_thread_num
);
auto
wav
=
waves
[
0
];
auto
wav
=
waves
[
0
];
for
(
int
i
=
0
;
i
<
FLAGS_warmup
;
i
++
)
{
for
(
int
i
=
0
;
i
<
FLAGS_warmup
;
i
++
)
{
pool
.
enqueue
(
Decode
,
wav
,
true
);
pool
.
enqueue
(
Decode
,
wav
,
true
,
g_decode_config
,
g_feature_config
,
g_decode_resource
);
}
}
}
}
LOG
(
INFO
)
<<
"Warmup done."
;
LOG
(
INFO
)
<<
"Warmup done."
;
...
@@ -165,7 +165,7 @@ int main(int argc, char* argv[]) {
...
@@ -165,7 +165,7 @@ int main(int argc, char* argv[]) {
{
{
ThreadPool
pool
(
FLAGS_thread_num
);
ThreadPool
pool
(
FLAGS_thread_num
);
for
(
auto
&
wav
:
waves
)
{
for
(
auto
&
wav
:
waves
)
{
pool
.
enqueue
(
Decode
,
wav
,
false
);
pool
.
enqueue
(
Decode
,
wav
,
false
,
g_decode_config
,
g_feature_config
,
g_decode_resource
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment