From 01df8f330ccc754223d5e2d688dc0a55d27f2dcc Mon Sep 17 00:00:00 2001
From: querryton <72929808+querryton@users.noreply.github.com>
Date: 星期六, 20 四月 2024 16:07:13 +0800
Subject: [PATCH] [fix] Fix a bug in seaco_paraformer model "inference" function (#1639)
---
runtime/onnxruntime/src/offline-stream.cpp | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/runtime/onnxruntime/src/offline-stream.cpp b/runtime/onnxruntime/src/offline-stream.cpp
index 2709ca6..ae8cf18 100644
--- a/runtime/onnxruntime/src/offline-stream.cpp
+++ b/runtime/onnxruntime/src/offline-stream.cpp
@@ -63,10 +63,16 @@
// Lm resource
if (model_path.find(LM_DIR) != model_path.end() && model_path.at(LM_DIR) != "") {
- string fst_path, lm_config_path, hws_path;
+ string fst_path, lm_config_path, lex_path;
fst_path = PathAppend(model_path.at(LM_DIR), LM_FST_RES);
lm_config_path = PathAppend(model_path.at(LM_DIR), LM_CONFIG_NAME);
- asr_handle->InitLm(fst_path, lm_config_path);
+ lex_path = PathAppend(model_path.at(LM_DIR), LEX_PATH);
+ if (access(lex_path.c_str(), F_OK) != 0 )
+ {
+ LOG(ERROR) << "Lexicon.txt file is not exist, please use the latest version. Skip load LM model.";
+ }else{
+ asr_handle->InitLm(fst_path, lm_config_path, lex_path);
+ }
}
// PUNC model
--
Gitblit v1.9.1