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-09-26 11:04:20 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2023-09-26 11:04:20 +0800
Commit
33a5765169ebcba4651ea871bd1db07aeae07cc4
33a57651
1 parent
9091917e
Print a more user-friendly error message when using --hotwords-file. (#344)
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
38 行增加
和
5 行删除
sherpa-onnx/csrc/offline-recognizer.cc
sherpa-onnx/csrc/online-recognizer-transducer-impl.h
sherpa-onnx/csrc/online-recognizer.cc
sherpa-onnx/python/sherpa_onnx/__init__.py
sherpa-onnx/python/sherpa_onnx/offline_recognizer.py
sherpa-onnx/python/sherpa_onnx/online_recognizer.py
sherpa-onnx/csrc/offline-recognizer.cc
查看文件 @
33a5765
...
...
@@ -46,7 +46,17 @@ bool OfflineRecognizerConfig::Validate() const {
max_active_paths
);
return
false
;
}
if
(
!
lm_config
.
Validate
())
return
false
;
if
(
!
lm_config
.
Validate
())
{
return
false
;
}
}
if
(
!
hotwords_file
.
empty
()
&&
decoding_method
!=
"modified_beam_search"
)
{
SHERPA_ONNX_LOGE
(
"Please use --decoding-method=modified_beam_search if you"
" provide --hotwords-file. Given --decoding-method=%s"
,
decoding_method
.
c_str
());
return
false
;
}
return
model_config
.
Validate
();
...
...
sherpa-onnx/csrc/online-recognizer-transducer-impl.h
查看文件 @
33a5765
...
...
@@ -156,8 +156,9 @@ class OnlineRecognizerTransducerImpl : public OnlineRecognizerImpl {
bool
has_context_graph
=
false
;
for
(
int32_t
i
=
0
;
i
!=
n
;
++
i
)
{
if
(
!
has_context_graph
&&
ss
[
i
]
->
GetContextGraph
())
if
(
!
has_context_graph
&&
ss
[
i
]
->
GetContextGraph
())
{
has_context_graph
=
true
;
}
const
auto
num_processed_frames
=
ss
[
i
]
->
GetNumProcessedFrames
();
std
::
vector
<
float
>
features
=
...
...
sherpa-onnx/csrc/online-recognizer.cc
查看文件 @
33a5765
...
...
@@ -102,8 +102,20 @@ bool OnlineRecognizerConfig::Validate() const {
max_active_paths
);
return
false
;
}
if
(
!
lm_config
.
Validate
())
return
false
;
if
(
!
lm_config
.
Validate
())
{
return
false
;
}
}
if
(
!
hotwords_file
.
empty
()
&&
decoding_method
!=
"modified_beam_search"
)
{
SHERPA_ONNX_LOGE
(
"Please use --decoding-method=modified_beam_search if you"
" provide --hotwords-file. Given --decoding-method=%s"
,
decoding_method
.
c_str
());
return
false
;
}
return
model_config
.
Validate
();
}
...
...
sherpa-onnx/python/sherpa_onnx/__init__.py
查看文件 @
33a5765
from
typing
import
Dict
,
List
,
Optional
from
_sherpa_onnx
import
(
CircularBuffer
,
Display
,
...
...
sherpa-onnx/python/sherpa_onnx/offline_recognizer.py
查看文件 @
33a5765
...
...
@@ -102,6 +102,12 @@ class OfflineRecognizer(object):
feature_dim
=
feature_dim
,
)
if
len
(
hotwords_file
)
>
0
and
decoding_method
!=
"modified_beam_search"
:
raise
ValueError
(
"Please use --decoding-method=modified_beam_search when using "
f
"--hotwords-file. Currently given: {decoding_method}"
)
recognizer_config
=
OfflineRecognizerConfig
(
feat_config
=
feat_config
,
model_config
=
model_config
,
...
...
sherpa-onnx/python/sherpa_onnx/online_recognizer.py
查看文件 @
33a5765
...
...
@@ -132,6 +132,12 @@ class OnlineRecognizer(object):
rule3_min_utterance_length
=
rule3_min_utterance_length
,
)
if
len
(
hotwords_file
)
>
0
and
decoding_method
!=
"modified_beam_search"
:
raise
ValueError
(
"Please use --decoding-method=modified_beam_search when using "
f
"--hotwords-file. Currently given: {decoding_method}"
)
recognizer_config
=
OnlineRecognizerConfig
(
feat_config
=
feat_config
,
model_config
=
model_config
,
...
...
请
注册
或
登录
后发表评论