From 1feb06752b8c48c747b85e6bef9142231a69ae6f Mon Sep 17 00:00:00 2001 From: Anastasiia Pnevskaia Date: Tue, 3 Dec 2024 17:22:28 +0100 Subject: [PATCH] Fix for AnyMap properties. (#1282) GENERATE_CONFIG and PREFILL_CONFIG should be casted to ov::AnyMap, instead of std::map, which currently causes error. Ticket: CVS-157910 --- src/python/py_utils.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/python/py_utils.cpp b/src/python/py_utils.cpp index 579fe6b789..9d33318f0a 100644 --- a/src/python/py_utils.cpp +++ b/src/python/py_utils.cpp @@ -84,6 +84,11 @@ ov::Any py_object_to_any(const py::object& py_obj, std::string property_name) { "num_inference_steps", "max_sequence_length" }; + // These properties should be casted to ov::AnyMap, instead of std::map. + std::set any_map_properties = { + "GENERATE_CONFIG", + "PREFILL_CONFIG", + }; py::object float_32_type = py::module_::import("numpy").attr("float32"); if (py::isinstance(py_obj)) { @@ -150,7 +155,7 @@ ov::Any py_object_to_any(const py::object& py_obj, std::string property_name) { OPENVINO_THROW("Property \"" + property_name + "\" got unsupported type."); } - } else if (py::isinstance(py_obj)) { + } else if (py::isinstance(py_obj) && any_map_properties.find(property_name) == any_map_properties.end()) { auto _dict = py_obj.cast(); enum class PY_TYPE : int { UNKNOWN = 0, STR, INT}; PY_TYPE detected_key_type = PY_TYPE::UNKNOWN;