PABannier / bark.cpp

Suno AI's Bark model in C/C++ for fast text-to-speech
MIT License
630 stars 48 forks source link

Runtime Error on Windows #148

Closed MichaelZhangBH closed 2 months ago

MichaelZhangBH commented 2 months ago

Built with master branch on Windows 11. Same error w/wo CUDA.

Unhandled exception at 0x00007FFB0C804477 (ggml.dll) in main.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x0000009026403000).

image

jzeiber commented 2 months ago

I have the same issue running a 64 bit binary on Windows 10 compiled with VS2022. AVX and AVX2 are enabled and using CPU backend. The bark and encodec models were converted with the python scripts to f16. No errors output when converting the models or running main.exe, it just crashes at this function call.

PABannier commented 2 months ago

@jzeiber @MichaelZhangBH Hello both! Thanks for opening this issue.

@MichaelZhangBH Could you post the entire traceback?

MichaelZhangBH commented 2 months ago

Hello @PABannier , great to have you look into this. I will put the call stack here.

    ggml.dll!__chkstk() Line 109    Unknown
>   ggml.dll!ggml_allocr_new_from_buffer(ggml_backend_buffer * buffer) Line 304 C
    main.exe!bark_model_load(std::basic_ifstream<char,std::char_traits<char>> & fin, gpt_model & model, int n_gpu_layers, bark_verbosity_level verbosity) Line 882  C++
    main.exe!bark_load_model_from_file(const std::string & fname, bark_model * model, int n_gpu_layers, bark_verbosity_level verbosity) Line 1029   C++
    main.exe!bark_load_model(const std::string & model_path, bark_verbosity_level verbosity) Line 1066  C++
    main.exe!main(int argc, char * * argv) Line 34  C++
    [External Code] 

Also, BTW, is there any plan to upgrade the to some of the more recent commits of ggml.

PABannier commented 2 months ago

@MichaelZhangBH Yes, it is on my todo list. I'll try to do that in the next few days!

progressionnetwork commented 2 months ago

Hello @PABannier can you please upload proper working binary files for Windows to Release?

jzeiber commented 2 months ago

I was able to get it working. The default stack size in Visual Studio is 1MB. I changed it to 100MB, and now bark successfully generates output.

PABannier commented 2 months ago

@jzeiber Thank you for trying! Could you open a PR and add your fix in a CMakeLists.txt file? Using if(MSVC) and increasing the stack size should do the trick.

PABannier commented 2 months ago

Closing as this is fixed with #163