提交 e7587617 编写于 作者: M Megvii Engine Team

fix(lite): fix packed model compatibility

GitOrigin-RevId: 47976477d101fc3f931637449f3ff818a59340b5
上级 a0a5fcf1
......@@ -36,8 +36,8 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/genfiles/lite_build_config.h
# begin config lite
if(LITE_BUILD_WITH_MGE
AND LITE_WITH_CUDA
AND NOT WIN32)
AND NOT WIN32
AND NOT APPLE)
# FXIME third_party cpp redis do not support build with clang-cl
list(APPEND SOURCES_LITE ${CPP_REDIS_SRCS})
endif()
......@@ -129,8 +129,8 @@ if(LITE_BUILD_WITH_MGE AND NOT WIN32)
endif()
if(LITE_BUILD_WITH_MGE
AND LITE_WITH_CUDA
AND NOT WIN32)
AND NOT WIN32
AND NOT APPLE)
# FXIME third_party cpp redis do not support build with clang-cl
target_include_directories(lite_static PRIVATE ${CPP_REDIS_INCLUDES})
target_include_directories(lite_shared PRIVATE ${CPP_REDIS_INCLUDES})
......
......@@ -31,8 +31,8 @@ if(UNIX)
endif()
if(LITE_BUILD_WITH_MGE
AND LITE_WITH_CUDA
AND NOT WIN32)
AND NOT WIN32
AND NOT APPLE)
# FXIME third_party cpp redis do not support build with clang-cl
target_include_directories(load_and_run PRIVATE ${CPP_REDIS_INCLUDES})
endif()
......@@ -43,8 +43,8 @@ install(
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if(BUILD_SHARED_LIBS)
if(LITE_BUILD_WITH_MGE
AND LITE_WITH_CUDA
AND NOT WIN32)
AND NOT WIN32
AND NOT APPLE)
# FXIME third_party cpp redis do not support build with clang-cl
list(APPEND SOURCES ${CPP_REDIS_SRCS})
endif()
......@@ -72,8 +72,8 @@ if(BUILD_SHARED_LIBS)
endif()
if(LITE_BUILD_WITH_MGE
AND LITE_WITH_CUDA
AND NOT WIN32)
AND NOT WIN32
AND NOT APPLE)
# FXIME third_party cpp redis do not support build with clang-cl
target_include_directories(load_and_run_depends_shared
PRIVATE ${CPP_REDIS_INCLUDES})
......
......@@ -2,6 +2,7 @@
#include "../misc.h"
#if LITE_BUILD_WITH_MGE
#include "megbrain/utils/infile_persistent_cache.h"
#include "megbrain/utils/json.h"
#endif
#include <flatbuffers/flatbuffers.h>
......@@ -127,6 +128,19 @@ flatbuffers::Offset<ModelInfo> FbsHelper::build_info() {
fb_data = m_builder.CreateVector(data, size);
} else if (!m_packer->m_info_data.empty()) {
fb_data = m_builder.CreateVector(m_packer->m_info_data);
} else {
//! set info->data() to non-null to avoid load_and_run parse model compatibility
//! issue
std::string default_data;
#if MGB_ENABLE_JSON
std::vector<std::pair<mgb::json::String, std::shared_ptr<mgb::json::Value>>>
info;
info.push_back({mgb::json::String("valid"), mgb::json::Bool::make(false)});
auto obj = mgb::json::Object::make(info);
default_data = obj->to_string();
#endif
std::vector<uint8_t> json_info(default_data.begin(), default_data.end());
fb_data = m_builder.CreateVector(json_info);
}
flatbuffers::Offset<flatbuffers::Vector<uint8_t>> fb_algo_policy;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册