bark.cpp icon indicating copy to clipboard operation
bark.cpp copied to clipboard

Error in building at step "Building CXX object encodec.cpp/CMakeFiles/encodec.dir/encodec.cpp.o"

Open hakangs opened this issue 1 year ago • 9 comments

Server is Ubuntu with CUDA support:

image

hakangs avatar Nov 26 '24 15:11 hakangs

anyone?

hakangs avatar Nov 29 '24 16:11 hakangs

Hi @hakangs ! I can't reproduce on my machine. Can you tell me the commands you run to build Encodec.cpp ?

PABannier avatar Nov 30 '24 11:11 PABannier

hi @PABannier , here are the commands I run:

  • git clone --recursive https://github.com/PABannier/bark.cpp.git
  • cd bark.cpp
  • git submodule update --init --recursive
  • mkdir build
  • cd build
  • cmake -DGGML_CUBLAS=ON ..
  • cmake --build . --config Release

hakangs avatar Nov 30 '24 11:11 hakangs

if I go into encodec submodule and run following commands, I still get the above error:

  • mkdir build
  • cd build
  • cmake ..
  • cmake --build . --config Release
  • cmake -DGGML_CUBLAS=ON -DBUILD_SHARED_LIBS=Off ..
  • cmake --build . --config Release

hakangs avatar Nov 30 '24 11:11 hakangs

Exactly same behavior and errors at compile. Thanks in advance for efforts & looking at it Hope it helps screenshot6

ClaudeStabile avatar Dec 06 '24 18:12 ClaudeStabile

Hi there. Exact same issue with a Debian 12 system and CUDA.

ali0une@Debian:~/whatever$ git clone --recursive https://github.com/PABannier/bark.cpp
Cloning into 'bark.cpp'...
remote: Enumerating objects: 980, done.
remote: Counting objects: 100% (640/640), done.
remote: Compressing objects: 100% (320/320), done.
remote: Total 980 (delta 439), reused 420 (delta 292), pack-reused 340 (from 1)
Receiving objects: 100% (980/980), 47.99 MiB | 10.85 MiB/s, done.
Resolving deltas: 100% (537/537), done.
Submodule 'encodec.cpp' (https://github.com/PABannier/encodec.cpp) registered for path 'encodec.cpp'
Cloning into '/whatever/bark.cpp/encodec.cpp'...
remote: Enumerating objects: 410, done.        
remote: Counting objects: 100% (176/176), done.        
remote: Compressing objects: 100% (70/70), done.        
remote: Total 410 (delta 145), reused 108 (delta 106), pack-reused 234 (from 1)        
Receiving objects: 100% (410/410), 3.97 MiB | 4.49 MiB/s, done.
Resolving deltas: 100% (252/252), done.
Submodule path 'encodec.cpp': checked out '1cc279db4da979455651fbac1cbd151a2d121609'
Submodule 'ggml' (https://github.com/ggerganov/ggml.git) registered for path 'encodec.cpp/ggml'
Cloning into '/whatever/bark.cpp/encodec.cpp/ggml'...
remote: Enumerating objects: 12595, done.        
remote: Counting objects: 100% (5830/5830), done.        
remote: Compressing objects: 100% (1369/1369), done.        
remote: Total 12595 (delta 4798), reused 4839 (delta 4418), pack-reused 6765 (from 1)        
Receiving objects: 100% (12595/12595), 11.40 MiB | 8.46 MiB/s, done.
Resolving deltas: 100% (8632/8632), done.
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 6 (delta 3), reused 4 (delta 3), pack-reused 0 (from 0)
Unpacking objects: 100% (6/6), 123.48 KiB | 1.99 MiB/s, done.
From https://github.com/ggerganov/ggml
 * branch            c18f9baeea2f3aea1ffc4afa4ad4496e51b7ff8a -> FETCH_HEAD
Submodule path 'encodec.cpp/ggml': checked out 'c18f9baeea2f3aea1ffc4afa4ad4496e51b7ff8a'
Encountered 1 file that should have been a pointer, but wasn't:
	assets/banner.png
ali0une@Debian:~/whatever$ cd bark.cpp
ali0une@Debian:~/whatever/bark.cpp$ mkdir build
ali0une@Debian:~/whatever/bark.cpp$ cd build/
ali0une@Debian:~/whatever/bark.cpp/build$ cmake -DGGML_CUBLAS=ON ..
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- OpenMP found
-- Warning: ccache not found - consider installing it for faster compilation or disable this warning with GGML_CCACHE=OFF
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- x86 detected
-- Configuring done
-- Generating done
-- Build files have been written to: /whatever/bark.cpp/build
ali0une@Debian:~/whatever/bark.cpp/build$ cmake --build . --config Release -j$(nproc)
[ 21%] Building C object encodec.cpp/ggml/src/CMakeFiles/ggml.dir/ggml-alloc.c.o
[ 21%] Building CXX object encodec.cpp/ggml/src/CMakeFiles/ggml.dir/ggml-backend.cpp.o
[ 21%] Building CXX object examples/CMakeFiles/common.dir/common.cpp.o
[ 21%] Building C object encodec.cpp/ggml/src/CMakeFiles/ggml.dir/ggml.c.o
[ 26%] Building C object encodec.cpp/ggml/src/CMakeFiles/ggml.dir/ggml-aarch64.c.o
[ 31%] Building C object encodec.cpp/ggml/src/CMakeFiles/ggml.dir/ggml-quants.c.o
[ 36%] Linking CXX static library libcommon.a
[ 36%] Built target common
[ 42%] Linking CXX static library libggml.a
[ 42%] Built target ggml
[ 47%] Building CXX object encodec.cpp/CMakeFiles/encodec.dir/encodec.cpp.o
[ 52%] Building CXX object encodec.cpp/CMakeFiles/encodec.dir/ops.cpp.o
/whatever/bark.cpp/encodec.cpp/encodec.cpp:146:22: warning: multi-character character constant [-Wmultichar]
  146 |         if (magic != ENCODEC_FILE_MAGIC) {
      |                      ^~~~~~~~~~~~~~~~~~
/whatever/bark.cpp/encodec.cpp/encodec.cpp: In function ‘bool encodec_load_model_weights(std::ifstream&, encodec_model&, int)’:
/whatever/bark.cpp/encodec.cpp/encodec.cpp:215:47: error: too few arguments to function ‘ggml_backend* ggml_backend_cuda_init(int)’
  215 |         model.backend = ggml_backend_cuda_init();
      |                         ~~~~~~~~~~~~~~~~~~~~~~^~
In file included from /whatever/bark.cpp/encodec.cpp/encodec.cpp:7:
/whatever/bark.cpp/encodec.cpp/ggml/src/../include/ggml-cuda.h:23:25: note: declared here
   23 | GGML_API ggml_backend_t ggml_backend_cuda_init(int device);
      |                         ^~~~~~~~~~~~~~~~~~~~~~
gmake[2]: *** [encodec.cpp/CMakeFiles/encodec.dir/build.make:76: encodec.cpp/CMakeFiles/encodec.dir/encodec.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:230: encodec.cpp/CMakeFiles/encodec.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2

Additional system infos :

uname -a
Linux DebianAi 6.12.4-20241209 #1+i SMP PREEMPT_DYNAMIC Mon Dec  9 18:18:13 CET 2024 x86_64 GNU/Linux

LD_LIBRARY_PATH : /usr/lib:/usr/lib64:/usr/local/cuda/lib64
----------------------------
CUDA_HOME : /usr/local/cuda
----------------------------
| NVIDIA-SMI 550.127.08             Driver Version: 550.127.08     CUDA Version: 12.4     |
----------------------------
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Mar_28_02:18:24_PDT_2024
Cuda compilation tools, release 12.4, V12.4.131
Build cuda_12.4.r12.4/compiler.34097967_0
----------------------------
cuda - manual mode
  link best version is /usr/local/cuda-12.6
  link currently points to /usr/local/cuda-12.4
  link cuda is /usr/local/cuda
/usr/local/cuda-12.4 - priority 124
/usr/local/cuda-12.6 - priority 126
----------------------------
	libcudnn_ops.so.9 -> libcudnn_ops.so.9.6.0
	libcudnn_adv_infer.so.8 -> libcudnn_adv_infer.so.8.5.0
	libcudnn.so.9 -> libcudnn.so.9.6.0
	libcudnn_ops_train.so.8 -> libcudnn_ops_train.so.8.5.0
	libcudnn_cnn_train.so.8 -> libcudnn_cnn_train.so.8.5.0
	libcudnn_cnn_infer.so.8 -> libcudnn_cnn_infer.so.8.5.0
	libcudnn_heuristic.so.9 -> libcudnn_heuristic.so.9.6.0
	libcudnn.so.8 -> libcudnn.so.8.5.0
	libcudnn_adv.so.9 -> libcudnn_adv.so.9.6.0
	libcudnn_adv_train.so.8 -> libcudnn_adv_train.so.8.5.0
	libcudnn_graph.so.9 -> libcudnn_graph.so.9.6.0
	libcudnn_engines_runtime_compiled.so.9 -> libcudnn_engines_runtime_compiled.so.9.6.0
	libcudnn_engines_precompiled.so.9 -> libcudnn_engines_precompiled.so.9.6.0
	libcudnn_ops_infer.so.8 -> libcudnn_ops_infer.so.8.5.0
	libcudnn_cnn.so.9 -> libcudnn_cnn.so.9.6.0

ali0une avatar Dec 15 '24 08:12 ali0une

Hello

I did a a little fix, now it compiles sucessfully, should work on latest Debian + latest CUDA drivers as well see : https://github.com/PABannier/bark.cpp/pull/210 Probably more changes are needed but it fixes compile issues You need to change encondec.cpp and bark.cpp code + Check README for CC make compile option i use, a bit different.

Hope this helps

++

ClaudeStabile avatar Dec 15 '24 11:12 ClaudeStabile

it compiles without error, but compilation is a bit tricky as we need to pass two arguments to cmake : cmake -B build -DGGML_CUBLAS=ON -DGGML_CUDA=1 -DGGML_CUBLAS=ON for bark.cpp -DGGML_CUDA=1 for encodec.cpp

But issue now is the /whatever/bark.cpp/build/examples/main/main binary doesn't use GPU, it only uses CPU as far as i can tell.

ali0une avatar Dec 15 '24 14:12 ali0une

I agree, bark.cpp/build/examples/main/main binary doesn't use GPU, it only uses CPU as far as i can tell. I am not sure, why my GPU is not utilized to any extent...

Image

root@thom:~/app/bark.cpp# ./build/examples/main/main -m ./models/bark-small/ggml_weights.bin -p "this is an audio generated by bark.cpp" -t 4

██████╗  █████╗ ██████╗ ██╗  ██╗    ██████╗██████╗ ██████╗ 
██╔══██╗██╔══██╗██╔══██╗██║ ██╔╝   ██╔════╝██╔══██╗██╔══██╗
██████╔╝███████║██████╔╝█████╔╝    ██║     ██████╔╝██████╔╝
██╔══██╗██╔══██║██╔══██╗██╔═██╗    ██║     ██╔═══╝ ██╔═══╝ 
██████╔╝██║  ██║██║  ██║██║  ██╗██╗╚██████╗██║     ██║     
╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝ ╚═════╝╚═╝     ╚═╝     

encodec_load_model_weights: using CPU backend
encodec_load_model_weights: model size = 44.36 MB

bark_tokenize_input: prompt: 'this is an audio generated by bark.cpp'
bark_tokenize_input: number of tokens in prompt = 513, first 8 tokens: 20579 20172 20199 33733 58966 20203 28169 20222 

Generating semantic tokens... 78%

bark_print_statistics:   sample time =    75.15 ms / 600 tokens
bark_print_statistics:  predict time =  5390.09 ms / 8.98 ms per token
bark_print_statistics:    total time =  5476.48 ms

Building process for GPU access; btw yet GPU is not working

Also, I changed two lines manually in the following files.

  1. File: bark.cpp/bark.cpp You also need to modify bark.cpp line 826 model.backend = ggml_backend_cuda_init(); by model.backend = ggml_backend_cuda_init(0);

  2. File: bark.cpp/encodec.cpp/encodec.cpp You also need to modify encodec.cpp line 215 model.backend = ggml_backend_cuda_init(); by model.backend = ggml_backend_cuda_init(0);

After the above changes I built through the following GPU command,

mkdir build
cd build
cmake -DGGML_CUBLAS=ON -DGGML_CUDA=1 -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.8 ..
cmake --build . --config Release

naren200 avatar Feb 10 '25 00:02 naren200