From 0511c380b7b9caebfe34d2ea142b1b96f58b0ffd Mon Sep 17 00:00:00 2001 From: qiuleilei Date: Mon, 28 Jul 2025 21:42:56 +0800 Subject: [PATCH] bugfix --- .../ascend_model_group_cpp/main.cc | 2 - mindspore-lite/examples/ilsvrc2012/main.py | 1 - .../examples/train_lenet_cpp/src/inference.cc | 6 +- .../train_lenet_cpp/src/net_runner.cc | 6 +- .../mindspore/lite/train_lenet/NetRunner.java | 4 +- .../transfer_learning/src/net_runner.cc | 2 +- .../java/native/common/jni_utils.cpp | 2 +- .../dpico/manager/custom_config_manager.cc | 9 ++- .../python/src/lite_infer_pybind.cc | 3 +- mindspore-lite/python/src/model_pybind.cc | 3 +- mindspore-lite/src/common/config_file.cc | 6 +- mindspore-lite/src/common/file_utils.cc | 30 +++++----- mindspore-lite/src/common/file_utils.h | 4 +- mindspore-lite/src/common/mmap_utils.cc | 2 +- mindspore-lite/src/common/storage.cc | 4 +- mindspore-lite/src/extendrt/cxx_api/dlutils.h | 2 +- .../src/extendrt/cxx_api/model/model_group.cc | 1 - .../src/extendrt/cxx_api/model/model_impl.cc | 10 ++-- .../extendrt/cxx_api/model_pool/model_pool.cc | 6 +- .../delegate/ascend_acl/acl_env_guard.cc | 2 +- .../ascend_ge/aoe_api_tune_process.cc | 2 + .../delegate/ascend_ge/ge_graph_executor.cc | 28 +++------- .../src/extendrt/delegate/comm_group_info.cc | 56 +++++++++---------- .../mindir_model/mindir_model.cc | 2 +- .../src/extendrt/utils/serialization.cc | 6 +- .../test/st/java/src/main/java/Benchmark.java | 6 +- .../st/python/test_large_model_inference.py | 3 +- .../cxx_api/model/acl/acl_model_options.cc | 8 +-- .../tools/converter/converter_funcgraph.cc | 2 +- 29 files changed, 98 insertions(+), 120 deletions(-) diff --git a/mindspore-lite/examples/cloud_infer/ascend_model_group_cpp/main.cc b/mindspore-lite/examples/cloud_infer/ascend_model_group_cpp/main.cc index f14c703a..c3a5826f 100644 --- a/mindspore-lite/examples/cloud_infer/ascend_model_group_cpp/main.cc +++ b/mindspore-lite/examples/cloud_infer/ascend_model_group_cpp/main.cc @@ -60,8 +60,6 @@ int GenerateInputDataWithRandom(std::vector inputs) { void ThreadFunc(ThreadArgs threadArg) { mindspore::Model model1; mindspore::Model model2; - std::cout << threadArg.model_paths[0] << std::endl; - std::cout << threadArg.model_paths[1] << std::endl; threadArg.model_group->AddModel(threadArg.model_paths); std::cout << "add model finished!" << std::endl; threadArg.model_group->CalMaxSizeOfWorkspace(mindspore::kMindIR, threadArg.context); diff --git a/mindspore-lite/examples/ilsvrc2012/main.py b/mindspore-lite/examples/ilsvrc2012/main.py index f7c97f51..ef8bc683 100644 --- a/mindspore-lite/examples/ilsvrc2012/main.py +++ b/mindspore-lite/examples/ilsvrc2012/main.py @@ -72,7 +72,6 @@ def create_model(model_path): if not path.isfile(model_path): raise RuntimeError("Please make sure your model file exists") cpu_device_info = mslite.CPUDeviceInfo(enable_fp16=False) - print("cpu_device_info: ", cpu_device_info) context = mslite.Context(thread_num=1, thread_affinity_mode=2) context.append_device_info(cpu_device_info) model = mslite.Model() diff --git a/mindspore-lite/examples/train_lenet_cpp/src/inference.cc b/mindspore-lite/examples/train_lenet_cpp/src/inference.cc index b60871cc..3cb23469 100644 --- a/mindspore-lite/examples/train_lenet_cpp/src/inference.cc +++ b/mindspore-lite/examples/train_lenet_cpp/src/inference.cc @@ -56,14 +56,14 @@ int main(int argc, char **argv) { mindspore::Graph graph; auto status = mindspore::Serialization::Load(infer_model_fn, mindspore::kMindIR, &graph); if (status != mindspore::kSuccess) { - std::cout << "Error " << status << " during serialization of graph " << infer_model_fn; + std::cout << "Error " << status << " during serialization of graph."; MS_ASSERT(status != mindspore::kSuccess); } mindspore::Model model; status = model.Build(mindspore::GraphCell(graph), context); if (status != mindspore::kSuccess) { - std::cout << "Error " << status << " during build of model " << infer_model_fn; + std::cout << "Error " << status << " during build of model."; MS_ASSERT(status != mindspore::kSuccess); } @@ -95,7 +95,7 @@ int main(int argc, char **argv) { std::vector outputs; status = model.Predict({*input_tensor}, &outputs); if (status != mindspore::kSuccess) { - std::cout << "Error " << status << " during running predict of model " << infer_model_fn; + std::cout << "Error " << status << " during running predict of model."; MS_ASSERT(status != mindspore::kSuccess); } diff --git a/mindspore-lite/examples/train_lenet_cpp/src/net_runner.cc b/mindspore-lite/examples/train_lenet_cpp/src/net_runner.cc index f8adb969..fbdc2db3 100644 --- a/mindspore-lite/examples/train_lenet_cpp/src/net_runner.cc +++ b/mindspore-lite/examples/train_lenet_cpp/src/net_runner.cc @@ -129,7 +129,7 @@ void NetRunner::InitAndFigureInputs() { auto status = mindspore::Serialization::Load(ms_file_, mindspore::kMindIR, graph_); if (status != mindspore::kSuccess) { - std::cout << "Error " << status << " during serialization of graph " << ms_file_; + std::cout << "Error " << status << " during serialization of graph."; MS_ASSERT(status != mindspore::kSuccess); } @@ -143,7 +143,7 @@ void NetRunner::InitAndFigureInputs() { status = model_->Build(mindspore::GraphCell(*graph_), context, cfg); if (status != mindspore::kSuccess) { - std::cout << "Error " << status << " during build of model " << ms_file_; + std::cout << "Error " << status << " during build of model."; MS_ASSERT(status != mindspore::kSuccess); } @@ -192,7 +192,7 @@ int NetRunner::InitDB() { std::cout << "DatasetSize is " << train_ds_->GetDatasetSize() << std::endl; } if (train_ds_->GetDatasetSize() == 0) { - std::cout << "No relevant data was found in " << data_dir_ << std::endl; + std::cout << "No relevant data was found in data dir." << std::endl; MS_ASSERT(train_ds_->GetDatasetSize() != 0); } return 0; diff --git a/mindspore-lite/examples/train_lenet_java/src/main/java/com/mindspore/lite/train_lenet/NetRunner.java b/mindspore-lite/examples/train_lenet_java/src/main/java/com/mindspore/lite/train_lenet/NetRunner.java index e400dd18..57bb9103 100644 --- a/mindspore-lite/examples/train_lenet_java/src/main/java/com/mindspore/lite/train_lenet/NetRunner.java +++ b/mindspore-lite/examples/train_lenet_java/src/main/java/com/mindspore/lite/train_lenet/NetRunner.java @@ -250,7 +250,7 @@ public class NetRunner { public void trainModel(String modelPath, String datasetPath, int virtualBatch) { int index = modelPath.lastIndexOf(".ms"); if (index == -1) { - System.err.println("The model " + modelPath + " should be named *.ms"); + System.err.println("The modelPath should be named *.ms"); return; } System.out.println("==========Loading Model, Create Train Session============="); @@ -284,7 +284,7 @@ public class NetRunner { // arg 3: use default output tensor names String trainedFilePath = modelPath.substring(0, index) + "_trained.ms"; if (model.export(trainedFilePath, 0, false, new ArrayList<>())) { - System.out.println("Trained model successfully saved: " + trainedFilePath); + System.out.println("Trained model successfully saved."); } else { System.err.println("Save model error."); } diff --git a/mindspore-lite/examples/transfer_learning/src/net_runner.cc b/mindspore-lite/examples/transfer_learning/src/net_runner.cc index bb7c7033..23c3c3f2 100644 --- a/mindspore-lite/examples/transfer_learning/src/net_runner.cc +++ b/mindspore-lite/examples/transfer_learning/src/net_runner.cc @@ -168,7 +168,7 @@ int NetRunner::InitDB() { } if (ds_.test_data().size() == 0) { - std::cout << "No relevant data was found in " << data_dir_ << std::endl; + std::cout << "No relevant data was found in data dir." << std::endl; MS_ASSERT(ds_.test_data().size() != 0); } diff --git a/mindspore-lite/java/native/common/jni_utils.cpp b/mindspore-lite/java/native/common/jni_utils.cpp index 98e4641a..93dbbb54 100644 --- a/mindspore-lite/java/native/common/jni_utils.cpp +++ b/mindspore-lite/java/native/common/jni_utils.cpp @@ -41,7 +41,7 @@ std::string RealPath(const char *path) { char *real_path = realpath(path, resolved_path.get()); #endif if (real_path == nullptr || strlen(real_path) == 0) { - MS_LOG(ERROR) << "file path is not valid : " << path; + MS_LOG(ERROR) << "file path is not valid."; return ""; } std::string res = resolved_path.get(); diff --git a/mindspore-lite/providers/dpico/manager/custom_config_manager.cc b/mindspore-lite/providers/dpico/manager/custom_config_manager.cc index d2d18ebb..201db932 100644 --- a/mindspore-lite/providers/dpico/manager/custom_config_manager.cc +++ b/mindspore-lite/providers/dpico/manager/custom_config_manager.cc @@ -53,7 +53,7 @@ std::string CustomConfigManager::RealPath(const char *path) { } char *real_path = realpath(path, resolved_path.get()); if (real_path == nullptr || strlen(real_path) == 0) { - MS_LOG(ERROR) << "file path is not valid : " << path; + MS_LOG(ERROR) << "file path is not valid"; return ""; } std::string res = resolved_path.get(); @@ -70,11 +70,10 @@ int CustomConfigManager::UpdateConfig(const std::map & if (IsValidDoubleNum(dpico_config.at(param.first))) { *param.second = std::stof(dpico_config.at(param.first)); } else { - MS_LOG(WARNING) << param.first - << " param in config is invalid, will use default or last value:" << *param.second; + MS_LOG(WARNING) << param.first << " param in config is invalid, will use default or last value."; } } else { - MS_LOG(INFO) << param.first << " param isn't configured, will use default or last value:" << *param.second; + MS_LOG(INFO) << param.first << " param isn't configured, will use default or last value."; } } @@ -102,7 +101,7 @@ int CustomConfigManager::UpdateConfig(const std::map & } auto acl_config_file = RealPath(acl_config_file_.c_str()); if (acl_config_file.empty()) { - MS_LOG(ERROR) << "Get realpath failed, AclConfigPath is " << acl_config_file; + MS_LOG(ERROR) << "Get realpath failed, please check your acl config file."; return RET_ERROR; } } diff --git a/mindspore-lite/python/src/lite_infer_pybind.cc b/mindspore-lite/python/src/lite_infer_pybind.cc index 66bc35b4..c2687d59 100644 --- a/mindspore-lite/python/src/lite_infer_pybind.cc +++ b/mindspore-lite/python/src/lite_infer_pybind.cc @@ -42,8 +42,7 @@ void PyBindModelToModelGroupImpl(ModelImpl *model, int model_group_id) { return; } model->UpdateConfig(lite::kLiteInnerGroupSection, {lite::kLiteInnerGroupId, std::to_string(model_group_id)}); - MS_LOG(INFO) << "Update config " << lite::kLiteInnerGroupId << " to " << model_group_id << ", section " - << lite::kLiteInnerGroupSection; + MS_LOG(INFO) << "Update config " << lite::kLiteInnerGroupId << ", section " << lite::kLiteInnerGroupSection; return; } diff --git a/mindspore-lite/python/src/model_pybind.cc b/mindspore-lite/python/src/model_pybind.cc index 9795dee5..ff575ca6 100644 --- a/mindspore-lite/python/src/model_pybind.cc +++ b/mindspore-lite/python/src/model_pybind.cc @@ -68,8 +68,7 @@ Status PyModelUpdateConfig(Model *model, const std::string &key, const std::map< } for (auto &item : value) { if (model->UpdateConfig(key, item).IsError()) { - MS_LOG(ERROR) << "Update config failed, section: " << key << ", config name: " << item.first - << ", config value: " << item.second; + MS_LOG(ERROR) << "Update config failed, please check your key and value."; return kLiteError; } } diff --git a/mindspore-lite/src/common/config_file.cc b/mindspore-lite/src/common/config_file.cc index 8b17e14f..4b61b5b3 100644 --- a/mindspore-lite/src/common/config_file.cc +++ b/mindspore-lite/src/common/config_file.cc @@ -77,16 +77,16 @@ int GetAllSectionInfoFromConfigFile(const std::string &file, ConfigInfos *config char *real_path = realpath(file.c_str(), resolved_path.get()); #endif if (real_path == nullptr || strlen(real_path) == 0) { - MS_LOG(ERROR) << "file path is not valid : " << file; + MS_LOG(ERROR) << "file path is not valid."; return RET_ERROR; } std::ifstream ifs(resolved_path.get()); if (!ifs.good()) { - MS_LOG(ERROR) << "file: " << real_path << " is not exist"; + MS_LOG(ERROR) << "file is not exist"; return RET_ERROR; } if (!ifs.is_open()) { - MS_LOG(ERROR) << "file: " << real_path << "open failed"; + MS_LOG(ERROR) << "file open failed"; return RET_ERROR; } std::string line; diff --git a/mindspore-lite/src/common/file_utils.cc b/mindspore-lite/src/common/file_utils.cc index 74628e82..987b6730 100644 --- a/mindspore-lite/src/common/file_utils.cc +++ b/mindspore-lite/src/common/file_utils.cc @@ -82,12 +82,12 @@ std::fstream *OpenFile(const std::string &file_path, std::ios_base::openmode ope } fs->open(file_path, open_mode); if (!fs->good()) { - MS_LOG(DEBUG) << "File is not exist: " << file_path; + MS_LOG(DEBUG) << "File is not exist."; delete fs; return nullptr; } if (!fs->is_open()) { - MS_LOG(DEBUG) << "Can not open file: " << file_path; + MS_LOG(DEBUG) << "Can not open file."; delete fs; return nullptr; } @@ -107,17 +107,17 @@ char *ReadFileSegment(const std::string &file, int64_t offset, int64_t len) { auto offset_pos = static_cast(offset); std::string real_path = lite::RealPath(file.c_str()); if (lite::AccessFile(real_path, R_OK) != 0) { - MS_LOG(DEBUG) << "cannot access file:" << real_path << ".please check file if exists and file mod"; + MS_LOG(DEBUG) << "cannot access file, please check file if exists and file mod"; return nullptr; } std::ifstream ifs(real_path, std::ifstream::in | std::ifstream::binary); if (!ifs.good()) { - MS_LOG(DEBUG) << "file: " << real_path << " is not exist"; + MS_LOG(DEBUG) << "file is not exist"; return nullptr; } if (!ifs.is_open()) { - MS_LOG(DEBUG) << "file: " << real_path << " open failed"; + MS_LOG(DEBUG) << "file open failed"; return nullptr; } @@ -137,7 +137,7 @@ char *ReadFileSegment(const std::string &file, int64_t offset, int64_t len) { auto buf = reinterpret_cast(malloc(len)); if (buf == nullptr) { - MS_LOG(ERROR) << "malloc buf failed, file: " << real_path; + MS_LOG(ERROR) << "malloc buf failed."; ifs.close(); return nullptr; } @@ -157,16 +157,16 @@ char *ReadFile(const char *file, size_t *size, std::shared_ptr alloca MS_ASSERT(size != nullptr); std::string real_path = RealPath(file); if (real_path.empty()) { - MS_LOG(DEBUG) << "File path not regular: " << file; + MS_LOG(DEBUG) << "File path not regular."; return nullptr; } #ifndef _MSC_VER if (access(real_path.c_str(), F_OK) != 0) { - MS_LOG(ERROR) << "File is not exist: " << real_path; + MS_LOG(ERROR) << "File is not exist."; return nullptr; } if (access(real_path.c_str(), R_OK) != 0) { - MS_LOG(ERROR) << "File " << real_path << " can't be read. Please change the file permission."; + MS_LOG(ERROR) << "File can't be read. Please change the file permission."; return nullptr; } #endif @@ -194,7 +194,7 @@ char *ReadFile(const char *file, size_t *size, std::shared_ptr alloca model_buf = new (std::nothrow) char[*size]; } if (model_buf == nullptr) { - MS_LOG(ERROR) << "malloc buf failed, file: " << file; + MS_LOG(ERROR) << "malloc buf failed."; ifs->close(); delete ifs; return nullptr; @@ -227,7 +227,7 @@ std::string RealPath(const char *path) { char *real_path = realpath(path, resolved_path.get()); #endif if (real_path == nullptr || strlen(real_path) == 0) { - MS_LOG(ERROR) << "file path not exists: " << path; + MS_LOG(ERROR) << "file path not exists."; return ""; } std::string res = resolved_path.get(); @@ -248,7 +248,7 @@ int CreateDir(const std::string &file_path) { if (AccessFile(file_path.substr(0, i + 1), F_OK) != 0) { int ret = Mkdir(file_path.substr(0, i + 1)); if (ret != RET_OK) { - MS_LOG(ERROR) << "mkdir failed. " << file_path.substr(0, i + 1); + MS_LOG(ERROR) << "mkdir failed. "; return RET_ERROR; } } @@ -259,7 +259,7 @@ int CreateDir(const std::string &file_path) { if (AccessFile(file_path, F_OK) != 0) { int ret = Mkdir(file_path); if (ret != RET_OK) { - MS_LOG(ERROR) << "mkdir failed. " << file_path; + MS_LOG(ERROR) << "mkdir failed. "; return RET_ERROR; } } @@ -289,7 +289,7 @@ int CreateOutputDir(std::string *file_path) { #endif int ret = Mkdir(*file_path); if (ret != RET_OK) { - MS_LOG(ERROR) << "mkdir failed. " << file_path->c_str(); + MS_LOG(ERROR) << "mkdir failed. "; return RET_ERROR; } return RET_OK; @@ -326,7 +326,7 @@ bool ParserPathAndModelName(const std::string &output_path, std::string *save_pa } *save_path = RealPath(save_path->c_str()); if (save_path->empty()) { - MS_LOG(DEBUG) << "File path not regular: " << save_path; + MS_LOG(DEBUG) << "File path not regular."; return false; } auto suffix_pos = tmp_model_name.find_last_of('.'); diff --git a/mindspore-lite/src/common/file_utils.h b/mindspore-lite/src/common/file_utils.h index db983194..516017b8 100644 --- a/mindspore-lite/src/common/file_utils.h +++ b/mindspore-lite/src/common/file_utils.h @@ -84,7 +84,7 @@ inline std::string WriteStrToFile(const std::string &file_path, const std::strin auto full_path = real_path + "/" + file_name; fs.open(full_path, std::ios::out); if (!fs.good() || !fs.is_open()) { - MS_LOG(ERROR) << "Open dot file failed: " << full_path; + MS_LOG(ERROR) << "Open dot file failed."; return ""; } fs.write(content.c_str(), content.size()); @@ -102,7 +102,7 @@ static inline void ChangeFileMode(const std::string &file_name, mode_t mode) { return; } if (chmod(file_name.c_str(), mode) != 0) { - MS_LOG(WARNING) << "Change file `" << file_name << "` to mode " << std::oct << mode << " fail."; + MS_LOG(WARNING) << "Change file to mode " << std::oct << mode << " fail."; } } diff --git a/mindspore-lite/src/common/mmap_utils.cc b/mindspore-lite/src/common/mmap_utils.cc index 7f4f3c69..f2e05d14 100644 --- a/mindspore-lite/src/common/mmap_utils.cc +++ b/mindspore-lite/src/common/mmap_utils.cc @@ -30,7 +30,7 @@ void *ReadFileByMmap(const std::string &file, size_t *size) { MS_CHECK_TRUE_RET(!real_path.empty(), nullptr); auto fd = open(real_path.c_str(), O_RDONLY); if (fd == -1) { - MS_LOG(ERROR) << "Could not open " << file; + MS_LOG(ERROR) << "Could not open file."; return nullptr; } struct stat fd_stat; diff --git a/mindspore-lite/src/common/storage.cc b/mindspore-lite/src/common/storage.cc index b39051fa..906253c7 100644 --- a/mindspore-lite/src/common/storage.cc +++ b/mindspore-lite/src/common/storage.cc @@ -54,13 +54,13 @@ int Storage::Save(const schema::MetaGraphT &graph, const std::string &outputPath #endif std::ofstream output(filename, std::ofstream::binary); if (!output.is_open()) { - MS_LOG(ERROR) << "Can not open output file: " << filename; + MS_LOG(ERROR) << "Can not open output file."; return RET_ERROR; } output.write((const char *)content, size); if (output.bad()) { output.close(); - MS_LOG(ERROR) << "Write output file : " << filename << " failed"; + MS_LOG(ERROR) << "Write output file failed"; return RET_ERROR; } output.close(); diff --git a/mindspore-lite/src/extendrt/cxx_api/dlutils.h b/mindspore-lite/src/extendrt/cxx_api/dlutils.h index 16d1ac14..82cc502b 100644 --- a/mindspore-lite/src/extendrt/cxx_api/dlutils.h +++ b/mindspore-lite/src/extendrt/cxx_api/dlutils.h @@ -35,7 +35,7 @@ inline std::string FindFileWithRecursion(const std::string &parent_dir, const st } DIR *dir = opendir(parent_dir.c_str()); if (dir == nullptr) { - MS_LOG(ERROR) << "Can't open dir " << parent_dir; + MS_LOG(ERROR) << "Can't open dir."; return ""; } dirent *ent = readdir(dir); diff --git a/mindspore-lite/src/extendrt/cxx_api/model/model_group.cc b/mindspore-lite/src/extendrt/cxx_api/model/model_group.cc index 4806ca67..b6e5d7bc 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model/model_group.cc +++ b/mindspore-lite/src/extendrt/cxx_api/model/model_group.cc @@ -35,7 +35,6 @@ Status ModelGroup::AddModel(const std::vector> &model_path_lis MS_LOG(ERROR) << "Model group implement is null."; return kLiteUninitializedObj; } - MS_LOG(INFO) << "model_path_list: " << model_path_list; return impl_->AddModel(model_path_list); } diff --git a/mindspore-lite/src/extendrt/cxx_api/model/model_impl.cc b/mindspore-lite/src/extendrt/cxx_api/model/model_impl.cc index 0fb8482a..6c36c75c 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model/model_impl.cc +++ b/mindspore-lite/src/extendrt/cxx_api/model/model_impl.cc @@ -228,7 +228,7 @@ FuncGraphPtr ModelImpl::LoadGraphByBufferImpl(const void *model_buff, size_t mod MindIRLoader mindir_loader(true, nullptr, 0, kDecModeAesGcm, false); auto ret = mindir_loader.LoadMindIR(model_buff, model_size, weight_path, &func_graph, &user_info_string); if (!ret || func_graph == nullptr) { - MS_LOG(ERROR) << "Failed to load MindIR model, please check the validity of the model: " << weight_path; + MS_LOG(ERROR) << "Failed to load MindIR model, please check the validity of the model."; return nullptr; } if (!user_info_string.empty()) { @@ -288,7 +288,7 @@ FuncGraphPtr ModelImpl::LoadGraphByBufferImpl(const void *model_data, size_t mod auto ret = mindir_loader.LoadMindIR(model_data, model_size, weight_path, cryptoInfo, &func_graph, &user_info_string); if (!ret || func_graph == nullptr) { - MS_LOG(ERROR) << "Failed to load MindIR model, please check the validity of the model: " << weight_path; + MS_LOG(ERROR) << "Failed to load MindIR model, please check the validity of the model."; return nullptr; } if (!user_info_string.empty()) { @@ -430,7 +430,7 @@ Status ModelImpl::BuildByBufferImpl(const void *model_buff, size_t model_size, M func_graph = LoadGraphByBufferImpl(model_buff, model_size, model_type, model_context, model_path); if (func_graph == nullptr) { - MS_LOG(ERROR) << "Failed to load MindIR model, please check the validity of the model: " << model_path; + MS_LOG(ERROR) << "Failed to load MindIR model, please check the validity of the model."; return kLiteError; } // convert and optimize func graph to infer @@ -515,7 +515,7 @@ Status ModelImpl::BuildByBufferImpl(const void *model_data, size_t model_size, M func_graph = LoadGraphByBufferImpl(model_data, model_size, model_type, model_context, model_path, cryptoInfo); if (func_graph == nullptr) { - MS_LOG(ERROR) << "Failed to load MindIR model, please check the validity of the model: " << model_path; + MS_LOG(ERROR) << "Failed to load MindIR model, please check the validity of the model."; return kLiteError; } // convert and optimize func graph to infer @@ -606,7 +606,7 @@ Status ModelImpl::Build(const std::string &model_path, ModelType model_type, } auto buffer = ReadFile(model_path); if (buffer.DataSize() == 0) { - MS_LOG(ERROR) << "Failed to read buffer from model file: " << model_path; + MS_LOG(ERROR) << "Failed to read buffer from model file."; return kLiteError; } return BuildByBufferImpl(buffer.Data(), buffer.DataSize(), model_type, model_context, model_path); diff --git a/mindspore-lite/src/extendrt/cxx_api/model_pool/model_pool.cc b/mindspore-lite/src/extendrt/cxx_api/model_pool/model_pool.cc index 245fad08..40b401fa 100644 --- a/mindspore-lite/src/extendrt/cxx_api/model_pool/model_pool.cc +++ b/mindspore-lite/src/extendrt/cxx_api/model_pool/model_pool.cc @@ -53,8 +53,8 @@ int ModelPool::GetDefaultThreadNum(int worker_num) { int default_thread_num = -1; if (can_use_core_num_ <= kNumPhysicalCoreThreshold) { default_thread_num = can_use_core_num_ >= kDefaultWorkerNumPerPhysicalCpu - ? can_use_core_num_ / kDefaultWorkerNumPerPhysicalCpu - : can_use_core_num_; + ? can_use_core_num_ / kDefaultWorkerNumPerPhysicalCpu + : can_use_core_num_; } else { default_thread_num = kDefaultThreadsNum; } @@ -862,7 +862,7 @@ Status ModelPool::InitByPath(const std::string &model_path, const std::shared_pt } graph_buf_ = lite::ReadFile(model_path.c_str(), &size, allocator_); if (graph_buf_ == nullptr) { - MS_LOG(ERROR) << "read model failed, model path: " << model_path; + MS_LOG(ERROR) << "read model failed, please check your model file."; return kLiteNullptr; } auto dir_pos = model_path.find_last_of('/'); diff --git a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_env_guard.cc b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_env_guard.cc index 07ebe894..9e6bf0b4 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_env_guard.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_acl/acl_env_guard.cc @@ -137,7 +137,7 @@ std::shared_ptr AclEnvGuard::GetAclEnv(std::string_view cfg_file) { if (acl_env != nullptr) { MS_LOG(INFO) << "Acl has been initialized, skip."; if (!cfg_file.empty()) { - MS_LOG(WARNING) << "Dump config file option " << cfg_file << " is ignored."; + MS_LOG(WARNING) << "Dump config file option is ignored."; } } else { acl_env = std::make_shared(cfg_file); diff --git a/mindspore-lite/src/extendrt/delegate/ascend_ge/aoe_api_tune_process.cc b/mindspore-lite/src/extendrt/delegate/ascend_ge/aoe_api_tune_process.cc index 3b8b9735..d52e5259 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_ge/aoe_api_tune_process.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_ge/aoe_api_tune_process.cc @@ -90,6 +90,7 @@ class AoePlugin { } std::map options; for (auto &item : global_options) { + MS_LOG(INFO) << "Aoe global option " << item.first; options[ge::AscendString(item.first.c_str())] = ge::AscendString(item.second.c_str()); } auto aoe_status = aoe_initialize_func_(options); @@ -176,6 +177,7 @@ class AoePlugin { } std::map options; for (auto &item : tuning_options) { + MS_LOG(INFO) << "Aoe tuning option " << item.first; options[ge::AscendString(item.first.c_str())] = ge::AscendString(item.second.c_str()); } auto aoe_status = aoe_tuning_graph_func_(session_id, options); diff --git a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_graph_executor.cc b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_graph_executor.cc index fe509135..06d81718 100644 --- a/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_graph_executor.cc +++ b/mindspore-lite/src/extendrt/delegate/ascend_ge/ge_graph_executor.cc @@ -424,7 +424,7 @@ bool GeGraphExecutor::InitRefModeConfig() { ref_mode = lite::StringTolower(ref_mode); if (ref_mode != kRefModeNone && ref_mode != kRefModeVariable && ref_mode != kRefModeAll) { MS_LOG(ERROR) << "Only " << kRefModeNone << ", " << kRefModeVariable << " or " << kRefModeAll - << " is supported for " << lite::kParameterAsRefData << ", but got " << ref_mode; + << " is supported for " << lite::kParameterAsRefData; return false; } if (ref_mode == kRefModeAll) { @@ -434,7 +434,7 @@ bool GeGraphExecutor::InitRefModeConfig() { } else { ref_mode_flag_ = backend::ge_backend::RefModeFlag::kRefModeNone; } - MS_LOG(INFO) << "Set parameter ref mode " << ref_mode; + MS_LOG(INFO) << "Set parameter ref mode ok."; } else { ref_mode_flag_ = backend::ge_backend::RefModeFlag::kRefModeNone; } @@ -530,13 +530,13 @@ void GeGraphExecutor::GetGeSessionOptionsFromAscendContext(const std::map GeSessionManager::CreateGeSession( ge_session_map_[session_id] = session_context; MS_LOG(INFO) << "Create ge session successfully, lite session id: " << session_id; } else { - auto map_as_string = [](const std::map &options) { - std::stringstream ss; - ss << "{"; - for (auto &item : options) { - ss << "" << item.first << ":" << item.second << ","; - } - ss << "}"; - return ss.str(); - }; auto old_options = s_it->second->session_options; if (old_options != session_options) { - MS_LOG(ERROR) - << "Session options is not equal in diff config infos when models' weights are shared, last session options: " - << map_as_string(old_options) << ", current session options: " << map_as_string(session_options); + MS_LOG(ERROR) << "Session options is not equal in diff config infos when models' weights are shared, last " + "session options != current session options, please check your session options."; return nullptr; } MS_LOG(INFO) << "Get ge session from session map, lite session id: " << session_id; diff --git a/mindspore-lite/src/extendrt/delegate/comm_group_info.cc b/mindspore-lite/src/extendrt/delegate/comm_group_info.cc index 2468ca3d..e7198c4b 100644 --- a/mindspore-lite/src/extendrt/delegate/comm_group_info.cc +++ b/mindspore-lite/src/extendrt/delegate/comm_group_info.cc @@ -27,37 +27,37 @@ #include "utils/file_utils.h" namespace mindspore::lite { std::optional CommGroupInfo::CreatePrefixPath(const std::string &input_path, bool support_relative_path) { - std::optional prefix_path; - std::optional file_name; - FileUtils::SplitDirAndFileName(input_path, &prefix_path, &file_name); - if (!file_name.has_value()) { - MS_LOG(ERROR) << "Cannot get file_name from: " << input_path; - return std::nullopt; - } - auto file_name_str = file_name.value(); + std::optional prefix_path; + std::optional file_name; + FileUtils::SplitDirAndFileName(input_path, &prefix_path, &file_name); + if (!file_name.has_value()) { + MS_LOG(ERROR) << "Cannot get file_name from: " << input_path; + return std::nullopt; + } + auto file_name_str = file_name.value(); #if defined(SYSTEM_ENV_POSIX) - if (file_name_str.length() > NAME_MAX) { -MS_LOG(ERROR) << "The length of file name: " << file_name_str.length() << " exceeds limit: " << NAME_MAX; -return std::nullopt; -} + if (file_name_str.length() > NAME_MAX) { + MS_LOG(ERROR) << "The length of file name: " << file_name_str.length() << " exceeds limit: " << NAME_MAX; + return std::nullopt; + } #endif - std::string prefix_path_str; - if (prefix_path.has_value()) { - auto create_prefix_path = FileUtils::CreateNotExistDirs(prefix_path.value(), support_relative_path); - if (!create_prefix_path.has_value()) { - return std::nullopt; - } - prefix_path_str = create_prefix_path.value(); - } else { - auto pwd_path = FileUtils::GetRealPath("./"); - if (!pwd_path.has_value()) { - MS_LOG(ERROR) << "Cannot get pwd path"; - return std::nullopt; - } - prefix_path_str = pwd_path.value(); + std::string prefix_path_str; + if (prefix_path.has_value()) { + auto create_prefix_path = FileUtils::CreateNotExistDirs(prefix_path.value(), support_relative_path); + if (!create_prefix_path.has_value()) { + return std::nullopt; + } + prefix_path_str = create_prefix_path.value(); + } else { + auto pwd_path = FileUtils::GetRealPath("./"); + if (!pwd_path.has_value()) { + MS_LOG(ERROR) << "Cannot get pwd path"; + return std::nullopt; } - return std::string(prefix_path_str + "/" + file_name_str); + prefix_path_str = pwd_path.value(); + } + return std::string(prefix_path_str + "/" + file_name_str); } bool CommGroupInfo::CheckPath(const std::string path) const { @@ -67,7 +67,7 @@ bool CommGroupInfo::CheckPath(const std::string path) const { } auto realpath = CreatePrefixPath(path, true); if (!realpath.has_value()) { - MS_LOG(ERROR) << "Get real path failed, path=" << path; + MS_LOG(ERROR) << "Get real path failed."; return false; } return true; diff --git a/mindspore-lite/src/extendrt/mindir_loader/mindir_model/mindir_model.cc b/mindspore-lite/src/extendrt/mindir_loader/mindir_model/mindir_model.cc index 2ba8dd32..39cec113 100644 --- a/mindspore-lite/src/extendrt/mindir_loader/mindir_model/mindir_model.cc +++ b/mindspore-lite/src/extendrt/mindir_loader/mindir_model/mindir_model.cc @@ -149,7 +149,7 @@ int MindirModel::LoadTensorData(mindspore::lite::Tensor *lite_tensor, const mind // Read file std::basic_ifstream fid(file, std::ios::in | std::ios::binary); if (!fid) { - MS_LOG(ERROR) << "Open file '" << file << "' failed, please check the correct of the file."; + MS_LOG(ERROR) << "Open file failed, please check the correct of the file."; return RET_OK; } fid.seekg(0, std::ios_base::end); diff --git a/mindspore-lite/src/extendrt/utils/serialization.cc b/mindspore-lite/src/extendrt/utils/serialization.cc index 2c510028..01521fd4 100644 --- a/mindspore-lite/src/extendrt/utils/serialization.cc +++ b/mindspore-lite/src/extendrt/utils/serialization.cc @@ -59,12 +59,12 @@ mindspore::Buffer ReadFile(const std::string &file) { std::ifstream ifs(real_path); if (!ifs.good()) { - MS_LOG(ERROR) << "File: " << real_path << " does not exist"; + MS_LOG(ERROR) << "File does not exist."; return buffer; } if (!ifs.is_open()) { - MS_LOG(ERROR) << "File: " << real_path << " open failed"; + MS_LOG(ERROR) << "File open failed."; return buffer; } @@ -72,7 +72,7 @@ mindspore::Buffer ReadFile(const std::string &file) { size_t size = static_cast(ifs.tellg()); buffer.ResizeData(size); if (buffer.DataSize() != size) { - MS_LOG(ERROR) << "Malloc buf failed, file: " << real_path; + MS_LOG(ERROR) << "Malloc buf failed."; ifs.close(); return buffer; } diff --git a/mindspore-lite/test/st/java/src/main/java/Benchmark.java b/mindspore-lite/test/st/java/src/main/java/Benchmark.java index 94f76f1c..683d749d 100644 --- a/mindspore-lite/test/st/java/src/main/java/Benchmark.java +++ b/mindspore-lite/test/st/java/src/main/java/Benchmark.java @@ -197,7 +197,7 @@ public class Benchmark { model = new Model(); boolean ret = model.build(modelPath, ModelType.MT_MINDIR, context); if (!ret) { - System.err.println("Compile graph failed, model path is " + modelPath); + System.err.println("Compile graph failed."); model.free(); System.exit(1); } @@ -211,7 +211,7 @@ public class Benchmark { // Set Input Data. byte[] data = readBinFile(inDataFile[index], (int) msTensor.size()); if (data == null) { - System.err.println("read bin file failed: " + inDataFile[index]); + System.err.println("read bin file failed."); model.free(); System.exit(1); } @@ -230,7 +230,7 @@ public class Benchmark { boolean benchmarkResult = compareData(benchmarkDataFile, accuracy); model.free(); if (!benchmarkResult) { - System.err.println(modelPath + " accuracy error is too large."); + System.err.println("The model accuracy error is too large."); System.exit(1); } } diff --git a/mindspore-lite/test/st/python/test_large_model_inference.py b/mindspore-lite/test/st/python/test_large_model_inference.py index cfd107e8..e0583941 100644 --- a/mindspore-lite/test/st/python/test_large_model_inference.py +++ b/mindspore-lite/test/st/python/test_large_model_inference.py @@ -45,8 +45,7 @@ def build_model(args): device = args.device model_type = args.model_type parallel_num = args.parallel_num - print( - f"Loading llama2, prompt model: {prompt_model_path}, decoder model: {decoder_model_path}") + print(f"Loading llama2, prompt model and decoder model.") configs = parse_configs(config_path) config_ctx = configs[model_type + "_" + device + "_" + context + "_" + str(parallel_num) + "p" + "_full"] diff --git a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/acl_model_options.cc b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/acl_model_options.cc index ec5a511e..eecc34af 100644 --- a/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/acl_model_options.cc +++ b/mindspore-lite/tools/converter/adapter/acl/cxx_api_lite/cxx_api/model/acl/acl_model_options.cc @@ -131,7 +131,6 @@ std::tuple, std::mapempty()) { continue; } - MS_LOG(INFO) << "Option " << acl_option_key << " : " << *ms_option; (void)init_options.emplace(acl_option_key, *ms_option); } @@ -139,18 +138,15 @@ std::tuple, std::mapempty()) { continue; } - MS_LOG(INFO) << "Option " << acl_option_key << " : " << *ms_option; (void)build_options.emplace(acl_option_key, *ms_option); } // init by config file param for (auto item : init_options_map_) { - MS_LOG(INFO) << "Option " << item.first << " : " << item.second; if (item.first == ge::ir_option::SOC_VERSION) { auto soc_version = item.second; if (soc_version != soc_version_) { - MS_LOG(WARNING) << "ge.socVersion: " << soc_version - << " is different with this machine core type: " << soc_version_; + MS_LOG(WARNING) << "ge.socVersion'value is different with this machine core type: " << soc_version_; } init_options[item.first] = item.second; continue; @@ -164,7 +160,6 @@ std::tuple, std::map *aoe_modes) } } - MS_LOG(INFO) << "aoe_options: " << res; return res; } diff --git a/mindspore-lite/tools/converter/converter_funcgraph.cc b/mindspore-lite/tools/converter/converter_funcgraph.cc index 4e9956b6..6db3b9e3 100644 --- a/mindspore-lite/tools/converter/converter_funcgraph.cc +++ b/mindspore-lite/tools/converter/converter_funcgraph.cc @@ -458,7 +458,7 @@ STATUS ConverterFuncGraph::RunGeOfflineConvert(const std::shared_ptrconfig_infos)) { MS_LOG(ERROR) << "Failed to call AOE Tuning"; return RET_ERROR; -- Gitee