intel / openvino-plugins-ai-audacity

A set of AI-enabled effects, generators, and analyzers for Audacity®.
GNU General Public License v3.0
725 stars 43 forks source link

Compilation of Whistper - Warning and Error: No rule on how to make a target #230

Closed oxidian24 closed 2 weeks ago

oxidian24 commented 2 weeks ago

Hello, I tried to compile the OpenVino and its plugins with Audacity version 3.5.1 Is it my mistake that I have placed the folder whisper-build to ~/OpenVino/Whisper ???

[100%] Building CXX object modules/mod-openvino/CMakeFiles/mod-openvino.dir/musicgen/musicgen.cpp.o /home/user/Audacity/audacity/modules/mod-openvino/musicgen/musicgen_for_conditional_generation.cpp: In constructor ‘ov_musicgen::MusicgenForConditionalGeneration::MusicgenForConditionalGeneration(ov_musicgen::MusicGenConfig&)’: /home/user/Audacity/audacity/modules/mod-openvino/musicgen/musicgen_for_conditional_generation.cpp:87:53: warning: narrowing conversion of ‘(num_encodec_secs 50)’ from ‘size_t’ {aka ‘long unsigned int’} to ‘ov::Dimension::value_type’ {aka ‘long int’} [-Wnarrowing] 87 | model->reshape({ 1, 1, 4, num_encodec_secs 50 }); | ~~~^~ make[2]: Žádné pravidlo jak vyrobit cíl (No rule on how to make a target) „/home/user/OpenVino/l_openvino_toolkit_ubuntu22_2024.0.0.14509.34caeefd078_x86_64/whisper-build/installed/lib/libwhisper.so“ potřebný pro (Needed for) „Release/lib/audacity/modules/mod-openvino.so“. Konec. (End) make[2]: Čeká se na nedokončené úlohy… ( Waiting for pending jobs ) [100%] Building CXX object modules/mod-openvino/CMakeFiles/mod-openvino.dir/OpenVINO.cpp.o make[1]: [CMakeFiles/Makefile2:6221: modules/mod-openvino/CMakeFiles/mod-openvino.dir/all] Chyba 2 make: [Makefile:166: all] Chyba 2 (Error 2)

Is it my mistake that I have placed the folder whisper-build to ~/OpenVino/Whisper instead of /home/user/OpenVino/l_openvino_toolkit_ubuntu22_2024.0.0.14509.34caeefd078_x86_64/ ???

Note: I can confirm, that his file exists: ~/OpenVino/Whisper/whisper-build/installed/lib$ ls -b libwhisper.so

/home/user/OpenVino $ ls build* build-audacity-with-openvino.sh

Audacity build script .sh: Bash:

#!/bin/bash
read -p "Warning! Make sure the correct directory of audacity-build is selected! Press a key to continue."
path_audacity_build="/home/user/Audacity/audacity-build/"
path_libtorch="/home/user/OpenVino/libtorch"
path_openvino_toolkit="/home/user/OpenVino/l_openvino_toolkit_ubuntu22_2024.0.0.14509.34caeefd078_x86_64"
path_whisper_build="/home/user/OpenVino/Whisper/whisper-build"

# OpenVINO
source "$path_openvino_toolkit/setupvars.sh"

# Libtorch
export LIBTORCH_ROOTDIR="$path_libtorch"

# Whisper.cpp
export WHISPERCPP_ROOTDIR="$path_whisper_build/installed"

export LD_LIBRARY_PATH=${WHISPERCPP_ROOTDIR}/lib:$LD_LIBRARY_PATH

cd "$path_audacity_build"

cmake -G "Unix Makefiles" ../audacity -DCMAKE_BUILD_TYPE=Release

# and re-run make command
make -j`nproc`
oxidian24 commented 2 weeks ago

I moved whisper to the toolkit folder and now it compiled.

Are you interested about warnings "narrowing"?

In file included from /home/user/Audacity/audacity/modules/mod-openvino/musicgen/musicgen_model_static.cpp:4:
/home/user/Audacity/audacity/modules/mod-openvino/musicgen/music_gen_decoder_full_batch2.h: In constructor ‘ov_musicgen::MusicgenDecoderModelFullStaticBatch2::MusicgenDecoderModelFullStaticBatch2(ov::Core&, ov_musicgen::MusicGenConfig&)’:
/home/user/Audacity/audacity/modules/mod-openvino/musicgen/music_gen_decoder_full_batch2.h:64:87: warning: narrowing conversion of ‘(max_tokens + 1)’ from ‘size_t’ {aka ‘long unsigned int’} to ‘ov::Dimension::value_type’ {aka ‘long int’} [-Wnarrowing]
   64 |                port_to_shape[model->input("custom_attention_mask")] = { 1, max_tokens + 1 };
      |                                                                            ~~~~~~~~~~~^~~
/home/user/Audacity/audacity/modules/mod-openvino/musicgen/music_gen_decoder_full_batch2.h:74:76: warning: narrowing conversion of ‘max_tokens’ from ‘size_t’ {aka ‘long unsigned int’} to ‘ov::Dimension::value_type’ {aka ‘long int’} [-Wnarrowing]
   74 |                         port_to_shape[model->input(tensorname)] = { 2, 16, max_tokens, 64 };
      |                                                                            ^~~~~~~~~~
/home/user/Audacity/audacity/modules/mod-openvino/musicgen/music_gen_decoder_full_batch2.h:181:27: warning: narrowing conversion of ‘(__gnu_cxx::__alloc_traits<std::allocator<long unsigned int>, long unsigned int>::value_type)(&(&(&((ov_musicgen::MusicgenDecoderModelFullStaticBatch2*)this)->ov_musicgen::MusicgenDecoderModelFullStaticBatch2::_past_key_values_ov.std::vector<std::vector<ov::Tensor> >::operator[](0))->std::vector<ov::Tensor>::operator[](2))->ov::Tensor::get_shape())->ov::Shape::operator[](2)’ from ‘__gnu_cxx::__alloc_traits<std::allocator<long unsigned int>, long unsigned int>::value_type’ {aka ‘long unsigned int’} to ‘ov::Dimension::value_type’ {aka ‘long int’} [-Wnarrowing]
  181 |             model->reshape({ {2, _past_key_values_ov[0][2].get_shape()[2], 1024} });
      |             ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/user/Audacity/audacity/modules/mod-openvino/musicgen/musicgen_model_static.cpp:5:
/home/user/Audacity/audacity/modules/mod-openvino/musicgen/music_gen_decoder_full_batch1.h: In constructor ‘ov_musicgen::MusicgenDecoderModelFullStaticBatch1::MusicgenDecoderModelFullStaticBatch1(ov::Core&, ov_musicgen::MusicGenConfig&)’:
/home/user/Audacity/audacity/modules/mod-openvino/musicgen/music_gen_decoder_full_batch1.h:216:27: warning: narrowing conversion of ‘(__gnu_cxx::__alloc_traits<std::allocator<long unsigned int>, long unsigned int>::value_type)(&(&(&((ov_musicgen::MusicgenDecoderModelFullStaticBatch1*)this)->ov_musicgen::MusicgenDecoderModelFullStaticBatch1::_decoder_batch[0].ov_musicgen::MusicgenDecoderModelFullStaticBatch1::DecoderBatchStuff::_past_key_values_ov.std::vector<std::vector<ov::Tensor> >::operator[](0))->std::vector<ov::Tensor>::operator[](2))->ov::Tensor::get_shape())->ov::Shape::operator[](2)’ from ‘__gnu_cxx::__alloc_traits<std::allocator<long unsigned int>, long unsigned int>::value_type’ {aka ‘long unsigned int’} to ‘ov::Dimension::value_type’ {aka ‘long int’} [-Wnarrowing]
  216 |             model->reshape({ {2, _decoder_batch[0]._past_key_values_ov[0][2].get_shape()[2], 1024} });
      |             ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[100%] Building CXX object modules/mod-openvino/CMakeFiles/mod-openvino.dir/musicgen/musicgen_for_conditional_generation.cpp.o
[100%] Building CXX object modules/mod-openvino/CMakeFiles/mod-openvino.dir/musicgen/musicgen.cpp.o
/home/user/Audacity/audacity/modules/mod-openvino/musicgen/musicgen_for_conditional_generation.cpp: In constructor ‘ov_musicgen::MusicgenForConditionalGeneration::MusicgenForConditionalGeneration(ov_musicgen::MusicGenConfig&)’:
/home/user/Audacity/audacity/modules/mod-openvino/musicgen/musicgen_for_conditional_generation.cpp:87:53: warning: narrowing conversion of ‘(num_encodec_secs * 50)’ from ‘size_t’ {aka ‘long unsigned int’} to ‘ov::Dimension::value_type’ {aka ‘long int’} [-Wnarrowing]
   87 |          model->reshape({ 1, 1, 4, num_encodec_secs * 50 });
      |                                    ~~~~~~~~~~~~~~~~~^~~~
[100%] Building CXX object modules/mod-openvino/CMakeFiles/mod-openvino.dir/OpenVINO.cpp.o
[100%] Linking CXX shared module ../../Release/lib/audacity/modules/mod-openvino.so
[100%] Built target mod-openvino
RyanMetcalfeInt8 commented 2 weeks ago

Hi @oxidian24,

I moved whisper to the toolkit folder and now it compiled.

Hmm, glad it's working now but you shouldn't have needed to do that. The location of the whisper build/installation shouldn't really matter, it's picked up via the WHISPERCPP_ROOTDIR -- so perhaps there was some mistake in setting that, and fixed when you moved it to the toolkit directory.

Are you interested about warnings "narrowing"

Not really. I may add an explicit cast to get rid of the warnings (or if you want to contribute fixes :smile:) -- but otherwise the actual narrowing shouldn't be an issue.

I'll close this one, as it seems like you are all set. Thanks!