-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed passing of generation config params to VLM generate. #1180
base: master
Are you sure you want to change the base?
Fixed passing of generation config params to VLM generate. #1180
Conversation
Let' submit fix to 2024.5 |
Fixed passing of generation config params to VLM generate. Port of #1180
src/cpp/src/llm_pipeline_static.cpp
Outdated
@@ -313,6 +313,9 @@ template <typename T> | |||
T pop_or_default(ov::AnyMap& config, const std::string& key, const T& default_value) { | |||
auto anyopt = pop_option(config, key); | |||
if (anyopt.has_value()) { | |||
if (anyopt.value().empty()) { | |||
return T{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not default_value
?
Can you explain, why it is needed now
I guess that's because you switched from exceptions to return ov::Any();
, but why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost any property of type list
, set
, or dict
can potentially be empty and we should be able to accept such values. So Ilya suggested to return ov::Any()
in bindings and process empty ov::Any()
in utils.
Regarding usage of default_value
, I tried it locally but tests, that use confing shown below failed, because it is not equivalent to creation of empty container. So I changed to T{}
.
openvino.genai/tests/python_tests/test_llm_pipeline_static.py
Lines 19 to 20 in 6bb5644
'PREFILL_CONFIG': { }, | |
'GENERATE_CONFIG': { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but why?
yes, we need somehow to bypass information from python that a container (list, map, set) is empty, but we don't know type of this container (e.g. vector<of what type?>), while in this function we know this type T
maybe it will safer to return T{};
only for containers? because for regular type empty ov::Any
is still not expected
src/cpp/src/llm_pipeline_static.cpp
Outdated
@@ -313,6 +313,9 @@ template <typename T> | |||
T pop_or_default(ov::AnyMap& config, const std::string& key, const T& default_value) { | |||
auto anyopt = pop_option(config, key); | |||
if (anyopt.has_value()) { | |||
if (anyopt.value().empty()) { | |||
return T{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but why?
yes, we need somehow to bypass information from python that a container (list, map, set) is empty, but we don't know type of this container (e.g. vector<of what type?>), while in this function we know this type T
maybe it will safer to return T{};
only for containers? because for regular type empty ov::Any
is still not expected
src/python/py_tokenizer.cpp
Outdated
@@ -30,10 +30,10 @@ void init_tokenizer(py::module_& m) { | |||
R"(openvino_genai.Tokenizer object is used to initialize Tokenizer | |||
if it's located in a different path than the main model.)") | |||
|
|||
.def(py::init([](const std::filesystem::path& tokenizer_path, const std::map<std::string, py::object>& properties) { | |||
.def(py::init([](const std::filesystem::path& tokenizer_path, const py::kwargs& kwargs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we need to keep map
for BW compatibility and add warning similar to LLMPipeline
?
openvino.genai/src/python/py_llm_pipeline.cpp
Lines 110 to 116 in bef96dd
if (config.size()) { | |
PyErr_WarnEx(PyExc_DeprecationWarning, | |
"'config' parameters is deprecated, please use kwargs to pass config properties instead.", | |
1); | |
auto config_properties = pyutils::properties_to_any_map(config); | |
properties.insert(config_properties.begin(), config_properties.end()); | |
} |
Co-authored-by: Ilya Lavrenov <[email protected]>
update_config_from_kwargs()
method.Ticket: CVS-157050