fix lite train 1.5 issue

This commit is contained in:
zhengjun10 2021-09-08 15:59:41 +08:00
parent c4b3329ecc
commit 78cf77bc02
5 changed files with 23 additions and 6 deletions

View File

@ -17,7 +17,7 @@ CONVERTER="../../../build/tools/converter/converter_lite"
if [ ! -f "$CONVERTER" ]; then
if ! command -v converter_lite &> /dev/null
then
tar -xzf ../../../../../output/mindspore-lite-*-linux-x64.tar.gz --strip-components 4 --wildcards --no-anchored converter_lite libglog.so.0 libmslite_converter_plugin.so
tar -xzf ../../../../../output/mindspore-lite-*-linux-x64.tar.gz --strip-components 4 --wildcards --no-anchored converter_lite *so.* *.so
if [ -f ./converter_lite ]; then
CONVERTER=./converter_lite
else

View File

@ -17,7 +17,7 @@ CONVERTER="../../../build/tools/converter/converter_lite"
if [ ! -f "$CONVERTER" ]; then
if ! command -v converter_lite &> /dev/null
then
tar -xzf ../../../../../output/mindspore-lite-*-linux-x64.tar.gz --strip-components 4 --wildcards --no-anchored converter_lite libglog.so.0 libmslite_converter_plugin.so
tar -xzf ../../../../../output/mindspore-lite-*-linux-x64.tar.gz --strip-components 4 --wildcards --no-anchored converter_lite *so.* *.so
if [ -f ./converter_lite ]; then
CONVERTER=./converter_lite
else

View File

@ -111,11 +111,12 @@ cp scripts/*.sh ${PACKAGE}/
tar -xzf ${TARBALL}
mv mindspore-*/runtime/lib ${PACKAGE}/
mv mindspore-*/runtime/third_party/libjpeg-turbo/lib/* ${PACKAGE}/lib/
if [ "${TARGET}" == "arm64" ]; then
tar -xzf ${TARBALL} --wildcards --no-anchored hiai_ddk
mv mindspore-*/runtime/third_party/hiai_ddk/lib/* ${PACKAGE}/lib/
cd mindspore-*
if [[ "${TARGET}" == "arm64" ]] && [[ -d "runtime/third_party/hiai_ddk/lib" ]]; then
mv runtime/third_party/hiai_ddk/lib/* ../${PACKAGE}/lib/
fi
cd ..
rm -rf msl
mv mindspore-* msl/
rm -rf msl/tools/

View File

@ -42,7 +42,14 @@ inline int AccessFile(const std::string &file_path, int access_mode) {
#ifdef _WIN32
return _access(file_path.c_str(), access_mode);
#else
return access(file_path.c_str(), access_mode);
// android access interface always return true
struct stat st;
if (stat(file_path.c_str(), &st) == 0) {
mode_t perm = st.st_mode;
auto can_read = perm & S_IRUSR;
return (can_read && access(file_path.c_str(), access_mode) == 0) ? 0 : -1;
}
return -1;
#endif
}
@ -62,6 +69,10 @@ char *ReadFile(const char *file, size_t *size) {
}
MS_ASSERT(size != nullptr);
std::string real_path = RealPath(file);
if (AccessFile(real_path, R_OK) != 0) {
MS_LOG(ERROR) << "cannot access file:" << real_path << ".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(ERROR) << "file: " << real_path << " is not exist";

View File

@ -52,6 +52,11 @@ int Storage::Save(const schema::MetaGraphT &graph, const std::string &outputPath
}
output.write((const char *)content, size);
if (output.bad()) {
output.close();
MS_LOG(ERROR) << "Write output file : " << filename << " failed";
return RET_ERROR;
}
output.close();
#ifndef _MSC_VER
chmod(filename.c_str(), S_IRUSR);