OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[PyOV] fix ov::hint::model (#30363)
Anastasia Kuporosova112551d9f2c4
diff --git a/src/bindings/python/src/pyopenvino/core/core.cpp b/src/bindings/python/src/pyopenvino/core/core.cppindex 331d25d9707..b211024569f 100644--- a/src/bindings/python/src/pyopenvino/core/core.cpp+++ b/src/bindings/python/src/pyopenvino/core/core.cpp@@ -91,6 +91,31 @@ void regclass_Core(py::module m) {:type property: typing.Tuple[str, typing.Any])");+ cls.def(+ "get_property",+ [](ov::Core& self,+ const std::string& device_name,+ const std::string& name,+ const std::map<std::string, py::object>& arguments) -> py::object {+ std::map<std::string, ov::Any> _properties = Common::utils::properties_to_any_map(arguments);+ return Common::utils::from_ov_any(self.get_property(device_name, name, _properties));+ },+ py::arg("device_name"),+ py::arg("name"),+ py::arg("arguments"),+ R"(+ Gets properties dedicated to device behaviour.++ :param device_name: A name of a device to get a properties value.+ :type device_name: str+ :param name: Property or name of Property.+ :type name: str+ :param arguments: Additional arguments to get a property.+ :type arguments: dict[str, typing.Any]+ :return: Extracted information from property.+ :rtype: typing.Any+ )");+cls.def("get_property",[](ov::Core& self, const std::string& device_name, const std::string& property) -> py::object {diff --git a/src/bindings/python/src/pyopenvino/utils/utils.cpp b/src/bindings/python/src/pyopenvino/utils/utils.cppindex aa19c20b81d..aa45ffd2511 100644--- a/src/bindings/python/src/pyopenvino/utils/utils.cpp+++ b/src/bindings/python/src/pyopenvino/utils/utils.cpp@@ -237,6 +237,9 @@ py::object from_ov_any(const ov::Any& any) {return py::cast(any.as<ov::hint::SchedulingCoreType>());} else if (any.is<std::set<ov::hint::ModelDistributionPolicy>>()) {return py::cast(any.as<std::set<ov::hint::ModelDistributionPolicy>>());+ } else if (any.is<std::shared_ptr<const ov::Model>>()) {+ auto model = std::const_pointer_cast<ov::Model>(any.as<std::shared_ptr<const ov::Model>>());+ return py::cast(model);} else if (any.is<ov::hint::ExecutionMode>()) {return py::cast(any.as<ov::hint::ExecutionMode>());} else if (any.is<ov::log::Level>()) {@@ -316,6 +319,9 @@ std::map<std::string, ov::Any> properties_to_any_map(const std::map<std::string,};ov::EncryptionCallbacks encryption_callbacks{encrypt_func, decrypt_func};properties_to_cpp[property.first] = encryption_callbacks;+ } else if (property.first == ov::hint::model.name()) {+ auto model = Common::utils::convert_to_model(property.second);+ properties_to_cpp[property.first] = std::static_pointer_cast<const ov::Model>(model);} else {properties_to_cpp[property.first] = Common::utils::py_object_to_any(property.second);}diff --git a/src/plugins/intel_gpu/src/plugin/plugin.cpp b/src/plugins/intel_gpu/src/plugin/plugin.cppindex e9a6b93927d..a75a1267d64 100644--- a/src/plugins/intel_gpu/src/plugin/plugin.cpp+++ b/src/plugins/intel_gpu/src/plugin/plugin.cpp@@ -815,7 +815,7 @@ uint32_t Plugin::get_optimal_batch_size(const ov::AnyMap& options) const {try {model = model_param->second.as<std::shared_ptr<const ov::Model>>();} catch (...) {- OPENVINO_THROW("[OPTIMAL_BATCH_SIZE] ov::hint::model should be std::shared_ptr<ov::Model> type");+ OPENVINO_THROW("[OPTIMAL_BATCH_SIZE] ov::hint::model should be std::shared_ptr<const ov::Model> type");}GPU_DEBUG_INFO << "DEVICE_INFO:"<< "gfx_version.major, " << device_info.gfx_ver.major