From 9ef67668d0cb3fd99f6077464ec4b22cbbf0b24e Mon Sep 17 00:00:00 2001 From: Ekaterina Aidova Date: Fri, 12 Jul 2024 15:14:04 +0400 Subject: [PATCH] Fix loading models from cache (#820) --- optimum/intel/openvino/modeling_base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/optimum/intel/openvino/modeling_base.py b/optimum/intel/openvino/modeling_base.py index 9fbc73e85..b90e6285a 100644 --- a/optimum/intel/openvino/modeling_base.py +++ b/optimum/intel/openvino/modeling_base.py @@ -132,7 +132,11 @@ def fix_op_names_duplicates(model: openvino.runtime.Model): if isinstance(file_name, str): file_name = Path(file_name) - model = core.read_model(file_name) if not file_name.suffix == ".onnx" else convert_model(file_name) + model = ( + core.read_model(file_name.resolve(), file_name.with_suffix(".bin").resolve()) + if not file_name.suffix == ".onnx" + else convert_model(file_name) + ) if file_name.suffix == ".onnx": model = fix_op_names_duplicates(model) # should be called during model conversion to IR