-
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
Whisper pipeline: implement chunk streamer for long-form audio processing #1148
base: master
Are you sure you want to change the base?
Whisper pipeline: implement chunk streamer for long-form audio processing #1148
Conversation
class StreamerBase { | ||
public: | ||
/// @brief put is called every time new token is decoded, | ||
/// @return bool flag to indicate whether generation should be stopped, if return true generation stops | ||
virtual bool put(int64_t token) = 0; | ||
|
||
/// @brief end is called at the end of generation. It can be used to flush cache if your own streamer has one | ||
virtual void end() = 0; | ||
|
||
virtual ~StreamerBase() = default; |
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.
it's better to move dtor definition to .cpp file and export this class
it will help with RTTI issue on some platforms
@@ -50,6 +51,7 @@ Config from_config_json_if_exists(const std::filesystem::path& models_path, cons | |||
} | |||
|
|||
ov::genai::StreamerVariant get_streamer_from_map(const ov::AnyMap& config_map); | |||
ov::genai::ChunkStreamerVariant get_chunk_streamer_from_map(const ov::AnyMap& config_map); |
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.
it's whisper specific entity. Maybe we can move it to whisper files? the same in other places like py_utils.hpp
these utils are supposed to be generic ones
@@ -76,6 +78,28 @@ class ConstructableStreamer: public StreamerBase { | |||
} | |||
}; | |||
|
|||
class ConstructableChunkStreamer: public ChunkStreamerBase { |
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.
move to src/python/py_whisper_pipeline.cpp
?
@@ -105,4 +109,7 @@ class OPENVINO_GENAI_EXPORTS WhisperPipeline { | |||
WhisperGenerationConfig get_generation_config() const; | |||
void set_generation_config(const WhisperGenerationConfig& config); | |||
}; | |||
|
|||
OPENVINO_GENAI_EXPORTS std::pair<std::string, Any> chunk_streamer(ChunkStreamerVariant func); | |||
OPENVINO_GENAI_EXPORTS std::pair<std::string, Any> whisper_generation_config(const WhisperGenerationConfig& 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.
I think we can overload existing function like streamer
and generation_config
instead of introducing Whisper specific.
Example:
openvino.genai/src/cpp/include/openvino/genai/image_generation/generation_config.hpp
Lines 99 to 100 in 2370f6a
OPENVINO_GENAI_EXPORTS | |
std::pair<std::string, ov::Any> generation_config(const ImageGenerationConfig& generation_config); |
No description provided.