Skip to content

[Bug]: core.import_model() fails to load compiled models after multiple export/import cycles #33054

@jesspfjess

Description

@jesspfjess

OpenVINO Version

2025.2.0

Operating System

Other (Please specify in description)

Device used for inference

CPU

Framework

PyTorch

Model used

ResNet18

Issue description

Hi,
I wanted to do the following steps:

  •       1. ✓ PyTorch model loaded
    
  •       2. ✓ Converted to OpenVINO IR format
    
  •       3. ✓ Loaded and compiled the converted model
    
  •       4. ✓ Inference produces correct results
    
  •       5. ✓ Exported compiled model 
    
  •       6. ✓ Imported compiled model (no recompilation)
    
  •       7. ✓ Re-exported compiled model to third directory
    
  •       8. ✓ Re-imported compiled model from third directory
    

However, the model cannot be re-imported in the last step. Instead it is returning the error message that the model cannot be read

Step-by-step reproduction

I have the following code example which produces the iusse:

toy_example_pytorch_openvino.py

Relevant log output

2025-11-27T15:30:44.874+02:00:874 - pytorch_to_openvino_toy_example: INFO     Importing compiled model from /tmp/openvino_toy_example/third_export/ov_models/resnet18_compiled.bin...
2025-11-27T15:30:44.905+02:00:905 - pytorch_to_openvino_toy_example: ERROR    ✗ Failed to import compiled model: Exception from src/inference/src/cpp/core.cpp:189:
Exception from src/inference/src/dev/plugin.cpp:73:
Exception from src/inference/src/model_reader.cpp:223:
[ CORE ] Unable to read the model. Please check if the model format is supported and model is correct.



2025-11-27T15:30:44.905+02:00:905 - pytorch_to_openvino_toy_example: ERROR    Traceback (most recent call last):
  File "/home/algo-ipc/inspekto/inspekto/defect-predictor/src/defect_predictor/toy_example_pytorch_to_openvino.py", line 214, in import_compiled_model
    compiled_model = core.import_model(user_stream, "CPU")
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/openvino/_ov_api.py", line 668, in import_model
    super().import_model(
RuntimeError: Exception from src/inference/src/cpp/core.cpp:189:
Exception from src/inference/src/dev/plugin.cpp:73:
Exception from src/inference/src/model_reader.cpp:223:
[ CORE ] Unable to read the model. Please check if the model format is supported and model is correct.

Issue submission checklist

  • I'm reporting an issue. It's not a question.
  • I checked the problem with the documentation, FAQ, open issues, Stack Overflow, etc., and have not found a solution.
  • There is reproducer code and related data files such as images, videos, models, etc.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions