-
Notifications
You must be signed in to change notification settings - Fork 293
WIP-1: Create asr pipeline and paraformerASR constructor. #2804
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: 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 |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Copyright (C) 2023-2025 Intel Corporation | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "utils.hpp" | ||
|
|
||
| namespace ov { | ||
| namespace genai { | ||
|
|
||
| // forward declaration | ||
| class ASRPipelineImplBase; | ||
|
|
||
| class OPENVINO_GENAI_EXPORTS ASRPipeline { | ||
| public: | ||
| explicit ASRPipeline(const std::filesystem::path& model_dir, | ||
| const std::string& device, | ||
| const ov::AnyMap& properties = {}); | ||
|
|
||
| static ASRPipeline paraformerASR(const std::filesystem::path& model_dir, | ||
| const std::string& device, | ||
| const ov::AnyMap& properties = {}); | ||
|
|
||
| private: | ||
| std::shared_ptr<ASRPipelineImplBase> m_impl; | ||
|
|
||
| explicit ASRPipeline(const std::shared_ptr<ASRPipelineImplBase>& impl); | ||
| }; | ||
|
|
||
| } // namespace genai | ||
| } // namespace ov | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,32 @@ | ||||||||||
| // Copyright (C) 2023-2025 Intel Corporation | ||||||||||
| // SPDX-License-Identifier: Apache-2.0 | ||||||||||
|
|
||||||||||
| #include <cassert> | ||||||||||
|
|
||||||||||
| #include "openvino/genai/speech_recognition/asr_pipeline.hpp" | ||||||||||
|
|
||||||||||
| #include "speech_recognition/paraformer_impl.hpp" | ||||||||||
|
|
||||||||||
| namespace ov { | ||||||||||
| namespace genai { | ||||||||||
|
|
||||||||||
| ASRPipeline::ASRPipeline(const std::filesystem::path& model_dir, | ||||||||||
| const std::string& device, | ||||||||||
| const ov::AnyMap& properties) { | ||||||||||
|
|
||||||||||
|
Comment on lines
+15
to
+16
|
||||||||||
| const ov::AnyMap& properties) { | |
| const ov::AnyMap& properties) | |
| : m_impl(std::make_shared<ParaformerImpl>(model_dir, device, properties)) { | |
| assert(m_impl != nullptr); |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,23 @@ | ||||||||||||||||
| // Copyright (C) 2023-2025 Intel Corporation | ||||||||||||||||
| // SPDX-License-Identifier: Apache-2.0 | ||||||||||||||||
|
|
||||||||||||||||
| #pragma once | ||||||||||||||||
|
|
||||||||||||||||
| #include <filesystem> | ||||||||||||||||
| #include "openvino/openvino.hpp" | ||||||||||||||||
| #include "openvino/runtime/intel_gpu/properties.hpp" | ||||||||||||||||
| #include "openvino/runtime/intel_npu/properties.hpp" | ||||||||||||||||
|
|
||||||||||||||||
| namespace ov { | ||||||||||||||||
| namespace genai { | ||||||||||||||||
|
|
||||||||||||||||
| class ASRPipelineImplBase { | ||||||||||||||||
| public: | ||||||||||||||||
| ASRPipelineImplBase(const std::filesystem::path& model_dir, | ||||||||||||||||
| const std::string& device, | ||||||||||||||||
| const ov::AnyMap& properties = {}) {}; | ||||||||||||||||
|
Comment on lines
+16
to
+18
|
||||||||||||||||
| ASRPipelineImplBase(const std::filesystem::path& model_dir, | |
| const std::string& device, | |
| const ov::AnyMap& properties = {}) {}; | |
| explicit ASRPipelineImplBase(const std::filesystem::path& model_dir, | |
| const std::string& device, | |
| const ov::AnyMap& properties = {}) | |
| {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // Copyright (C) 2023-2025 Intel Corporation | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| #include "paraformer_impl.hpp" | ||
|
|
||
| namespace ov { | ||
| namespace genai { | ||
|
|
||
| ParaformerImpl::ParaformerImpl(const std::filesystem::path& model_dir, | ||
|
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. how do you get IRs for paraformer models? Do exporting and inference work in optimum-intel? If no, then we must add it for the full consistent user experience. 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. The peraformer IRs upstream to huggingface. Here is the link. 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. No, that is not how it should work. All supported models must pass optimum-cli tool conversion. 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. Just to make it explicit. The ticket was created: CVS-174743 |
||
| const std::string& device, | ||
| const ov::AnyMap& properties) | ||
| : ASRPipelineImplBase(model_dir, device, properties) | ||
| { | ||
|
|
||
| } | ||
|
|
||
| ParaformerImpl::~ParaformerImpl() | ||
| {} | ||
|
|
||
| } // namespace genai | ||
| } // namespace ov | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,20 @@ | ||||||
| // Copyright (C) 2023-2025 Intel Corporation | ||||||
| // SPDX-License-Identifier: Apache-2.0 | ||||||
|
|
||||||
| #pragma once | ||||||
|
|
||||||
| #include "asr_pipelinee_impl_base.hpp" | ||||||
|
||||||
| #include "asr_pipelinee_impl_base.hpp" | |
| #include "asr_pipeline_impl_base.hpp" |
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.
what is about Whisper pipeline? Will it work with ASRPipeline? I expect -yes. Please add tests for this.
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.
Agree,
ASRPipelineshould work with Whisper model. Once we addASRPipelineI expect whisper pipeline to be deprecated.Uh oh!
There was an error while loading. Please reload this page.
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.
Yes, I think Whisper pipeline will work with ASRPipeline. Let me also work on this to integrate with Whisper. @rkazants also mentioned tests for whisper. could you also show me the current tests for Whisper pipeline? I can refer to the current implementation. Thanks
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.
whisper tests are here:
https://github.com/openvinotoolkit/openvino.genai/blob/master/tests/python_tests/test_whisper_pipeline.py
https://github.com/openvinotoolkit/openvino.genai/blob/master/tests/python_tests/test_whisper_pipeline_static.py