From e899096ce46ab74be7bdce64e24b91e86bb3be78 Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期三, 11 十月 2023 16:19:52 +0800
Subject: [PATCH] Merge branch 'main' of github.com:alibaba-damo-academy/FunASR add
---
funasr/runtime/onnxruntime/src/ct-transformer-online.cpp | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/funasr/runtime/onnxruntime/src/ct-transformer-online.cpp b/funasr/runtime/onnxruntime/src/ct-transformer-online.cpp
index 51f2a6a..2198667 100644
--- a/funasr/runtime/onnxruntime/src/ct-transformer-online.cpp
+++ b/funasr/runtime/onnxruntime/src/ct-transformer-online.cpp
@@ -17,7 +17,7 @@
session_options.DisableCpuMemArena();
try{
- m_session = std::make_unique<Ort::Session>(env_, punc_model.c_str(), session_options);
+ m_session = std::make_unique<Ort::Session>(env_, ORTSTRING(punc_model).c_str(), session_options);
LOG(INFO) << "Successfully load model from " << punc_model;
}
catch (std::exception const &e) {
@@ -74,8 +74,8 @@
for (size_t i = 0; i < InputData.size(); i += TOKEN_LEN)
{
nDiff = (i + TOKEN_LEN) < InputData.size() ? (0) : (i + TOKEN_LEN - InputData.size());
- vector<int32_t> InputIDs(InputData.begin() + i, InputData.begin() + i + TOKEN_LEN - nDiff);
- vector<string> InputStr(strOut.begin() + i, strOut.begin() + i + TOKEN_LEN - nDiff);
+ vector<int32_t> InputIDs(InputData.begin() + i, InputData.begin() + i + (TOKEN_LEN - nDiff));
+ vector<string> InputStr(strOut.begin() + i, strOut.begin() + i + (TOKEN_LEN - nDiff));
InputIDs.insert(InputIDs.begin(), RemainIDs.begin(), RemainIDs.end()); // RemainIDs+InputIDs;
InputStr.insert(InputStr.begin(), RemainStr.begin(), RemainStr.end()); // RemainStr+InputStr;
@@ -102,10 +102,10 @@
nSentEnd = nLastCommaIndex;
Punction[nSentEnd] = PERIOD_INDEX;
}
- RemainStr.assign(InputStr.begin() + nSentEnd + 1, InputStr.end());
- RemainIDs.assign(InputIDs.begin() + nSentEnd + 1, InputIDs.end());
- InputStr.assign(InputStr.begin(), InputStr.begin() + nSentEnd + 1); // minit_sentence
- Punction.assign(Punction.begin(), Punction.begin() + nSentEnd + 1);
+ RemainStr.assign(InputStr.begin() + (nSentEnd + 1), InputStr.end());
+ RemainIDs.assign(InputIDs.begin() + (nSentEnd + 1), InputIDs.end());
+ InputStr.assign(InputStr.begin(), InputStr.begin() + (nSentEnd + 1)); // minit_sentence
+ Punction.assign(Punction.begin(), Punction.begin() + (nSentEnd + 1));
}
for (auto& item : Punction)
@@ -149,7 +149,7 @@
break;
}
}
- arr_cache.assign(sentence_words_list.begin() + nSentEnd + 1, sentence_words_list.end());
+ arr_cache.assign(sentence_words_list.begin() + (nSentEnd + 1), sentence_words_list.end());
if (sentenceOut.size() > 0 && m_tokenizer.IsPunc(sentenceOut[sentenceOut.size() - 1]))
{
--
Gitblit v1.9.1