openvinotoolkit / openvino

OpenVINO™ is an open-source toolkit for optimizing and deploying AI inference
https://docs.openvino.ai
Apache License 2.0
6.34k stars 2.09k forks source link

[Bug]: py compile ir model success, c++ compile ir model failed! #25167

Open hhxdestiny opened 2 weeks ago

hhxdestiny commented 2 weeks ago

OpenVINO Version

2024.2

Operating System

Windows System

Device used for inference

CPU

Framework

None

Model used

PP-OCRv4

Issue description

I converted the PaddleOcrV4 model to IR format using OVC in Python openvino2024.2, and then I loaded the model using Python openvino2024.2 normally. However, I encountered an error while loading it using C++openvino2024.2 (vcpkg install openvino).

C++ code:

#include <iostream>
#include <openvino/openvino.hpp>

int main(int argc, char* argv[]) {
  ov::Core core;
  auto versions = core.get_versions("CPU");
  for (const auto& version : versions) {
    std::cout << version.first << ": " << version.second << '\n';
  }
  auto model = core.read_model("model.xml");
  try {
    auto compiled_model = core.compile_model(model, "AUTO");
  } catch (const std::exception& e) {
    std::cerr << e.what() << '\n';
  }
}

Python code:

import openvino as ov

core = ov.Core()
versions = core.get_versions("CPU")
print(versions)
model = core.read_model(model="model.xml")
print(model)
compiled_model = core.compile_model(model=model, device_name="AUTO")
print(compiled_model)

Step-by-step reproduction

No response

Relevant log output

C++ output:

CPU: openvino_intel_cpu_plugin
    Version : 2024.2.0
    Build   : 2024.2.0-000--

Exception from src\inference\src\cpp\core.cpp:107:
Exception from src\inference\src\dev\plugin.cpp:54:
Exception from src\plugins\auto\src\auto_schedule.cpp:431:
[AUTO] compile model failed, CPU:Exception from src\inference\src\dev\plugin.cpp:54:
bad combination
;

Python output:

{'CPU': <Version: 2024.2.0-15519-5c0f38f83f6-releases/2024/2 openvino_intel_cpu_plugin>}
<Model: 'Model0'
inputs[
<ConstOutput: names[x] shape[?,3,?,?] type: f32>
]
outputs[
<ConstOutput: names[sigmoid_0.tmp_0] shape[?,1,32..,32..] type: f32>
]>
<CompiledModel:
inputs[
<ConstOutput: names[x] shape[?,3,?,?] type: f32>
]
outputs[
<ConstOutput: names[sigmoid_0.tmp_0] shape[?,1,32..,32..] type: f32>
]>

Issue submission checklist

hhxdestiny commented 2 weeks ago

Other ir models also have this issue

andrei-kochin commented 2 weeks ago

@hhxdestiny thank you for reaching the OpenVINO!

Could you please check if the issue is present when you explicitly specify the device like below?

auto compiled_model = core.compile_model(model, "CPU"); 
hhxdestiny commented 2 weeks ago

@hhxdestiny thank you for reaching the OpenVINO!

Could you please check if the issue is present when you explicitly specify the device like below?

auto compiled_model = core.compile_model(model, "CPU"); 

Thank you for your help!The error is still the same! When I am not using an IR format model, such as using ONNX or PT format, the compile_model method works properly.

andrei-kochin commented 2 weeks ago

@hhxdestiny the error should not be the same as AUTO should no longer be used and there should be no error like:

[AUTO] compile model failed, CPU:Exception from src\inference\src\dev\plugin.cpp:54:
bad combination

Could you please double-check that you've hardcoded CPU device? Also would be worth to feed model path directly to the compile model like below:

auto compiled_model = core.compile_model("model.xml", "CPU"); 
ilya-lavrenov commented 2 weeks ago

The issue comes from xbyak, 7.06 is used in vcpkg, while OpenVINO repo uses older 6.69.1 version. Could you please try to set explicitly older version using pinning https://devblogs.microsoft.com/cppblog/take-control-of-your-vcpkg-dependencies-with-versioning-support/ ?

hhxdestiny commented 1 week ago

The issue comes from xbyak, 7.06 is used in vcpkg, while OpenVINO repo uses older 6.69.1 version. Could you please try to set explicitly older version using pinning https://devblogs.microsoft.com/cppblog/take-control-of-your-vcpkg-dependencies-with-versioning-support/ ?

Thank you for your suggestion. I will try it later. Does openvino have any plans to adapt to Xbyak 7.06 or 7.07?