Skip to content

Commit 1feb067

Browse files
authored
Fix for AnyMap properties. (openvinotoolkit#1282)
GENERATE_CONFIG and PREFILL_CONFIG should be casted to ov::AnyMap, instead of std::map, which currently causes error. Ticket: CVS-157910
1 parent 3c9fd76 commit 1feb067

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/python/py_utils.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ ov::Any py_object_to_any(const py::object& py_obj, std::string property_name) {
8484
"num_inference_steps",
8585
"max_sequence_length"
8686
};
87+
// These properties should be casted to ov::AnyMap, instead of std::map.
88+
std::set<std::string> any_map_properties = {
89+
"GENERATE_CONFIG",
90+
"PREFILL_CONFIG",
91+
};
8792

8893
py::object float_32_type = py::module_::import("numpy").attr("float32");
8994
if (py::isinstance<py::str>(py_obj)) {
@@ -150,7 +155,7 @@ ov::Any py_object_to_any(const py::object& py_obj, std::string property_name) {
150155
OPENVINO_THROW("Property \"" + property_name + "\" got unsupported type.");
151156
}
152157

153-
} else if (py::isinstance<py::dict>(py_obj)) {
158+
} else if (py::isinstance<py::dict>(py_obj) && any_map_properties.find(property_name) == any_map_properties.end()) {
154159
auto _dict = py_obj.cast<py::dict>();
155160
enum class PY_TYPE : int { UNKNOWN = 0, STR, INT};
156161
PY_TYPE detected_key_type = PY_TYPE::UNKNOWN;

0 commit comments

Comments
 (0)