From 1358e8a5fcba9d9da4ed1478a91f217e8c211fc0 Mon Sep 17 00:00:00 2001
From: Yabin Li <wucong.lyb@alibaba-inc.com>
Date: 星期一, 08 五月 2023 19:49:51 +0800
Subject: [PATCH] Merge pull request #476 from alibaba-damo-academy/dev_grpc
---
funasr/runtime/onnxruntime/src/tokenizer.cpp | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/funasr/runtime/onnxruntime/src/tokenizer.cpp b/funasr/runtime/onnxruntime/src/tokenizer.cpp
index c38664a..5aff058 100644
--- a/funasr/runtime/onnxruntime/src/tokenizer.cpp
+++ b/funasr/runtime/onnxruntime/src/tokenizer.cpp
@@ -14,6 +14,10 @@
{
}
+CTokenizer::~CTokenizer()
+{
+}
+
void CTokenizer::ReadYaml(const YAML::Node& node)
{
if (node.IsMap())
@@ -29,15 +33,20 @@
}
}
if (node.IsScalar()) {//锟角憋拷锟斤拷锟斤拷
- cout << node.as<string>() << endl;
+ LOG(INFO) << node.as<string>();
}
}
bool CTokenizer::OpenYaml(const char* sz_yamlfile)
{
- YAML::Node m_Config = YAML::LoadFile(sz_yamlfile);
- if (m_Config.IsNull())
- return false;
+ YAML::Node m_Config;
+ try{
+ m_Config = YAML::LoadFile(sz_yamlfile);
+ }catch(exception const &e){
+ LOG(INFO) << "Error loading file, yaml file error or not exist.";
+ exit(-1);
+ }
+
try
{
auto Tokens = m_Config["token_list"];
@@ -66,7 +75,7 @@
}
}
catch (YAML::BadFile& e) {
- std::cout << "read error!" << std::endl;
+ LOG(ERROR) << "Read error!";
return false;
}
m_ready = true;
--
Gitblit v1.9.1