-
Notifications
You must be signed in to change notification settings - Fork 165
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
Stubs files for genai bindings #1158
base: master
Are you sure you want to change the base?
Conversation
py::class_<CacheEvictionConfig>(m, "CacheEvictionConfig", cache_eviction_config_docstring) | ||
.def(py::init<>([](const size_t start_size, size_t recent_size, size_t max_cache_size, AggregationMode aggregation_mode) { | ||
return CacheEvictionConfig{start_size, recent_size, max_cache_size, aggregation_mode}; }), | ||
py::arg("start_size"), py::arg("recent_size"), py::arg("max_cache_size"), py::arg("aggregation_mode")) |
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.
we also have methods like get_start_size
, get_recent_size
etc
def scores(self) -> list[float]: | ||
... | ||
@property | ||
def texts(self) -> list: |
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 it possible to ensure that it reports as list[str]
?
def get_generation_ids(self) -> list: | ||
... | ||
@property | ||
def m_generation_ids(self) -> list: |
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.
list[str]
Decode a sequence into a string prompt. | ||
""" | ||
@typing.overload | ||
def decode(self, tokens: openvino._pyopenvino.Tensor) -> list: |
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.
list[str]
? and below the same
def finish_chat(self) -> None: | ||
... | ||
@typing.overload | ||
def generate(self, prompt: str, images: list[openvino._pyopenvino.Tensor], generation_config: GenerationConfig = None, streamer: typing.Callable[[str], bool] | StreamerBase | None = None, **kwargs) -> typing.Any: |
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.
let's also add overload where user don't have to pass list of tensors, e.g. when I have a single image.
On both C++ and Python levels.
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.
generation_config: GenerationConfig = None
looks strange as GenerationConfig
cannot be None
HEURISTIC: StopCriteria # value = <StopCriteria.HEURISTIC: 1> | ||
NEVER: StopCriteria # value = <StopCriteria.NEVER: 2> | ||
NORM_SUM: AggregationMode # value = <AggregationMode.NORM_SUM: 1> | ||
SUM: AggregationMode # value = <AggregationMode.SUM: 0> |
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.
not clear why these values are located inside openvino_genai
module, while for other enums like GenerationStatus
- not.
I would avoid populating such values to main openvino_genai
module.
CVS-156607