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-05 18:05:18 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2023-08-05 18:05:18 +0800
Commit
c5756734a96df0856125a67be448308ea5b56e56
c5756734
1 parent
5c9aebd5
Use parse options to parse arguments from sherpa-onnx-microphone (#237)
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
18 行增加
和
36 行删除
sherpa-onnx/csrc/sherpa-onnx-microphone.cc
sherpa-onnx/csrc/sherpa-onnx-microphone.cc
查看文件 @
c575673
...
...
@@ -36,53 +36,35 @@ static void Handler(int32_t sig) {
}
int32_t
main
(
int32_t
argc
,
char
*
argv
[])
{
if
(
argc
<
5
||
argc
>
7
)
{
const
char
*
usage
=
R"usage(
signal
(
SIGINT
,
Handler
);
const
char
*
kUsageMessage
=
R"usage(
This program uses streaming models with microphone for speech recognition.
Usage:
./bin/sherpa-onnx-microphone \
/path/to/tokens.txt \
/path/to/encoder.onnx\
/path/to/decoder.onnx\
/path/to/joiner.onnx\
[num_threads [decoding_method]]
Default value for num_threads is 2.
Valid values for decoding_method: greedy_search (default), modified_beam_search.
./bin/sherpa-onnx-microphone \
--tokens=/path/to/tokens.txt \
--encoder=/path/to/encoder.onnx \
--decoder=/path/to/decoder.onnx \
--joiner=/path/to/joiner.onnx \
--provider=cpu \
--num-threads=1 \
--decoding-method=greedy_search
Please refer to
https://k2-fsa.github.io/sherpa/onnx/pretrained_models/index.html
for a list of pre-trained models to download.
)usage"
;
fprintf
(
stderr
,
"%s
\n
"
,
usage
);
fprintf
(
stderr
,
"argc, %d
\n
"
,
argc
);
return
0
;
}
signal
(
SIGINT
,
Handler
);
sherpa_onnx
::
ParseOptions
po
(
kUsageMessage
);
sherpa_onnx
::
OnlineRecognizerConfig
config
;
config
.
model_config
.
tokens
=
argv
[
1
];
config
.
model_config
.
debug
=
false
;
config
.
model_config
.
encoder_filename
=
argv
[
2
];
config
.
model_config
.
decoder_filename
=
argv
[
3
];
config
.
model_config
.
joiner_filename
=
argv
[
4
];
config
.
model_config
.
num_threads
=
2
;
if
(
argc
==
6
&&
atoi
(
argv
[
5
])
>
0
)
{
config
.
model_config
.
num_threads
=
atoi
(
argv
[
5
]);
}
if
(
argc
==
7
)
{
config
.
decoding_method
=
argv
[
6
];
config
.
Register
(
&
po
);
po
.
Read
(
argc
,
argv
);
if
(
po
.
NumArgs
()
!=
0
)
{
po
.
PrintUsage
();
exit
(
EXIT_FAILURE
);
}
config
.
max_active_paths
=
4
;
config
.
enable_endpoint
=
true
;
config
.
endpoint_config
.
rule1
.
min_trailing_silence
=
2.4
;
config
.
endpoint_config
.
rule2
.
min_trailing_silence
=
1.2
;
config
.
endpoint_config
.
rule3
.
min_utterance_length
=
300
;
fprintf
(
stderr
,
"%s
\n
"
,
config
.
ToString
().
c_str
());
...
...
请
注册
或
登录
后发表评论