Skip to content

Conversation

BrandonWeng
Copy link
Contributor

@BrandonWeng BrandonWeng commented Jul 9, 2025

Following the LLM pipeline PR: 5636312#diff-38c2966d1144b82978ca2cfe7650879fb15bd6da5845a3c616e8d152b29317f1

./build/samples/c/whisper_speech_recognition/whisper_speech_recognition_c -m "/home/brandon/openvino.genai/ov_cache0/test_models/WhisperTiny/openai/whisper-tiny" -i "/home/brandon/openvino.genai/ov_cache0/test_data/how_are_you_doing_today.wav" --timestamps
 How are you doing today?
timestamps: [0.00, 2.00] text: How are you doing today?
~/openvino.genai$   SAMPLES_CPP_DIR=/home/brandon/openvino.genai/build/samples/cpp SAMPLES_C_DIR=/home/brandon/openvino.genai/build/samples/c python -m pytest tests/python_tests/samples -m whisper
========================================================================================== test session starts ===========================================================================================
platform linux -- Python 3.12.3, pytest-8.4.1, pluggy-1.6.0
rootdir: /home/brandon/openvino.genai/tests/python_tests
configfile: pytest.ini
plugins: langsmith-0.4.4, html-4.1.1, anyio-4.9.0, metadata-3.1.1
collected 77 items / 74 deselected / 3 selected

tests/python_tests/samples/test_whisper_speech_recognition.py ...                                                                                                                                  [100%]

============================================================================================ warnings summary ============================================================================================
../../../usr/lib/python3.12/multiprocessing/popen_fork.py:66
  /usr/lib/python3.12/multiprocessing/popen_fork.py:66: DeprecationWarning: This process (pid=2217) is multi-threaded, use of fork() may lead to deadlocks in the child.
    self.pid = os.fork()

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================================== 3 passed, 74 deselected, 1 warning in 2.14s ===============================================================================

ps: would be great to get access to NPU from WSL2 - its sooo much easier to debug compared to Powershell
intel/linux-npu-driver#56

@BrandonWeng BrandonWeng changed the title [WIP] Add C API for WhisperPipeline Add C API for WhisperPipeline Jul 10, 2025
@Wovchena Wovchena requested review from as-suvorov and Copilot July 10, 2025 07:38
Copilot

This comment was marked as outdated.

Comment on lines 154 to 164
OPENVINO_GENAI_C_EXPORTS ov_status_e ov_genai_generation_config_set_num_beam_groups(ov_genai_generation_config* config,
const size_t value);
OPENVINO_GENAI_C_EXPORTS ov_status_e ov_genai_generation_config_set_num_beam_group(ov_genai_generation_config* config,
const size_t value);

/**
* @brief Set the number of beams for beam search. 1 disables beam search.
* @param handle A pointer to the ov_genai_generation_config instance.
* @param value The number of beams for beam search.
* @return ov_status_e A status code, return OK(0) if successful.
*/
OPENVINO_GENAI_C_EXPORTS ov_status_e ov_genai_generation_config_set_num_beam_groups(ov_genai_generation_config* config,
const size_t value);
OPENVINO_GENAI_C_EXPORTS ov_status_e ov_genai_generation_config_set_num_beams(ov_genai_generation_config* config,
const size_t value);
Copy link
Collaborator

@rkazants rkazants Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it changed? Our API should be backward-compatible

Copy link
Contributor Author

@BrandonWeng BrandonWeng Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was confused here - the previous signatures were exactly the same but the comments mention different functionality. Perhaps only the second one should change

@BrandonWeng BrandonWeng requested a review from rkazants July 10, 2025 15:19
@BrandonWeng BrandonWeng requested a review from Wovchena July 18, 2025 02:03
options->sample_rate = DEFAULT_SAMPLE_RATE;

for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "-m") == 0 || strcmp(argv[i], "--model") == 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

С++ has simpler cmd interface inviting readers to modify the implementation themselves. Is there a reason to deviate from that? Of not, align them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, initially I also had benchmarking in this file so arguments was based on the benchmark_genai_c file .

But the performance benchmarks was removed from here so no point of the complicated arguments anymore . Let me remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed: #2414 (comment)

@BrandonWeng
Copy link
Contributor Author

BrandonWeng commented Jul 19, 2025

Simplified the arguments. Thanks for the review @Wovchena - ready for another go 🙏🏻

[ 98%] Built target openvino_genai_c
[100%] Building C object samples/c/whisper_speech_recognition/CMakeFiles/whisper_speech_recognition_c.dir/whisper_speech_recognition.c.o
[100%] Building C object samples/c/whisper_speech_recognition/CMakeFiles/whisper_speech_recognition_c.dir/whisper_utils.c.o
[100%] Linking C executable whisper_speech_recognition_c
[100%] Built target whisper_speech_recognition_c
> ./samples_bin/whisper_speech_recognition_c 'ov_cache0/test_models/WhisperTiny/openai/whisper-tiny' 'ov_cache0/test_data/how_are_you_doing_today.wav'
 How are you doing today?
timestamps: [0.00, 2.00] text:  How are you doing today?


> export SAMPLES_CPP_DIR="$(pwd)/samples_bin" && export SAMPLES_C_DIR="$(pwd)/samples_bin" && source .venv/bin/activate && python -m pytest
  tests/python_tests/samples/test_whisper_speech_recognition.py -v -m whisper
========================================================================================= test session starts =========================================================================================
platform linux -- Python 3.12.3, pytest-8.4.1, pluggy-1.6.0 -- /home/brandon/openvino.genai/.venv/bin/python
cachedir: .pytest_cache
metadata: {'Python': '3.12.3', 'Platform': 'Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.39', 'Packages': {'pytest': '8.4.1', 'pluggy': '1.6.0'}, 'Plugins': {'langsmith': '0.4.4', 'html': '4.1.1', 'anyio': '4.9.0', 'metadata': '3.1.1'}}
rootdir: /home/brandon/openvino.genai/tests/python_tests
configfile: pytest.ini
plugins: langsmith-0.4.4, html-4.1.1, anyio-4.9.0, metadata-3.1.1
collected 1 item

tests/python_tests/samples/test_whisper_speech_recognition.py::TestWhisperSpeechRecognition::test_sample_whisper_speech_recognition[download_test_content=how_are_you_doing_today.wav-convert_model=WhisperTiny] PASSED [100%]

========================================================================================== warnings summary ===========================================================================================
../../../usr/lib/python3.12/multiprocessing/popen_fork.py:66
  /usr/lib/python3.12/multiprocessing/popen_fork.py:66: DeprecationWarning: This process (pid=114380) is multi-threaded, use of fork() may lead to deadlocks in the child.
    self.pid = os.fork()

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
==================================================================================== 1 passed, 1 warning in 2.36s =====================================================================================

@BrandonWeng BrandonWeng requested a review from Wovchena July 19, 2025 00:00
Copy link
Collaborator

@Wovchena Wovchena Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add README.md (I missed that earlier. I hope this is going to be the last change request)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

Added README (based off the C++ whisper and the C LLM Pipeline one) :
55a36e9

@BrandonWeng BrandonWeng requested a review from Wovchena July 21, 2025 22:04
Copy link
Collaborator

@Wovchena Wovchena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! There're CI problems, so this PR will hang unmerged for some time similar to others. Is that OK for you?

@BrandonWeng
Copy link
Contributor Author

Thank you! There're CI problems, so this PR will hang unmerged for some time similar to others. Is that OK for you?

Woo! Thanks for all the reviews. Should be fine, I have what I need to continue .NET wrapper for whisper

https://github.com/FluidInference/OpenVINO.GenAI.NET

@Wovchena
Copy link
Collaborator

build_jenkins

@Wovchena Wovchena enabled auto-merge July 24, 2025 16:43
@Wovchena
Copy link
Collaborator

Strangely I don't have permission to update your branch. Can you merge master yourself?

@BrandonWeng
Copy link
Contributor Author

Strangely I don't have permission to update your branch. Can you merge master yourself?

Weird, I wonder if it’s because it’s my fork. updated

@Wovchena
Copy link
Collaborator

build_jenkins

@BrandonWeng
Copy link
Contributor Author

BrandonWeng commented Jul 26, 2025

@Wovchena it might be easiest if I just give you write access to our fork. Seems like the timing matters quite a bit here :'(

bweng-Google Chrome-2025-07-25-at-21 44 52

Also these tests seem a bit flakey?
bweng-Google Chrome-2025-07-25-at-21 46 22
bweng-Google Chrome-2025-07-25-at-21 47 03

@Wovchena
Copy link
Collaborator

build_jenkins

@Wovchena Wovchena disabled auto-merge July 28, 2025 06:42
@Wovchena Wovchena merged commit 454e4d1 into openvinotoolkit:master Jul 28, 2025
194 of 212 checks passed
@as-suvorov as-suvorov linked an issue Jul 29, 2025 that may be closed by this pull request
@mlukasze mlukasze added this to the 2025.3 milestone Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for WhisperPipeline for C API?
5 participants