-
Notifications
You must be signed in to change notification settings - Fork 55
[OVEP] Expose kvcache_rewind python api #831
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
base: ovep-develop
Are you sure you want to change the base?
Conversation
998fda7
to
476d46e
Compare
#endif | ||
}) | ||
.def( | ||
"set_ep_dynamic_options", [](PyInferenceSession* sess, const py::dict& options) -> void { |
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.
Explicit return type in lambda is unnecessary starting with C++14. On top of that, -> void
doesn't provide any additional information.
Some of the functions in this file use it, but not all of them. So let's remove it
gsl::make_span(values.data(), values.size())); | ||
|
||
if (!status.IsOK()) { | ||
throw std::runtime_error("Failed to set EP dynamic options: " + status.ErrorMessage()); |
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.
Please don't throw raw C++ exceptions. There's an example in this file on how to report an error(OrtPybindThrowIfError
or ORT_THROW
, depending on the build type)
throw std::runtime_error("No options were provided"); | ||
} | ||
|
||
// Call the underlying C++ method |
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.
Is this comment necessary?
Please attach a JIRA for this feature request in the PR description. |
Description
In Phi-Silica app which didn't rely on ORT-GenAI, we need an API to remove KV history. The kvcache_rewind is an OVEP function to achieve this, however there is no python API exposed. This PR is for this purpose.