Skip to content

Commit e8c230b

Browse files
authored
[OpenVINO] Avoid use of deprecated openvino.runtime (#1512)
* [OpenVINO] Avoid deprecated openvino.runtime usage In OpenVINO 2026.0, openvino.runtime will be removed Signed-off-by: Kazantsev, Roman <[email protected]> * Remove from tests Signed-off-by: Kazantsev, Roman <[email protected]> --------- Signed-off-by: Kazantsev, Roman <[email protected]>
1 parent 129dbb9 commit e8c230b

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

notebooks/openvino/vision_language_quantization.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@
345345
" PyTorchConfig,\n",
346346
")\n",
347347
"from optimum_benchmark.logging_utils import setup_logging\n",
348-
"from openvino.runtime import Core\n",
348+
"from openvino import Core\n",
349349
"\n",
350350
"setup_logging(level=\"INFO\", prefix=\"MAIN-PROCESS\")\n",
351351
"\n",

optimum/intel/neural_compressor/modeling_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def _from_pretrained(
216216
config=config,
217217
**kwargs,
218218
)
219-
logger.info("Saved low bit model loading successfully. Other input args " "will be ignored.")
219+
logger.info("Saved low bit model loading successfully. Other input args will be ignored.")
220220
return model
221221
except Exception as e:
222222
raise RuntimeError(f"The quantized model cannot be loaded. Detailed error: {e}")

optimum/intel/openvino/modeling_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ class OVModelHostMixin:
6363
"""
6464

6565
@property
66-
def ov_models(self) -> Dict[str, Union[openvino.Model, openvino.runtime.CompiledModel]]:
66+
def ov_models(self) -> Dict[str, Union[openvino.Model, openvino.CompiledModel]]:
6767
"""
6868
Returns a dictionary of all OpenVINO models associated with this model. Keys are model names, and values are
69-
either instances of `openvino.Model` or `openvino.runtime.CompiledModel`. Compiled model instances are returned
69+
either instances of `openvino.Model` or `openvino.CompiledModel`. Compiled model instances are returned
7070
if the model is initialized with `compile_only=True`.
7171
"""
7272
return {ov_model_name: getattr(self, ov_model_name) for ov_model_name in self._ov_model_names}
7373

7474
@property
75-
def ov_submodels(self) -> Dict[str, Union[openvino.Model, openvino.runtime.CompiledModel]]:
75+
def ov_submodels(self) -> Dict[str, Union[openvino.Model, openvino.CompiledModel]]:
7676
logger.warn(
7777
"`ov_submodels` property is deprecated and will be removed in v1.27. Please use `ov_models` property instead."
7878
)

optimum/intel/openvino/modeling_diffusion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ def _ov_model_names(self) -> List[str]:
14521452
return self._component_names
14531453

14541454
@property
1455-
def ov_models(self) -> Dict[str, Union[openvino.Model, openvino.runtime.CompiledModel]]:
1455+
def ov_models(self) -> Dict[str, Union[openvino.Model, openvino.CompiledModel]]:
14561456
return {name: getattr(component, "model") for name, component in self.components.items()}
14571457

14581458
@property

optimum/intel/openvino/modeling_visual_language.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ def _ov_model_names(self):
706706
return model_names
707707

708708
@property
709-
def ov_models(self) -> Dict[str, Union[openvino.Model, openvino.runtime.CompiledModel]]:
709+
def ov_models(self) -> Dict[str, Union[openvino.Model, openvino.CompiledModel]]:
710710
ov_models = {}
711711
for ov_model_name in self._ov_model_names:
712712
if ov_model_name == "lm_model":

tests/openvino/test_modeling.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,15 +283,15 @@ def test_load_from_hub_and_save_visual_language_model(self):
283283
tmpdirname, compile_only=True, device=OPENVINO_DEVICE
284284
)
285285
for ov_model in compile_only_model.ov_models.values():
286-
self.assertIsInstance(ov_model, ov.runtime.CompiledModel)
286+
self.assertIsInstance(ov_model, ov.CompiledModel)
287287
for component_name, component in compile_only_model.components.items():
288-
self.assertIsInstance(component.model, ov.runtime.CompiledModel)
288+
self.assertIsInstance(component.model, ov.CompiledModel)
289289
if component_name == "language_model":
290-
self.assertIsInstance(component.request, ov.runtime.InferRequest)
291-
self.assertIsInstance(component.text_emb_model, ov.runtime.CompiledModel)
292-
self.assertIsInstance(component.text_emb_request, ov.runtime.CompiledModel)
290+
self.assertIsInstance(component.request, ov.InferRequest)
291+
self.assertIsInstance(component.text_emb_model, ov.CompiledModel)
292+
self.assertIsInstance(component.text_emb_request, ov.CompiledModel)
293293
else:
294-
self.assertIsInstance(component.request, ov.runtime.CompiledModel)
294+
self.assertIsInstance(component.request, ov.CompiledModel)
295295

296296
outputs = compile_only_model(**inputs)
297297
self.assertTrue(torch.equal(loaded_model_outputs.logits, outputs.logits))

0 commit comments

Comments
 (0)