Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[PyOV] Update Python API stub files (#32685)

sys-openvino-ci89e1438d2d9b
diff --git a/src/bindings/python/src/openvino/_ov_api.pyi b/src/bindings/python/src/openvino/_ov_api.pyi
index 98f994e5d90..66133d53716 100644
--- a/src/bindings/python/src/openvino/_ov_api.pyi
+++ b/src/bindings/python/src/openvino/_ov_api.pyi
@@ -296,12 +296,12 @@ class Core(openvino._pyopenvino.Core):
:rtype: openvino.CompiledModel
"""
- def import_model(self, model_stream: bytes, device_name: str, config: typing.Optional[dict[str, typing.Any]] = None) -> CompiledModel:
+ def import_model(self, model_stream: typing.Union[bytes, _io.BytesIO, openvino._pyopenvino.Tensor], device_name: str, config: typing.Optional[dict[str, typing.Any]] = None) -> CompiledModel:
"""
Imports a compiled model from a previously exported one.
- :param model_stream: Input stream, containing a model previously exported, using export_model method.
- :type model_stream: bytes
+ :param model_stream: Input stream or tensor, containing a model previously exported, using export_model method.
+ :type model_stream: Union[bytes, io.BytesIO, openvino.Tensor]
:param device_name: Name of device to which compiled model is imported.
Note: if device_name is not used to compile the original model,
an exception is thrown.
diff --git a/src/bindings/python/src/openvino/_pyopenvino/__init__.pyi b/src/bindings/python/src/openvino/_pyopenvino/__init__.pyi
index aadfbfd7ca9..be5ff913b98 100644
--- a/src/bindings/python/src/openvino/_pyopenvino/__init__.pyi
+++ b/src/bindings/python/src/openvino/_pyopenvino/__init__.pyi
@@ -766,6 +766,24 @@ class Core:
:return: Plugin version information.
:rtype: dict[str, openvino.Version]
"""
+ @typing.overload
+ def import_model(self, tensor: Tensor, device_name: str, properties: collections.abc.Mapping[str, typing.Any]) -> CompiledModel:
+ """
+ Imports a compiled model from a previously exported one.
+
+ GIL is released while running this function.
+
+ :param compiled_blob: ov::Tensor input blob containing a model previously exported using the ov::CompiledModel::export_model method.
+ :type compiled_blob: openvino.Tensor
+ :param device_name: Name of device to which compiled model is imported.
+ Note: if device_name is not used to compile the original model, an exception is thrown.
+ :type device_name: str
+ :param properties: Optional map of pairs: (property name, property value) relevant only for this load operation.
+ :type properties: dict[str, typing.Any], optional
+ :return: A compiled model.
+ :rtype: openvino.CompiledModel
+ """
+ @typing.overload
def import_model(self, model_stream: typing.Any, device_name: str, properties: collections.abc.Mapping[str, typing.Any]) -> CompiledModel:
"""
Imports a compiled model from a previously exported one.