From c3e2ca4b73d1d798cd7ec25263e06c357d9d9a2f Mon Sep 17 00:00:00 2001
From: zhifu gao <zhifu.gzf@alibaba-inc.com>
Date: Wed, 8 Nov 2023 18:46:29 +0800
Subject: [PATCH 1/5] Update README.md

---
 README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index e51d8bdeb..3f6b4349e 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@
 | [**Quick Start**](#quick-start)
 | [**Runtime**](./runtime/readme.md)
 | [**Model Zoo**](#model-zoo)
-| [**Contact**](#community-communication)
+| [**Contact**](#contact)
 
 
 <a name="highlights"></a>
@@ -126,7 +126,7 @@ FunASR supports deploying pre-trained or further fine-tuned models for service.
 For more detailed information, please refer to the [service deployment documentation](runtime/readme.md).
 
 
-<a name="Community Communication"></a>
+<a name="contact"></a>
 ## Community Communication
 If you encounter problems in use, you can directly raise Issues on the github page.
 

From 71f95f256bfa10a6b67539700e17f1eda45414dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=9B=BE=E8=81=AA?= <wucong.lyb@alibaba-inc.com>
Date: Thu, 9 Nov 2023 10:56:22 +0800
Subject: [PATCH 2/5] update funasr-onnx-2pass.cpp

---
 runtime/onnxruntime/bin/funasr-onnx-2pass-rtf.cpp | 2 +-
 runtime/onnxruntime/bin/funasr-onnx-2pass.cpp     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/runtime/onnxruntime/bin/funasr-onnx-2pass-rtf.cpp b/runtime/onnxruntime/bin/funasr-onnx-2pass-rtf.cpp
index 5bf8f18ae..c55c888d4 100644
--- a/runtime/onnxruntime/bin/funasr-onnx-2pass-rtf.cpp
+++ b/runtime/onnxruntime/bin/funasr-onnx-2pass-rtf.cpp
@@ -279,7 +279,7 @@ int main(int argc, char** argv)
     // hotword file
     unordered_map<string, int> hws_map;
     std::string nn_hotwords_ = "";
-    std::string hotword_path = model_path.at(HOTWORD);
+    std::string hotword_path = hotword.getValue();
     LOG(INFO) << "hotword path: " << hotword_path;
     funasr::ExtractHws(hotword_path, hws_map, nn_hotwords_);
 
diff --git a/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp b/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp
index d0154999d..5af0b414a 100644
--- a/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp
+++ b/runtime/onnxruntime/bin/funasr-onnx-2pass.cpp
@@ -113,7 +113,7 @@ int main(int argc, char** argv)
     // hotword file
     unordered_map<string, int> hws_map;
     std::string nn_hotwords_ = "";
-    std::string hotword_path = model_path.at(HOTWORD);
+    std::string hotword_path = hotword.getValue();
     LOG(INFO) << "hotword path: " << hotword_path;
     funasr::ExtractHws(hotword_path, hws_map, nn_hotwords_);
 

From 9954fae3875c562df348789dc837ffd49335d9e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=9B=BE=E8=81=AA?= <wucong.lyb@alibaba-inc.com>
Date: Thu, 9 Nov 2023 11:04:21 +0800
Subject: [PATCH 3/5] tokenizer.cpp

---
 runtime/onnxruntime/src/tokenizer.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/runtime/onnxruntime/src/tokenizer.cpp b/runtime/onnxruntime/src/tokenizer.cpp
index a111b9157..f56601a95 100644
--- a/runtime/onnxruntime/src/tokenizer.cpp
+++ b/runtime/onnxruntime/src/tokenizer.cpp
@@ -17,8 +17,12 @@ CTokenizer::CTokenizer():m_ready(false)
 
 CTokenizer::~CTokenizer()
 {
-	delete jieba_dict_trie_;
-    delete jieba_model_;
+	if (jieba_dict_trie_){
+		delete jieba_dict_trie_;
+	}
+	if (jieba_model_){
+    	delete jieba_model_;
+	}
 }
 
 void CTokenizer::SetJiebaRes(cppjieba::DictTrie *dict, cppjieba::HMMModel *hmm) {

From b0c108279275a5c0011dfcf76b3e725b3263209b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=9B=BE=E8=81=AA?= <wucong.lyb@alibaba-inc.com>
Date: Thu, 9 Nov 2023 11:05:51 +0800
Subject: [PATCH 4/5] update tokenizer.h

---
 runtime/onnxruntime/src/tokenizer.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/runtime/onnxruntime/src/tokenizer.h b/runtime/onnxruntime/src/tokenizer.h
index 149161ba3..166061bd4 100644
--- a/runtime/onnxruntime/src/tokenizer.h
+++ b/runtime/onnxruntime/src/tokenizer.h
@@ -17,8 +17,8 @@ class CTokenizer {
 	vector<string>   m_id2token,m_id2punc;
 	map<string, int>  m_token2id,m_punc2id;
 
-	cppjieba::DictTrie *jieba_dict_trie_;
-    cppjieba::HMMModel *jieba_model_;
+	cppjieba::DictTrie *jieba_dict_trie_=nullptr;
+    cppjieba::HMMModel *jieba_model_=nullptr;
 	cppjieba::Jieba jieba_processor_;
 
 public:

From d90de51e76099a308e731e3575f76a71cc684f95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8C=97=E5=BF=B5?= <lzr265946@alibaba-inc.com>
Date: Thu, 9 Nov 2023 11:06:07 +0800
Subject: [PATCH 5/5] fix paraformer finetune bug

---
 funasr/bin/build_trainer.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/funasr/bin/build_trainer.py b/funasr/bin/build_trainer.py
index 61af7663d..bda83ec87 100644
--- a/funasr/bin/build_trainer.py
+++ b/funasr/bin/build_trainer.py
@@ -548,7 +548,10 @@ def build_trainer(modelscope_dict,
     init_param = modelscope_dict['init_model']
     cmvn_file = modelscope_dict['cmvn_file']
     seg_dict_file = modelscope_dict['seg_dict']
-    bpemodel = modelscope_dict['bpemodel']
+    if 'bpemodel' in modelscope_dict:
+        bpemodel = modelscope_dict['bpemodel']
+    else:
+        bpemodel = None
 
     # overwrite parameters
     with open(config) as f:
@@ -582,7 +585,7 @@ def build_trainer(modelscope_dict,
         args.seg_dict_file = seg_dict_file
     else:
         args.seg_dict_file = None
-    if os.path.exists(bpemodel):
+    if bpemodel is not None and os.path.exists(bpemodel):
         args.bpemodel = bpemodel
     else:
         args.bpemodel = None