Investigate GNA tests (#12267)
* Test commit * Revert "Disable loading of v7 reader for new IR versions (#12252)" This reverts commitcb6ca7bb89
. * Revert "Test commit" This reverts commit977b83f2ba
.
This commit is contained in:
parent
14e8e3259d
commit
4df5a104f3
@ -272,10 +272,6 @@ InputModel::Ptr FrontEnd::load_impl(const std::vector<ov::Any>& variants) const
|
|||||||
std::ifstream model_stream;
|
std::ifstream model_stream;
|
||||||
std::ifstream weights_stream;
|
std::ifstream weights_stream;
|
||||||
std::istream* p_model_stream = paddle::variant_to_stream_ptr(variants[0], model_stream);
|
std::istream* p_model_stream = paddle::variant_to_stream_ptr(variants[0], model_stream);
|
||||||
if (!variants[1].is<std::istream*>() && !variants[1].is<std::string>()) {
|
|
||||||
// If we use read model with a tensor as a second argument
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
std::istream* p_weights_stream = paddle::variant_to_stream_ptr(variants[1], weights_stream);
|
std::istream* p_weights_stream = paddle::variant_to_stream_ptr(variants[1], weights_stream);
|
||||||
if (p_model_stream && p_weights_stream) {
|
if (p_model_stream && p_weights_stream) {
|
||||||
return std::make_shared<InputModel>(std::vector<std::istream*>{p_model_stream, p_weights_stream},
|
return std::make_shared<InputModel>(std::vector<std::istream*>{p_model_stream, p_weights_stream},
|
||||||
|
@ -464,6 +464,22 @@ CNNNetwork details::ReadNetwork(const std::string& modelPath,
|
|||||||
const std::vector<IExtensionPtr>& exts,
|
const std::vector<IExtensionPtr>& exts,
|
||||||
const std::vector<ov::Extension::Ptr>& ov_exts,
|
const std::vector<ov::Extension::Ptr>& ov_exts,
|
||||||
bool newAPI) {
|
bool newAPI) {
|
||||||
|
#ifdef ENABLE_IR_V7_READER
|
||||||
|
// IR v7 obsolete code
|
||||||
|
{
|
||||||
|
// Register readers if it is needed
|
||||||
|
registerReaders();
|
||||||
|
auto cnnnetwork = load_ir_v7_network(modelPath, binPath, exts);
|
||||||
|
|
||||||
|
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||||
|
if (static_cast<ICNNNetwork::Ptr>(cnnnetwork) != nullptr) {
|
||||||
|
OPENVINO_ASSERT(!newAPI, "Cannot read IR v7 from OpenVINO 2.0 API");
|
||||||
|
return cnnnetwork;
|
||||||
|
}
|
||||||
|
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||||
|
}
|
||||||
|
#endif // ENABLE_IR_V7_READER
|
||||||
|
|
||||||
// Fix unicode name
|
// Fix unicode name
|
||||||
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
|
#if defined(OPENVINO_ENABLE_UNICODE_PATH_SUPPORT) && defined(_WIN32)
|
||||||
std::wstring model_path = ov::util::string_to_wstring(modelPath.c_str());
|
std::wstring model_path = ov::util::string_to_wstring(modelPath.c_str());
|
||||||
@ -500,27 +516,10 @@ CNNNetwork details::ReadNetwork(const std::string& modelPath,
|
|||||||
return convert_to_cnnnetwork(ngFunc, exts, newAPI);
|
return convert_to_cnnnetwork(ngFunc, exts, newAPI);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_IR_V7_READER
|
|
||||||
// IR v7 obsolete code
|
|
||||||
{
|
|
||||||
// Register readers if it is needed
|
|
||||||
registerReaders();
|
|
||||||
auto cnnnetwork = load_ir_v7_network(modelPath, binPath, exts);
|
|
||||||
|
|
||||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
|
||||||
if (static_cast<ICNNNetwork::Ptr>(cnnnetwork) != nullptr) {
|
|
||||||
OPENVINO_ASSERT(!newAPI, "Cannot read IR v7 from OpenVINO 2.0 API");
|
|
||||||
return cnnnetwork;
|
|
||||||
}
|
|
||||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
|
||||||
}
|
|
||||||
#endif // ENABLE_IR_V7_READER
|
|
||||||
|
|
||||||
const auto fileExt = modelPath.substr(modelPath.find_last_of(".") + 1);
|
const auto fileExt = modelPath.substr(modelPath.find_last_of(".") + 1);
|
||||||
std::string FEs;
|
std::string FEs;
|
||||||
for (const auto& fe_name : manager.get_available_front_ends())
|
for (const auto& fe_name : manager.get_available_front_ends())
|
||||||
FEs += fe_name + " ";
|
FEs += fe_name + " ";
|
||||||
|
|
||||||
IE_THROW(NetworkNotRead) << "Unable to read the model: " << modelPath
|
IE_THROW(NetworkNotRead) << "Unable to read the model: " << modelPath
|
||||||
<< " Please check that model format: " << fileExt
|
<< " Please check that model format: " << fileExt
|
||||||
<< " is supported and the model is correct."
|
<< " is supported and the model is correct."
|
||||||
@ -536,6 +535,25 @@ CNNNetwork details::ReadNetwork(const std::string& model,
|
|||||||
std::istringstream modelStringStream(model);
|
std::istringstream modelStringStream(model);
|
||||||
std::istream& modelStream = modelStringStream;
|
std::istream& modelStream = modelStringStream;
|
||||||
|
|
||||||
|
#ifdef ENABLE_IR_V7_READER
|
||||||
|
// IR v7 obsolete code
|
||||||
|
{
|
||||||
|
// Register readers if it is needed
|
||||||
|
registerReaders();
|
||||||
|
assertIfIRv7LikeModel(modelStream);
|
||||||
|
|
||||||
|
for (auto it = readers.begin(); it != readers.end(); it++) {
|
||||||
|
auto reader = it->second;
|
||||||
|
if (reader->supportModel(modelStream)) {
|
||||||
|
OPENVINO_ASSERT(!newAPI, "Cannot read IR v7 from OpenVINO 2.0 API");
|
||||||
|
if (weights)
|
||||||
|
return reader->read(modelStream, weights, exts);
|
||||||
|
return reader->read(modelStream, exts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // ENABLE_IR_V7_READER
|
||||||
|
|
||||||
// Try to load with FrontEndManager
|
// Try to load with FrontEndManager
|
||||||
auto& manager = get_frontend_manager();
|
auto& manager = get_frontend_manager();
|
||||||
ov::frontend::FrontEnd::Ptr FE;
|
ov::frontend::FrontEnd::Ptr FE;
|
||||||
@ -561,25 +579,6 @@ CNNNetwork details::ReadNetwork(const std::string& model,
|
|||||||
return convert_to_cnnnetwork(ngFunc, exts, newAPI, frontendMode);
|
return convert_to_cnnnetwork(ngFunc, exts, newAPI, frontendMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_IR_V7_READER
|
|
||||||
// IR v7 obsolete code
|
|
||||||
{
|
|
||||||
// Register readers if it is needed
|
|
||||||
registerReaders();
|
|
||||||
assertIfIRv7LikeModel(modelStream);
|
|
||||||
|
|
||||||
for (auto it = readers.begin(); it != readers.end(); it++) {
|
|
||||||
auto reader = it->second;
|
|
||||||
if (reader->supportModel(modelStream)) {
|
|
||||||
OPENVINO_ASSERT(!newAPI, "Cannot read IR v7 from OpenVINO 2.0 API");
|
|
||||||
if (weights)
|
|
||||||
return reader->read(modelStream, weights, exts);
|
|
||||||
return reader->read(modelStream, exts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // ENABLE_IR_V7_READER
|
|
||||||
|
|
||||||
IE_THROW(NetworkNotRead)
|
IE_THROW(NetworkNotRead)
|
||||||
<< "Unable to read the model. Please check if the model format is supported and model is correct.";
|
<< "Unable to read the model. Please check if the model format is supported and model is correct.";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user