GithubHelp home page GithubHelp logo

Windows build about whisper.cpp HOT 32 CLOSED

ggerganov avatar ggerganov commented on May 16, 2024
Windows build

from whisper.cpp.

Comments (32)

minhngoc25a avatar minhngoc25a commented on May 16, 2024 4

This project has support for the MSVC compiler, so you are able to compile it with Visual Studio. You should use the 2017-2022 versions to ensure compatibility. The "Desktop development with C++" should provide most of the stuff we need to compile.

Launch Developer Command Prompt for whatever version of your VS, then use cmake to build a VS project. In the root directory of the repo, execute this command:

cmake -S . -B ./build

This will tell cmake to take the current directory as a source and generate a VS project inside the build folder. Then, open the solution and Build Solution to build a binary file.

Screenshots

image
image

from whisper.cpp.

ggerganov avatar ggerganov commented on May 16, 2024 2

We now have automated Window builds + produced binaries + instructions for cross-compiling from Linux to Windows using MinGW. The README is updated with appropriate links. I think we can finally close this issue. Thanks to everyone that helped!

from whisper.cpp.

trholding avatar trholding commented on May 16, 2024 1

Here is my recommendation, for x86 windows and multiple targets at once in a single binary format with zero to minimal changes: https://github.com/jart/cosmopolitan

For a demo of what is possible with this: https://redbean.dev/

Info here:

https://justine.lol/cosmopolitan/
https://justine.lol/ape.html

I have used it for small internal projects. And works fine. Basically this is how it works:

Here's how simple it is to get started:

gcc -g -O -static -fno-pie -no-pie -mno-red-zone -nostdlib -nostdinc -o hello.com hello.c \
  -Wl,--oformat=binary -Wl,--gc-sections -Wl,-z,max-page-size=0x1000 -fuse-ld=bfd -gdwarf-4 \
  -Wl,-T,[ape.lds](https://justine.lol/cosmopolitan/ape.lds) -include [cosmopolitan.h](https://justine.lol/cosmopolitan/cosmopolitan.h) [crt.o](https://justine.lol/cosmopolitan/crt.o) [ape.o](https://justine.lol/cosmopolitan/ape.o) [cosmopolitan.a](https://justine.lol/cosmopolitan/cosmopolitan.a)
In the above one-liner, we've basically reconfigured the stock compiler on Linux so it outputs binaries that'll run on MacOS, Windows, FreeBSD, OpenBSD, and NetBSD too. They also boot from the BIOS. Please note this is intended for people who don't care about desktop GUIs, and just want stdio and sockets without devops toil.

Doesn't work if you use libc functions that are not implemented, most are. If you get issues, this is your safe way to mitigate missing headers etc: https://github.com/fabriziobertocci/cosmo-include

Here are more resources to get you started:

https://github.com/shmup/awesome-cosmopolitan

Wish you good fun! I'm sure you'll love it.

Oh by the way. If you have real issues: https://github.com/jart/cosmopolitan/issues the crew is really cool and made up wizards / ex googlers, helpful - they respond quick, try to resolve issues soon.

Cheers

from whisper.cpp.

ggerganov avatar ggerganov commented on May 16, 2024 1

Thanks for the ideas - cosmopolitan sounds like an interesting option! Will give it a thought

from whisper.cpp.

makao007 avatar makao007 commented on May 16, 2024 1

Hello, I'm using Visual Studio 2022 to compile the whisper.cpp/examples/main project, and this compilation error as shown in the figure below appears. Excuse me, how should I solve and check it? I don't know much about this.

image image

我也遇到同样的问题,这是由于utf-8编码导致的。
用sublime text(或其他文本编辑器) 打开 examples/main/main.cpp
保存为UTF-8 with BOM即可
just save examples/main/main.cpp with "UTF-8 with BOM"

from whisper.cpp.

tamo avatar tamo commented on May 16, 2024 1

image

Replacing "’" with "\u2019" would fix it without a BOM.

-                ::replace_all(txt_bg, "'", "’");
+                ::replace_all(txt_bg, "'", "\u2019");

from whisper.cpp.

soenkecordts avatar soenkecordts commented on May 16, 2024 1

Set the project "main" as startup project

from whisper.cpp.

kevin01881 avatar kevin01881 commented on May 16, 2024

Would love this!! I want to run whisper on my ancient i7-5500U and right now with OpenAI's version on Windows 10, I can only transcribe 100 minutes in 24 hours. ☹️

from whisper.cpp.

trholding avatar trholding commented on May 16, 2024

PS. If you go the cosmopolitan way, you could also think of using redbean to encapsulate it and provide a web ui - would be cool.

from whisper.cpp.

CHERTS avatar CHERTS commented on May 16, 2024

@ggerganov for Windows there is a POSIX threads API for Windows from - pthreads4w
pthreads4w working for VisualStudio projects

I tried compiling ggml.c in VisualStudio 2017 with pthreads4w, but it didn't work for me :(

from whisper.cpp.

CHERTS avatar CHERTS commented on May 16, 2024

Hi, i created pull request for adding windows support with build in Visual Studio 2022

@ggerganov please, see my pull request, thank's

from whisper.cpp.

john0909 avatar john0909 commented on May 16, 2024

This project has support for the MSVC compiler, so you are able to compile it with Visual Studio. You should use the 2017-2022 versions to ensure compatibility. The "Desktop development with C++" should provide most of the stuff we need to compile.

Launch Developer Command Prompt for whatever version of your VS, then use cmake to build a VS project. In the root directory of the repo, execute this command:

cmake -S . -B ./build

This will tell cmake to take the current directory as a source and generate a VS project inside the build folder. Then, open the solution and Build Solution to build a binary file.

Screenshots

image image

it seems not support VS2017, when I build this with VS2017, many errors display. but It can build succeed on VS2022,Thanks! But when running it, I had this error: Assertion failed:rc==0,file ****\ggml.c,line 6522, I checked the ggml.c,found it failed when create multi thread. any one had the same issue and any idea that can fix it?

from whisper.cpp.

john0909 avatar john0909 commented on May 16, 2024

Has anyone encountered this problem:
image

from whisper.cpp.

chidiwilliams avatar chidiwilliams commented on May 16, 2024

This project has support for the MSVC compiler, so you are able to compile it with Visual Studio. You should use the 2017-2022 versions to ensure compatibility. The "Desktop development with C++" should provide most of the stuff we need to compile.

Launch Developer Command Prompt for whatever version of your VS, then use cmake to build a VS project. In the root directory of the repo, execute this command:

cmake -S . -B ./build

This will tell cmake to take the current directory as a source and generate a VS project inside the build folder. Then, open the solution and Build Solution to build a binary file.

Screenshots

image image

Trying to get this working with Visual Studio 2022 on Windows as well, but I seem to be stuck on this error when building the solution:

image

Do you have any possible pointers? I'm not very familiar with building C on Windows.

from whisper.cpp.

ChristopherFritz avatar ChristopherFritz commented on May 16, 2024

Do you have any possible pointers? I'm not very familiar with building C on Windows.

Disclaimer: I'm in the same boat as you being unfamiliar with this build process. I don't know what I'm doing with it.

I found that if I open the main.vcxproj file that Visual Studio 2022 created when I initially opened the whisper.cpp folder in the Visual Studio, there are instances of m.lib in there.

I did a find and replace to remove each m.lib (and its semi-colon), and then I was able to get Visual Studio to build whisper.cpp. (I don't know if Visual Studio auto-reloads changes to this file, so I closed it before editing the file.)

I do get an error trying to run an audio file through whisper.cpp after compiling, but it's the same error I had previously when I managed to hobble together a Windows build previously, so I don't know whether removing references to m.lib from the project file causes this error or not. (The error is Assertion failed: rc == 0. I haven't posted an issue about it because I figured it was due to the way I badly made the build process work previously.)

from whisper.cpp.

minhngoc25a avatar minhngoc25a commented on May 16, 2024

Seems like some commits after the commit that adds MSVC support (#42) broke the compilation. I'm no expert at C++, but you can try to look at the changes or checkout your git to that earlier commit so that you can compile successfully.

from whisper.cpp.

obyrnemj avatar obyrnemj commented on May 16, 2024

I ran into the same issue with Assertion failed: rc == 0.
I was able to get it working by setting the number of threads to 1 .\main.exe audio.wav -t 1
But its quite slow though...took about a minute to transcribe a 20sec clip.

from whisper.cpp.

CHERTS avatar CHERTS commented on May 16, 2024

Hi

I found an error in CMakeLists.txt, the /arch:AVX2 and _CRT_SECURE_NO_WARNINGS options are not set in the MSVC project for the compiler and the __AVX2__ option must also be need added.

Also, there is no FindSDL2.cmake module in CMake for Windows, you can verify this if you download the official installer v3.24.2

from whisper.cpp.

chidiwilliams avatar chidiwilliams commented on May 16, 2024

Is anyone able to build as shared library on Windows? I get the following error when calling from Python:

Current thread 0x0000434c (most recent call first):
  File "C:\Users\willi\Documents\src\buzz\whispercpp_test.py", line 18 in <module>
Windows fatal exception: access violation

Current thread 0x0000434c (most recent call first):
  File "C:\Users\willi\Documents\src\buzz\whispercpp_test.py", line 18 in <module>
Windows fatal exception: access violation

Current thread 0x0000434c (most recent call first):
  File "C:\Users\willi\Documents\src\buzz\whispercpp_test.py", line 18 in <module>
Windows fatal exception: stack overflow

Full description: #9 (comment)

from whisper.cpp.

ggerganov avatar ggerganov commented on May 16, 2024

Hi @chidiwilliams, I'm really bad with Windows and I don't even have a machine to try on, so I won't be able to help with the build. The original idea was to be able to build the project on Windows using CMake and @iboB implemented it a few days ago and it worked, but I guess it broke somewhere along the way.

from whisper.cpp.

CHERTS avatar CHERTS commented on May 16, 2024

@ggerganov hi, this commit is broken.

AVX not working, please revert change!

image

from whisper.cpp.

minhngoc25a avatar minhngoc25a commented on May 16, 2024

@ggerganov hi, this commit is broken.

AVX not working, please revert change!

image

Is it impossible for you to check out an earlier commit?

from whisper.cpp.

CHERTS avatar CHERTS commented on May 16, 2024

Is it impossible for you to check out an earlier commit?

I fixed AVX support in this commit (need adding defenition __AVX2__)

from whisper.cpp.

ggerganov avatar ggerganov commented on May 16, 2024

@CHERTS
This page says that adding the /arch:AVX2 compiler option should already define the preprocessor symbol __AVX2__ - that is why I decided that it is not needed to define it again:

https://learn.microsoft.com/en-us/cpp/build/reference/arch-x64?view=msvc-170

If someone else can confirm that it does not work for them too, then I will add it back, but for now I will assume it is likely something wrong in your environment.

from whisper.cpp.

CHERTS avatar CHERTS commented on May 16, 2024

@ggerganov

I didn't find the /arch:AVX2 option in the generated *.vcxproj files.

I think it's a challenge
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:AVX2")
in CMakeLists.txt doesn't work as it should.

from whisper.cpp.

john0909 avatar john0909 commented on May 16, 2024

with the latest version afte I update, the multi thread's issue is fixed,now I can get this worked on win10 with VS2022, thanks very much for all of you. I think boolemancer's commit fix it.
image

from whisper.cpp.

wxbool avatar wxbool commented on May 16, 2024

Hello, I'm using Visual Studio 2022 to compile the whisper.cpp/examples/main project, and this compilation error as shown in the figure below appears. Excuse me, how should I solve and check it? I don't know much about this.

image
image

from whisper.cpp.

wxbool avatar wxbool commented on May 16, 2024

Hello, I'm using Visual Studio 2022 to compile the whisper.cpp/examples/main project, and this compilation error as shown in the figure below appears. Excuse me, how should I solve and check it? I don't know much about this.
image image

我也遇到同样的问题,这是由于utf-8编码导致的。 用sublime text(或其他文本编辑器) 打开 examples/main/main.cpp 保存为UTF-8 with BOM即可 just save examples/main/main.cpp with "UTF-8 with BOM"

感谢,我也找到这个原因了

from whisper.cpp.

RYucel avatar RYucel commented on May 16, 2024

with the latest version afte I update, the multi thread's issue is fixed,now I can get this worked on win10 with VS2022, thanks very much for all of you. I think boolemancer's commit fix it. image

Is it possible to share main executable? I have no success on run avx2=1. Very slow when compared with GPU

from whisper.cpp.

tamo avatar tamo commented on May 16, 2024

If you want to build windows files on github, you can make a simple rule to build them.

    windows:
        runs-on: windows-latest
        steps:
            - name: Clone
              uses: actions/checkout@v1

            - name: Add msbuild to PATH
              uses: microsoft/setup-msbuild@v1

            - name: CMake
              shell: powershell
              run: cmake -S . -B ./build

            - name: MSBuild
              run: |
                cd ./build
                msbuild INSTALL.vcxproj /t:build

from whisper.cpp.

RYucel avatar RYucel commented on May 16, 2024

I tried VS Studio 2022 for build x64 locally on two windows machine after cmake and I got this error in both. How can I fix this?
image

from whisper.cpp.

ilovefreesw avatar ilovefreesw commented on May 16, 2024

Would be nice if someone can help and provide build instructions for Windows.

I used Git for Windows SDK(https://gitforwindows.org/) that comes with Git Bash which has MingW, make, gcc, and g++.

Used make command to generate the default vanilla build.

image

Running with the tiny model: ./main -f test.wav

image

However, for me this was ~1.2 seconds slower than the provided prebuilt binary.

Building with CLBlast:

In the same git bash, window, have to install this package: https://packages.msys2.org/package/mingw-w64-x86_64-clblast?repo=mingw64

Command to install the package: pacman -S mingw-w64-x86_64-clblast

image

Next, build by running:

make clean
WHISPER_CLBLAST=1 make -j

image

Running on the same example... above here it takes more than 8 seconds.

image

Build success on Windows but the performance is somewhat lower. I don't know why, Maybe my PC is slower or Idk.

from whisper.cpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.