Closed lyssieth closed 3 weeks ago
I never even knew whisper.cpp supported that, I'll look into it.
I only found out myself today, though... I also started looking into it today. It "works on my machine" so if there's any help I can provide just ask!
I tried hacking it together myself but gave up, I really need to learn how C/CPP binding crates are made/work so I can be more better.
If it's as simple as it looks 0392350d692e89885eb0064d60ab85abd1a6043d should be all it needs. Hopefully it works :3
Not quite that simple, it turns out.
log output:
CMake Warning (dev) at /usr/share/cmake/Modules/CMakeDetermineCompiler.cmake:152 (set):
Policy CMP0126 is not set: set(CACHE) does not remove a normal variable of
the same name. Run "cmake --help-policy CMP0126" for policy details. Use
the cmake_policy command to set the policy and suppress this warning.
For compatibility with older versions of CMake, normal variable
"CMAKE_C_COMPILER" will be removed from the current scope.
Call Stack (most recent call first):
/usr/share/cmake/Modules/CMakeDetermineCCompiler.cmake:68 (_cmake_find_compiler_path)
CMakeLists.txt:3 (project)
This warning is for project developers. Use -Wno-dev to suppress it.
Called from: [3] /usr/share/cmake/Modules/CMakeDetermineCompiler.cmake
[2] /usr/share/cmake/Modules/CMakeDetermineCCompiler.cmake
[1] /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
CMake Warning (dev) at /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:922 (file):
Policy CMP0159 is not set: file(STRINGS) with REGEX updates
CMAKE_MATCH_<n>. Run "cmake --help-policy CMP0159" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
For compatibility, CMake is leaving CMAKE_MATCH_<n> unchanged.
Call Stack (most recent call first):
/usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
/usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
/usr/share/cmake/Modules/CMakeDetermineCCompiler.cmake:123 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:3 (project)
This warning is for project developers. Use -Wno-dev to suppress it.
Called from: [5] /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake
[4] /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake
[3] /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake
[2] /usr/share/cmake/Modules/CMakeDetermineCCompiler.cmake
[1] /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
CMake Warning (dev) at /usr/share/cmake/Modules/CMakeDetermineCompiler.cmake:152 (set):
Policy CMP0126 is not set: set(CACHE) does not remove a normal variable of
the same name. Run "cmake --help-policy CMP0126" for policy details. Use
the cmake_policy command to set the policy and suppress this warning.
For compatibility with older versions of CMake, normal variable
"CMAKE_CXX_COMPILER" will be removed from the current scope.
Call Stack (most recent call first):
/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:72 (_cmake_find_compiler_path)
CMakeLists.txt:3 (project)
This warning is for project developers. Use -Wno-dev to suppress it.
Called from: [3] /usr/share/cmake/Modules/CMakeDetermineCompiler.cmake
[2] /usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake
[1] /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
CMake Warning (dev) at /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:922 (file):
Policy CMP0159 is not set: file(STRINGS) with REGEX updates
CMAKE_MATCH_<n>. Run "cmake --help-policy CMP0159" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
For compatibility, CMake is leaving CMAKE_MATCH_<n> unchanged.
Call Stack (most recent call first):
/usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:13 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
/usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)
/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:126 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:3 (project)
This warning is for project developers. Use -Wno-dev to suppress it.
Called from: [5] /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake
[4] /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake
[3] /usr/share/cmake/Modules/CMakeDetermineCompilerId.cmake
[2] /usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake
[1] /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
CMake Warning (dev) at /usr/share/cmake/Modules/CMakeFindBinUtils.cmake:235 (find_program):
Policy CMP0126 is not set: set(CACHE) does not remove a normal variable of
the same name. Run "cmake --help-policy CMP0126" for policy details. Use
the cmake_policy command to set the policy and suppress this warning.
For compatibility with older versions of CMake, normal variable
"CMAKE_TAPI" will be removed from the current scope.
Call Stack (most recent call first):
/usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:207 (include)
CMakeLists.txt:3 (project)
This warning is for project developers. Use -Wno-dev to suppress it.
Called from: [3] /usr/share/cmake/Modules/CMakeFindBinUtils.cmake
[2] /usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake
[1] /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
CMake Warning (dev) at /usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:64 (try_compile):
Policy CMP0066 is not set: Honor per-config flags in try_compile()
source-file signature. Run "cmake --help-policy CMP0066" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
For compatibility with older versions of CMake, try_compile is not honoring
caller config-specific compiler flags (e.g. CMAKE_C_FLAGS_DEBUG) in the
test project.
Call Stack (most recent call first):
/usr/share/cmake/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)
CMakeLists.txt:3 (project)
This warning is for project developers. Use -Wno-dev to suppress it.
Called from: [3] /usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake
[2] /usr/share/cmake/Modules/CMakeTestCCompiler.cmake
[1] /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
CMake Warning (dev) at /usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:92 (file):
Policy CMP0159 is not set: file(STRINGS) with REGEX updates
CMAKE_MATCH_<n>. Run "cmake --help-policy CMP0159" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
For compatibility, CMake is leaving CMAKE_MATCH_<n> unchanged.
Call Stack (most recent call first):
/usr/share/cmake/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)
CMakeLists.txt:3 (project)
This warning is for project developers. Use -Wno-dev to suppress it.
Called from: [3] /usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake
[2] /usr/share/cmake/Modules/CMakeTestCCompiler.cmake
[1] /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
CMake Warning (dev) at /usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:64 (try_compile):
Policy CMP0066 is not set: Honor per-config flags in try_compile()
source-file signature. Run "cmake --help-policy CMP0066" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
For compatibility with older versions of CMake, try_compile is not honoring
caller config-specific compiler flags (e.g. CMAKE_C_FLAGS_DEBUG) in the
test project.
Call Stack (most recent call first):
/usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)
CMakeLists.txt:3 (project)
This warning is for project developers. Use -Wno-dev to suppress it.
Called from: [3] /usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake
[2] /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake
[1] /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
CMake Warning (dev) at /usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:92 (file):
Policy CMP0159 is not set: file(STRINGS) with REGEX updates
CMAKE_MATCH_<n>. Run "cmake --help-policy CMP0159" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
For compatibility, CMake is leaving CMAKE_MATCH_<n> unchanged.
Call Stack (most recent call first):
/usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)
CMakeLists.txt:3 (project)
This warning is for project developers. Use -Wno-dev to suppress it.
Called from: [3] /usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake
[2] /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake
[1] /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
CMake Warning (dev) at /usr/share/cmake/Modules/Internal/CheckSourceCompiles.cmake:101 (try_compile):
Policy CMP0066 is not set: Honor per-config flags in try_compile()
source-file signature. Run "cmake --help-policy CMP0066" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
For compatibility with older versions of CMake, try_compile is not honoring
caller config-specific compiler flags (e.g. CMAKE_C_FLAGS_DEBUG) in the
test project.
Call Stack (most recent call first):
/usr/share/cmake/Modules/CheckCSourceCompiles.cmake:52 (cmake_check_source_compiles)
/usr/share/cmake/Modules/FindThreads.cmake:97 (CHECK_C_SOURCE_COMPILES)
/usr/share/cmake/Modules/FindThreads.cmake:163 (_threads_check_libc)
CMakeLists.txt:106 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
Called from: [5] /usr/share/cmake/Modules/Internal/CheckSourceCompiles.cmake
[4] /usr/share/cmake/Modules/CheckCSourceCompiles.cmake
[3] /usr/share/cmake/Modules/FindThreads.cmake
[2] /usr/share/cmake/Modules/FindThreads.cmake
[1] /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
CMake Warning at CMakeLists.txt:241 (message):
Only LLVM is supported for HIP, hint: CC=/opt/rocm/llvm/bin/clang
Called from: [1] /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
CMake Warning at CMakeLists.txt:244 (message):
Only LLVM is supported for HIP, hint: CXX=/opt/rocm/llvm/bin/clang++
Called from: [1] /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
Entering /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/bindings
Called from: [1] /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
Returning to /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp
Called from: [1] /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
CMake Warning (dev) at CMakeLists.txt:468 (add_library):
Policy CMP0156 is not set: De-duplicate libraries on link lines based on
linker capabilities. Run "cmake --help-policy CMP0156" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
Since the policy is not set, legacy libraries de-duplication strategy will
be applied.
This warning is for project developers. Use -Wno-dev to suppress it.
Called from: [1] /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_ASM_COMPILER
CMAKE_ASM_FLAGS
WHISPER_METAL
c++: error: language hip not recognized
c++: error: language hip not recognized
make[2]: *** [CMakeFiles/ggml-rocm.dir/build.make:79: CMakeFiles/ggml-rocm.dir/ggml-cuda.cu.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/ggml-rocm.dir/all] Error 2
make: *** [Makefile:139: all] Error 2
thread 'main' panicked at /home/lys/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5:
command did not execute successfully, got: exit status: 2
build script failed, must exit now
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
relevant parts I think:
CMake Warning at CMakeLists.txt:241 (message):
Only LLVM is supported for HIP, hint: CC=/opt/rocm/llvm/bin/clang
CMake Warning at CMakeLists.txt:244 (message):
Only LLVM is supported for HIP, hint: CXX=/opt/rocm/llvm/bin/clang++
Try out 31289e261167bdf7ec3efd009cf47cc17f2fab9e, the hint there was actually super nice, thanks for pointing it out.
Again fails, but for a... much weirder reason. It tries to install it to /usr/lib
?
CMake Error at cmake_install.cmake:52 (file):
file INSTALL cannot copy file
"/tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build/libwhisper.so"
to "/usr/local/lib/libwhisper.so": Permission denied.
make: *** [Makefile:110: install] Error 1
thread 'main' panicked at /home/lys/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5:
command did not execute successfully, got: exit status: 2
But then running the build again it worked, so I dunno what's up there.
Also getting an error trying to run the audio_transcription
example (after editing the code to make it work with my specific files)
whisper_init_from_file_with_params_no_state: loading model from '/home/lys/Downloads/ggml-medium.en.bin'
whisper_model_load: loading model
whisper_model_load: n_vocab = 51864
whisper_model_load: n_audio_ctx = 1500
whisper_model_load: n_audio_state = 1024
whisper_model_load: n_audio_head = 16
whisper_model_load: n_audio_layer = 24
whisper_model_load: n_text_ctx = 448
whisper_model_load: n_text_state = 1024
whisper_model_load: n_text_head = 16
whisper_model_load: n_text_layer = 24
whisper_model_load: n_mels = 80
whisper_model_load: ftype = 1
whisper_model_load: qntvr = 0
whisper_model_load: type = 4 (medium)
whisper_model_load: adding 1607 extra tokens
whisper_model_load: n_langs = 99
ggml_init_cublas: GGML_CUDA_FORCE_MMQ: no
ggml_init_cublas: CUDA_USE_TENSOR_CORES: yes
ggml_init_cublas: found 1 ROCm devices:
Device 0: AMD Radeon RX 7900 XTX, compute capability 11.0, VMM: no
whisper_model_load: CPU buffer size = 1533.52 MB
whisper_model_load: model size = 1533.14 MB
whisper_init_state: kv self size = 132.12 MB
whisper_init_state: kv cross size = 147.46 MB
whisper_init_state: compute buffer (conv) = 25.61 MB
whisper_init_state: compute buffer (encode) = 170.28 MB
whisper_init_state: compute buffer (cross) = 7.85 MB
whisper_init_state: compute buffer (decode) = 98.31 MB
CUDA error: shared object initialization failed
current device: 0, in function ggml_cuda_op_mul_mat at /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/ggml-cuda.cu:8243
hipGetLastError()
GGML_ASSERT: /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/ggml-cuda.cu:226: !"CUDA error"
ptrace: Operation not permitted.
No stack.
The program is not being run.
Edit: best guess is that there's some difference between latest whisper.cpp
commit that built and worked on my machine, and the one this repo uses?
Yeah uh I got nothing for that one. You could cd into sys/whisper.cpp and do a git pull to update whisper.cpp and see if that fixes it. Doesn't look like there's any changes that should affect the repo as it stands so it should compile.
I did that, got some compile errors.
error[E0425]: cannot find function `ggml_cpu_has_cublas` in crate `whisper_rs_sys`
--> src/standalone.rs:121:41
|
121 | cublas: whisper_rs_sys::ggml_cpu_has_cublas() != 0,
| ^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `ggml_cpu_has_blas`
|
::: /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/bindings.rs:5192:5
|
5192 | pub fn ggml_cpu_has_blas() -> ::std::os::raw::c_int;
| --------------------------------------------------- similarly named function `ggml_cpu_has_blas` defined here
error[E0412]: cannot find type `whisper_abort_callback` in crate `whisper_rs_sys`
--> src/lib.rs:45:49
|
45 | pub type WhisperAbortCallback = whisper_rs_sys::whisper_abort_callback;
| ^^^^^^^^^^^^^^^^^^^^^^ help: a type alias with a similar name exists: `whisper_progress_callback`
|
::: /tmp/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/bindings.rs:6174:1
|
6174 | pub type whisper_progress_callback = ::std::option::Option<
| ---------------------------------- similarly named type alias `whisper_progress_callback` defined here
error[E0063]: missing fields `dtw_aheads`, `dtw_aheads_preset`, `dtw_mem_size` and 3 other fields in initializer of `whisper_context_params`
--> src/whisper_ctx.rs:574:9
|
574 | whisper_rs_sys::whisper_context_params {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `dtw_aheads`, `dtw_aheads_preset`, `dtw_mem_size` and 3 other fields
Some errors have detailed explanations: E0063, E0412, E0425.
For more information about an error, try `rustc --explain E0063`.
error: could not compile `whisper-rs` (lib) due to 3 previous errors
Seemingly unrelated to the hipblas feature. On https://github.com/ggerganov/whisper.cpp/commit/8f253ef3af1c62c04316ba4afa7145fc4d701a8c
Re: https://github.com/tazz4843/whisper-rs/issues/135#issuecomment-2054193408 I tested with the version of whisper.cpp that is in the repo currently, and it still works fine there. So I don't know where the bug is.
Also, did a cargo clean
, now it won't build at all.
Full log
error: failed to run custom build command for `whisper-rs-sys v0.8.1 (/home/lys/Downloads/whisper-rs/sys)`
Caused by:
process didn't exit successfully: `/home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-cfd175933cf4a0a8/build-script-build` (exit status: 101)
--- stdout
cargo:rustc-link-lib=dylib=stdc++
cargo:rustc-link-lib=hipblas
cargo:rustc-link-lib=amdhip64
cargo:rustc-link-lib=rocblas
cargo:rustc-link-search=/opt/rocm/lib
cargo:rerun-if-changed=wrapper.h
cargo:rerun-if-env-changed=TARGET
cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS
cargo:rerun-if-changed=wrapper.h
cargo:rerun-if-changed=./whisper.cpp/whisper.h
cargo:rerun-if-changed=./whisper.cpp/ggml.h
cargo:rerun-if-changed=/usr/lib/clang/17/include/stdbool.h
cargo:rerun-if-changed=/usr/lib/clang/17/include/stddef.h
cargo:rerun-if-changed=/usr/lib/clang/17/include/__stddef_max_align_t.h
cargo:rerun-if-changed=/usr/lib/clang/17/include/stdint.h
cargo:rerun-if-changed=/usr/include/stdint.h
cargo:rerun-if-changed=/usr/include/bits/libc-header-start.h
cargo:rerun-if-changed=/usr/include/features.h
cargo:rerun-if-changed=/usr/include/features-time64.h
cargo:rerun-if-changed=/usr/include/bits/wordsize.h
cargo:rerun-if-changed=/usr/include/bits/timesize.h
cargo:rerun-if-changed=/usr/include/bits/wordsize.h
cargo:rerun-if-changed=/usr/include/stdc-predef.h
cargo:rerun-if-changed=/usr/include/sys/cdefs.h
cargo:rerun-if-changed=/usr/include/bits/wordsize.h
cargo:rerun-if-changed=/usr/include/bits/long-double.h
cargo:rerun-if-changed=/usr/include/gnu/stubs.h
cargo:rerun-if-changed=/usr/include/gnu/stubs-64.h
cargo:rerun-if-changed=/usr/include/bits/types.h
cargo:rerun-if-changed=/usr/include/features.h
cargo:rerun-if-changed=/usr/include/bits/wordsize.h
cargo:rerun-if-changed=/usr/include/bits/timesize.h
cargo:rerun-if-changed=/usr/include/bits/wordsize.h
cargo:rerun-if-changed=/usr/include/bits/typesizes.h
cargo:rerun-if-changed=/usr/include/bits/time64.h
cargo:rerun-if-changed=/usr/include/bits/wchar.h
cargo:rerun-if-changed=/usr/include/bits/wordsize.h
cargo:rerun-if-changed=/usr/include/bits/stdint-intn.h
cargo:rerun-if-changed=/usr/include/bits/types.h
cargo:rerun-if-changed=/usr/include/bits/stdint-uintn.h
cargo:rerun-if-changed=/usr/include/bits/types.h
cargo:rerun-if-changed=/usr/include/bits/stdint-least.h
cargo:rerun-if-changed=/usr/include/bits/types.h
cargo:rerun-if-changed=/usr/include/stdio.h
cargo:rerun-if-changed=/usr/include/bits/libc-header-start.h
cargo:rerun-if-changed=/usr/include/features.h
cargo:rerun-if-changed=/usr/lib/clang/17/include/stddef.h
cargo:rerun-if-changed=/usr/lib/clang/17/include/stdarg.h
cargo:rerun-if-changed=/usr/include/bits/types.h
cargo:rerun-if-changed=/usr/include/bits/types/__fpos_t.h
cargo:rerun-if-changed=/usr/include/bits/types.h
cargo:rerun-if-changed=/usr/include/bits/types/__mbstate_t.h
cargo:rerun-if-changed=/usr/include/bits/types/__fpos64_t.h
cargo:rerun-if-changed=/usr/include/bits/types.h
cargo:rerun-if-changed=/usr/include/bits/types/__mbstate_t.h
cargo:rerun-if-changed=/usr/include/bits/types/__FILE.h
cargo:rerun-if-changed=/usr/include/bits/types/FILE.h
cargo:rerun-if-changed=/usr/include/bits/types/struct_FILE.h
cargo:rerun-if-changed=/usr/include/bits/types.h
cargo:rerun-if-changed=/usr/include/bits/types/cookie_io_functions_t.h
cargo:rerun-if-changed=/usr/include/bits/types.h
cargo:rerun-if-changed=/usr/include/bits/stdio_lim.h
cargo:rerun-if-changed=/usr/include/bits/floatn.h
cargo:rerun-if-changed=/usr/include/features.h
cargo:rerun-if-changed=/usr/include/bits/floatn-common.h
cargo:rerun-if-changed=/usr/include/features.h
cargo:rerun-if-changed=/usr/include/bits/long-double.h
cargo:rerun-if-changed=/usr/lib/clang/17/include/stddef.h
cargo:rerun-if-changed=/usr/lib/clang/17/include/stdint.h
cargo:rerun-if-changed=/usr/lib/clang/17/include/stdbool.h
cargo:rerun-if-changed=./whisper.cpp/ggml.h
CMAKE_TOOLCHAIN_FILE_x86_64-unknown-linux-gnu = None
CMAKE_TOOLCHAIN_FILE_x86_64_unknown_linux_gnu = None
HOST_CMAKE_TOOLCHAIN_FILE = None
CMAKE_TOOLCHAIN_FILE = None
CMAKE_GENERATOR_x86_64-unknown-linux-gnu = None
CMAKE_GENERATOR_x86_64_unknown_linux_gnu = None
HOST_CMAKE_GENERATOR = None
CMAKE_GENERATOR = None
CMAKE_PREFIX_PATH_x86_64-unknown-linux-gnu = None
CMAKE_PREFIX_PATH_x86_64_unknown_linux_gnu = None
HOST_CMAKE_PREFIX_PATH = None
CMAKE_PREFIX_PATH = None
CMAKE_x86_64-unknown-linux-gnu = None
CMAKE_x86_64_unknown_linux_gnu = None
HOST_CMAKE = None
CMAKE = None
running: cd "/home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build" && CMAKE_PREFIX_PATH="" "cmake" "-Wdev" "--debug-output" "/home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/" "-DBUILD_SHARED_LIBS=OFF" "-DWHISPER_ALL_WARNINGS=OFF" "-DWHISPER_ALL_WARNINGS_3RD_PARTY=OFF" "-DWHISPER_BUILD_TESTS=OFF" "-DWHISPER_BUILD_EXAMPLES=OFF" "-DWHISPER_METAL=OFF" "-DWHISPER_HIPBLAS=ON" "-DCMAKE_C_COMPILER=/opt/rocm/llvm/bin/clang" "-DCMAKE_CXX_COMPILER=/opt/rocm/llvm/bin/clang++" "-DCMAKE_BUILD_TYPE=RelWithDebInfo" "-DCMAKE_INSTALL_PREFIX=/home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
Running with debug output on.
-- HIP and hipBLAS found
Called from: [1] /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
-- CMAKE_SYSTEM_PROCESSOR: x86_64
Called from: [1] /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
-- x86 detected
Called from: [1] /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
-- Configuring done (0.1s)
-- Generating /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build
Called from: [1] /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
-- Generating /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build/bindings
Called from: [1] /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/bindings/CMakeLists.txt
-- Generating done (0.0s)
-- Build files have been written to: /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build
running: cd "/home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build" && MAKEFLAGS="-j --jobserver-fds=7,8 --jobserver-auth=7,8" "cmake" "--build" "." "--target" "install" "--config" "Release"
Change Dir: '/home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build'
Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile install
/usr/bin/cmake -S/home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp -B/home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build/CMakeFiles /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build//CMakeFiles/progress.marks
/usr/bin/make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build'
/usr/bin/make -f CMakeFiles/ggml-rocm.dir/build.make CMakeFiles/ggml-rocm.dir/depend
make[2]: Entering directory '/home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build'
cd /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build/CMakeFiles/ggml-rocm.dir/DependInfo.cmake "--color="
make[2]: Leaving directory '/home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build'
/usr/bin/make -f CMakeFiles/ggml-rocm.dir/build.make CMakeFiles/ggml-rocm.dir/build
make[2]: Entering directory '/home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build'
[ 14%] Building CXX object CMakeFiles/ggml-rocm.dir/ggml-cuda.cu.o
/opt/rocm/llvm/bin/clang++ -DGGML_USE_CUDA -DGGML_USE_HIPBLAS -DUSE_PROF_API=1 -D_GNU_SOURCE -D_XOPEN_SOURCE=600 -D__HIP_PLATFORM_AMD__=1 -isystem /opt/rocm/include -ffunction-sections -fdata-sections -fPIC -m64 -O2 -g -DNDEBUG -std=gnu++11 -fPIC -mllvm -amdgpu-early-inline-all=true -mllvm -amdgpu-function-calls=false -x hip -MD -MT CMakeFiles/ggml-rocm.dir/ggml-cuda.cu.o -MF CMakeFiles/ggml-rocm.dir/ggml-cuda.cu.o.d -o CMakeFiles/ggml-rocm.dir/ggml-cuda.cu.o -c /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/ggml-cuda.cu
make[2]: Leaving directory '/home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build'
make[1]: Leaving directory '/home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/build'
--- stderr
Entering /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/bindings
Called from: [1] /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
Returning to /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp
Called from: [1] /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
CMake Warning (dev) at CMakeLists.txt:603 (add_library):
Policy CMP0156 is not set: De-duplicate libraries on link lines based on
linker capabilities. Run "cmake --help-policy CMP0156" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
Since the policy is not set, legacy libraries de-duplication strategy will
be applied.
This warning is for project developers. Use -Wno-dev to suppress it.
Called from: [1] /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
In file included from /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/ggml-cuda.cu:5:
/home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/ggml-cuda/common.cuh:3:10: fatal error: 'ggml.h' file not found
#include "ggml.h"
^~~~~~~~
1 error generated when compiling for gfx906.
make[2]: *** [CMakeFiles/ggml-rocm.dir/build.make:79: CMakeFiles/ggml-rocm.dir/ggml-cuda.cu.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/ggml-rocm.dir/all] Error 2
make: *** [Makefile:139: all] Error 2
thread 'main' panicked at /home/lys/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5:
command did not execute successfully, got: exit status: 2
build script failed, must exit now
Just the stderr
--- stderr
Entering /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/bindings
Called from: [1] /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
Returning to /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp
Called from: [1] /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
CMake Warning (dev) at CMakeLists.txt:603 (add_library):
Policy CMP0156 is not set: De-duplicate libraries on link lines based on
linker capabilities. Run "cmake --help-policy CMP0156" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
Since the policy is not set, legacy libraries de-duplication strategy will
be applied.
This warning is for project developers. Use -Wno-dev to suppress it.
Called from: [1] /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/CMakeLists.txt
In file included from /home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/ggml-cuda.cu:5:
/home/lys/Downloads/whisper-rs/target/debug/build/whisper-rs-sys-381cc0649ccf2dc6/out/whisper.cpp/ggml-cuda/common.cuh:3:10: fatal error: 'ggml.h' file not found
#include "ggml.h"
^~~~~~~~
1 error generated when compiling for gfx906.
make[2]: *** [CMakeFiles/ggml-rocm.dir/build.make:79: CMakeFiles/ggml-rocm.dir/ggml-cuda.cu.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/ggml-rocm.dir/all] Error 2
make: *** [Makefile:139: all] Error 2
thread 'main' panicked at /home/lys/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5:
command did not execute successfully, got: exit status: 2
build script failed, must exit now
Two things that stand out as weird for me:
gfx906
when my GPU is gfx1100
; it should only build for gfx1100 and hostI'll be going to sleep so I won't be able to test things for a bit.
I honestly have no clue with any of this. Besides maybe a search path for clang being missing (although CMake should provide that, not to mention we don't really have control over the arguments there) I can't think of why it wouldn't be searching for it properly. As for the target GPU I have no experience with ROCm at all so I don't even know where to start to set target GPUs. Digging through the upstream CMakeLists.txt doesn't show much of help either, just ROCm libs and nothing specifically related to any target GPU or search paths.
Well, updating whisper.cpp causes all of these: https://github.com/tazz4843/whisper-rs/issues/135#issuecomment-2054212021, meaning I can't build even with hipblas
off
As for how to set the target GPU architecture, the AMDGPU_TARGETS
cmake setting works for that (I believe it's semicolon separated)
Anyways, I patched out those issues in the comment I linked, and it works fine with CPU now even on the updated whisper.cpp.
As for ROCm builds, it's still giving me that ggml.h
missing error, but I've been able to replicate it in sort of a "minimum configuration".
If I try to build whisper.cpp
with cmake (cd build && cmake -GNinja -DCMAKE_C_COMPILER=/opt/rocm/llvm/bin/clang -DCMAKE_CXX_COMPILER=/opt/rocm/llvm/bin/clang++ .. && ninja
) it also causes the issue, so I'm gonna go report that upstream and see if I can't get more info there.
Okay so on the latest commit of whisper.cpp
the build errors are no longer an issue as far as I can tell, however trying to run the example audio_transcription
is still an issue (after hacking it to work with the other changes)
It works fine with CPU, but with GPU I get the following chunk of error:
whisper_init_from_file_with_params_no_state: loading model from '/home/lys/Programming/vocalization/ggml-medium.en.bin'
whisper_model_load: loading model
whisper_model_load: n_vocab = 51864
whisper_model_load: n_audio_ctx = 1500
whisper_model_load: n_audio_state = 1024
whisper_model_load: n_audio_head = 16
whisper_model_load: n_audio_layer = 24
whisper_model_load: n_text_ctx = 448
whisper_model_load: n_text_state = 1024
whisper_model_load: n_text_head = 16
whisper_model_load: n_text_layer = 24
whisper_model_load: n_mels = 80
whisper_model_load: ftype = 1
whisper_model_load: qntvr = 0
whisper_model_load: type = 4 (medium)
whisper_model_load: adding 1607 extra tokens
whisper_model_load: n_langs = 99
whisper_backend_init: using CUDA backend
ggml_cuda_init: GGML_CUDA_FORCE_MMQ: no
ggml_cuda_init: CUDA_USE_TENSOR_CORES: yes
ggml_cuda_init: found 1 ROCm devices:
Device 0: AMD Radeon RX 7900 XTX, compute capability 11.0, VMM: no
whisper_model_load: ROCm0 total size = 1533.14 MB
whisper_model_load: model size = 1533.14 MB
whisper_backend_init: using CUDA backend
whisper_init_state: kv self size = 132.12 MB
whisper_init_state: kv cross size = 147.46 MB
whisper_init_state: compute buffer (conv) = 28.68 MB
whisper_init_state: compute buffer (encode) = 594.22 MB
whisper_init_state: compute buffer (cross) = 7.85 MB
whisper_init_state: compute buffer (decode) = 138.87 MB
ggml_cuda_compute_forward: IM2COL failed
CUDA error: shared object initialization failed
current device: 0, in function ggml_cuda_compute_forward at /tmp/whisper-rs/target/debug/build/whisper-rs-sys-c66956f124b8d2e9/out/whisper.cpp/ggml-cuda.cu:2304
err
GGML_ASSERT: /tmp/whisper-rs/target/debug/build/whisper-rs-sys-c66956f124b8d2e9/out/whisper.cpp/ggml-cuda.cu:60: !"CUDA error"
ptrace: Operation not permitted.
No stack.
The program is not being run.
And this error happens with the whisper.cpp
main
example
However!
When using CC
/CXX
=hipcc
instead of -DCMAKE_C_COMPILER
/-DCMAKE_CXX_COMPILER
, it actually just works for the whisper.cpp
main
example, so... could we try that?
Edit: This was only relatively recently added(?) in https://github.com/ggerganov/whisper.cpp/pull/2102
Edit2: So setting CMAKE_C_COMPILER
and the CXX
equivalent to /opt/rocm/bin/hipcc
works, and I get working output! (after fixing the audio transcription example)
whisper_init_from_file_with_params_no_state: loading model from '/home/lys/Programming/vocalization/ggml-medium.en.bin'
whisper_model_load: loading model
whisper_model_load: n_vocab = 51864
whisper_model_load: n_audio_ctx = 1500
whisper_model_load: n_audio_state = 1024
whisper_model_load: n_audio_head = 16
whisper_model_load: n_audio_layer = 24
whisper_model_load: n_text_ctx = 448
whisper_model_load: n_text_state = 1024
whisper_model_load: n_text_head = 16
whisper_model_load: n_text_layer = 24
whisper_model_load: n_mels = 80
whisper_model_load: ftype = 1
whisper_model_load: qntvr = 0
whisper_model_load: type = 4 (medium)
whisper_model_load: adding 1607 extra tokens
whisper_model_load: n_langs = 99
whisper_backend_init: using CUDA backend
ggml_cuda_init: GGML_CUDA_FORCE_MMQ: no
ggml_cuda_init: CUDA_USE_TENSOR_CORES: yes
ggml_cuda_init: found 1 ROCm devices:
Device 0: AMD Radeon RX 7900 XTX, compute capability 11.0, VMM: no
whisper_model_load: ROCm0 total size = 1533.14 MB
whisper_model_load: model size = 1533.14 MB
whisper_backend_init: using CUDA backend
whisper_init_state: kv self size = 132.12 MB
whisper_init_state: kv cross size = 147.46 MB
whisper_init_state: compute buffer (conv) = 28.68 MB
whisper_init_state: compute buffer (encode) = 594.22 MB
whisper_init_state: compute buffer (cross) = 7.85 MB
whisper_init_state: compute buffer (decode) = 138.87 MB
[0 - 402]: This is a test recording for whisper to decode.
[402 - 1028]: I'm hoping that it will understand my voice properly even with a small ggml model and
[1028 - 1132]: background audio.
Edit3: Buuut it doesn't work in all cases, strangely.
Edit3: Buuut it doesn't work in all cases, strangely.
Is there any common threads to when it starts failing or is it just random?
It seems to be during model loading when using it as a library in my own proram (via path = '/wherever/it/was'
ing to my hacked-to-work version).
Which is strange, since loading the model clearly works for the example, so... where could the difference be? I'm even using the same model.
If you made any changes to build.rs, it's possible there could be some path-dependent things that break when you switch to building outside of the crate directory, which should be fixed.
The only changes I made aren't path related; adding the CC
and CXX
envs to the cmake config and also an optional AMDGPU_TARGETS
define. And then fixing the few errors in the library that cropped up due to pushing the whisper.cpp version forward.
Anyways, I can say that right now it... kinda just works? I think the AMDGPU_TARGETS is required for hipblas to work properly, not 100% sure though.
E: For my project I just have to figure out how to make it able to know about past speech, but that's for another time, I'm just glad it works right now :>
(my project is making a sttts
/speech to text to speech program for myself, so I want it to be able to properly transcribe as-live speech (feeding it ~2500ms of audio every cycle, I think; not actually sure because I'm not measuring time)
Someone else beat me to it, #154 might fix it for you and if it does I can merge that
I'll give it a shot once I'm able, thanks for letting me know :3
Yep, works fine!
Closed by #154 then :3
Since
whisper.cpp
supports ROCm/hipblas, and I plan to use this on an AMD GPU, I'd like to see this project support it too.WHISPER_HIPBLAS=1
makeswhisper.cpp
build with HIPBLAS. It has the following (relevant) build info, which should make the-sys
crate's ability to support it easier to make.I can help with any testing necessary, just give me a commit or a patch to test if you can't, and I'll do it :3