-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -18,6 +18,10 @@ using OptionalWhisperGenerationConfig = std::optional<WhisperGenerationConfig>; | |||||
|
||||||
using RawSpeechInput = std::vector<float>; | ||||||
|
||||||
// Return flag corresponds whether generation should be stopped: false means continue generation, true means stop. | ||||||
using ChunkStreamerVariant = | ||||||
std::variant<std::function<bool(std::string)>, std::shared_ptr<ChunkStreamerBase>, std::monostate>; | ||||||
|
||||||
struct WhisperDecodedResultChunk { | ||||||
// start of chunk in seconds | ||||||
float start_ts; | ||||||
|
@@ -83,7 +87,7 @@ class OPENVINO_GENAI_EXPORTS WhisperPipeline { | |||||
*/ | ||||||
WhisperDecodedResults generate(const RawSpeechInput& raw_speech_input, | ||||||
OptionalWhisperGenerationConfig generation_config = std::nullopt, | ||||||
StreamerVariant streamer = std::monostate()); | ||||||
ChunkStreamerVariant streamer = std::monostate()); | ||||||
|
||||||
/** | ||||||
* @brief High level generate that receives raw speech as a vector of floats and returns decoded output. | ||||||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. I think we can overload existing function like Example: openvino.genai/src/cpp/include/openvino/genai/image_generation/generation_config.hpp Lines 99 to 100 in 2370f6a
|
||||||
} // namespace ov::genai |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
#pragma once | ||
|
||
#include "openvino/genai/llm_pipeline.hpp" | ||
#include "openvino/genai/whisper_pipeline.hpp" | ||
#include "openvino/runtime/core.hpp" | ||
|
||
#include "visual_language/processor_config.hpp" | ||
|
@@ -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 commentThe 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 |
||
|
||
ov::genai::OptionalGenerationConfig get_config_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 better to move dtor definition to .cpp file and export this class
it will help with RTTI issue on some platforms