From d80ac2fd2df4e7fb8a28acfa512bb11472b5cc99 Mon Sep 17 00:00:00 2001
From: liugz18 <57401541+liugz18@users.noreply.github.com>
Date: 星期四, 18 七月 2024 21:34:55 +0800
Subject: [PATCH] Rename 'res' in line 514 to avoid with naming conflict with line 365
---
runtime/onnxruntime/src/ct-transformer-online.cpp | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/runtime/onnxruntime/src/ct-transformer-online.cpp b/runtime/onnxruntime/src/ct-transformer-online.cpp
index 2198667..92fe41e 100644
--- a/runtime/onnxruntime/src/ct-transformer-online.cpp
+++ b/runtime/onnxruntime/src/ct-transformer-online.cpp
@@ -11,7 +11,7 @@
{
}
-void CTTransformerOnline::InitPunc(const std::string &punc_model, const std::string &punc_config, int thread_num){
+void CTTransformerOnline::InitPunc(const std::string &punc_model, const std::string &punc_config, const std::string &token_file, int thread_num){
session_options.SetIntraOpNumThreads(thread_num);
session_options.SetGraphOptimizationLevel(ORT_ENABLE_ALL);
session_options.DisableCpuMemArena();
@@ -43,7 +43,7 @@
for (auto& item : m_strOutputNames)
m_szOutputNames.push_back(item.c_str());
- m_tokenizer.OpenYaml(punc_config.c_str());
+ m_tokenizer.OpenYaml(punc_config.c_str(), token_file.c_str());
}
CTTransformerOnline::~CTTransformerOnline()
@@ -120,9 +120,9 @@
vector<string> WordWithPunc;
for (int i = 0; i < sentence_words_list.size(); i++) // for i in range(0, len(sentence_words_list)):
{
- if (i > 0 && !(sentence_words_list[i][0] & 0x80) && (i + 1) < sentence_words_list.size() && !(sentence_words_list[i + 1][0] & 0x80))
+ if (!(sentence_words_list[i][0] & 0x80) && (i + 1) < sentence_words_list.size() && !(sentence_words_list[i + 1][0] & 0x80))
{
- sentence_words_list[i] = sentence_words_list[i] + " ";
+ sentence_words_list[i] = " " + sentence_words_list[i];
}
if (nSkipNum < arr_cache.size()) // if skip_num < len(cache):
nSkipNum++;
--
Gitblit v1.9.1