Allow more online models to load tokens file from the memory (#1352)

Co-authored-by: xiao <shawl336@6163.com>
This commit is contained in:
lxiao336
2024-09-20 16:38:41 +08:00
committed by GitHub
parent 73c90ec871
commit 06b61ccad8
15 changed files with 735 additions and 15 deletions

View File

@@ -99,8 +99,14 @@ class OnlineRecognizerParaformerImpl : public OnlineRecognizerImpl {
: OnlineRecognizerImpl(config),
config_(config),
model_(config.model_config),
sym_(config.model_config.tokens),
endpoint_(config_.endpoint_config) {
if (!config.model_config.tokens_buf.empty()) {
sym_ = SymbolTable(config.model_config.tokens_buf, false);
} else {
/// assuming tokens_buf and tokens are guaranteed not being both empty
sym_ = SymbolTable(config.model_config.tokens, true);
}
if (config.decoding_method != "greedy_search") {
SHERPA_ONNX_LOGE(
"Unsupported decoding method: %s. Support only greedy_search at "