From 6d6c6e3c79216896c45ff87b4bdfd8226a24924e Mon Sep 17 00:00:00 2001
From: 雾聪 <wucong.lyb@alibaba-inc.com>
Date: 星期二, 14 十一月 2023 19:22:17 +0800
Subject: [PATCH] update docs; update run_server.sh; fix initlm

---
 runtime/onnxruntime/src/paraformer.cpp |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/runtime/onnxruntime/src/paraformer.cpp b/runtime/onnxruntime/src/paraformer.cpp
index b6babfe..11ed0ff 100644
--- a/runtime/onnxruntime/src/paraformer.cpp
+++ b/runtime/onnxruntime/src/paraformer.cpp
@@ -191,9 +191,13 @@
     try {
         lm_ = std::shared_ptr<fst::Fst<fst::StdArc>>(
             fst::Fst<fst::StdArc>::Read(lm_file));
-        if (vocab) { delete vocab; }
-        vocab = new Vocab(lm_cfg_file.c_str());
-        LOG(INFO) << "Successfully load lm file " << lm_file;
+        if (lm_){
+            if (vocab) { delete vocab; }
+            vocab = new Vocab(lm_cfg_file.c_str());
+            LOG(INFO) << "Successfully load lm file " << lm_file;
+        }else{
+            LOG(ERROR) << "Failed to load lm file " << lm_file;
+        }
     } catch (std::exception const &e) {
         LOG(ERROR) << "Error when load lm file: " << e.what();
         exit(0);

--
Gitblit v1.9.1