openvino_notebooks icon indicating copy to clipboard operation
openvino_notebooks copied to clipboard

NPU support on yolov8

Open weberwcwei opened this issue 1 year ago • 3 comments

Describe the bug When attempting to compile the YOLOv8 model using the NPU, a RuntimeError occurs.

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[8], line 7
      5 model = core.read_model(model_path)
      6 model.reshape([1, 3, 640, 640])
----> 7 compiled_model = core.compile_model(model, "NPU")

File c:\Users\Weber\Desktop\.conda\Lib\site-packages\openvino\runtime\ie_api.py:543, in Core.compile_model(self, model, device_name, config, weights)
    538     if device_name is None:
    539         return CompiledModel(
    540             super().compile_model(model, {} if config is None else config),
    541         )
    542     return CompiledModel(
--> 543         super().compile_model(model, device_name, {} if config is None else config),
    544     )
    545 else:
    546     if device_name is None:

RuntimeError: Exception from src\inference\src\cpp\core.cpp:107:
Exception from src\inference\src\dev\plugin.cpp:53:
Exception from src\plugins\intel_npu\src\plugin\src\plugin.cpp:697:
Exception from src\plugins\intel_npu\src\plugin\src\compiled_model.cpp:62:
Exception from src\plugins\intel_npu\src\compiler\src\zero_compiler_in_driver.cpp:853:
L0 pfnCreate2 result: ZE_RESULT_ERROR_INVALID_ARGUMENT, code 0x78000004

Sample code

from pathlib import Path
import openvino as ov

models_dir = Path("./model_zoo")
DET_MODEL_NAME = "yolov8n"

model_path = models_dir / f"{DET_MODEL_NAME}_openvino_model/{DET_MODEL_NAME}.xml"
core = ov.Core()
model = core.read_model(model_path)
model.reshape([1, 3, 640, 640])
compiled_model = core.compile_model(model, "NPU")

Installation instructions (Please mark the checkbox) [X] I followed the installation guide at https://github.com/openvinotoolkit/openvino_notebooks#-installation-guide to install the notebooks.

Additional context NPU driver version: 32.0.100.2714

weberwcwei avatar Sep 17 '24 19:09 weberwcwei