Skip to content
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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

popovaan
Copy link
Contributor

@popovaan popovaan commented Nov 6, 2024

CVS-156607

@github-actions github-actions bot added category: text to image Text 2 image pipeline category: visual language Visual language pipeline category: continuous batching Continuous batching category: LLM LLM pipeline (stateful, static) category: whisper Whisper pipeline category: sampling Sampling / Decoding algorithms category: tokenizers Tokenizer class or submodule update category: Python API Python API for GenAI labels Nov 6, 2024
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"))
Copy link
Contributor

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:
Copy link
Contributor

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:
Copy link
Contributor

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:
Copy link
Contributor

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:
Copy link
Contributor

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.

Copy link
Contributor

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>
Copy link
Contributor

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.

@ilya-lavrenov ilya-lavrenov self-assigned this Nov 6, 2024
@ilya-lavrenov ilya-lavrenov added this to the 2025.0 milestone Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: continuous batching Continuous batching category: LLM LLM pipeline (stateful, static) category: Python API Python API for GenAI category: sampling Sampling / Decoding algorithms category: text to image Text 2 image pipeline category: tokenizers Tokenizer class or submodule update category: visual language Visual language pipeline category: whisper Whisper pipeline
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants