Skip to content

Commit

Permalink
Fix for AnyMap properties. (#1282)
Browse files Browse the repository at this point in the history
GENERATE_CONFIG and PREFILL_CONFIG should be casted to ov::AnyMap,
instead of std::map, which currently causes error.
Ticket: CVS-157910
  • Loading branch information
popovaan authored Dec 3, 2024
1 parent 3c9fd76 commit 1feb067
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/python/py_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> any_map_properties = {
"GENERATE_CONFIG",
"PREFILL_CONFIG",
};

py::object float_32_type = py::module_::import("numpy").attr("float32");
if (py::isinstance<py::str>(py_obj)) {
Expand Down Expand Up @@ -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::dict>(py_obj)) {
} else if (py::isinstance<py::dict>(py_obj) && any_map_properties.find(property_name) == any_map_properties.end()) {
auto _dict = py_obj.cast<py::dict>();
enum class PY_TYPE : int { UNKNOWN = 0, STR, INT};
PY_TYPE detected_key_type = PY_TYPE::UNKNOWN;
Expand Down

0 comments on commit 1feb067

Please sign in to comment.