mutablelogic / go-whisper

Speech-to-Text in golang
https://pkg.go.dev/github.com/mutablelogic/go-whisper
Apache License 2.0
73 stars 9 forks source link

Error running make all #20

Closed RamiAwar closed 3 months ago

RamiAwar commented 5 months ago

Running make all doesn't work out of the box for me, yields some errors.

Any ideas?

❯ make all
Clean
Cleared directory 'third_party/whisper.cpp'
error: could not lock config file .git/modules/third_party/whisper.cpp/config: No such file or directory
warning: Could not unset core.worktree setting in submodule 'third_party/whisper.cpp'
go: downloading github.com/veandco/go-sdl2 v0.4.29
go: downloading github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230119165033-21c569ba4acc
go: downloading github.com/hashicorp/go-multierror v1.1.1
go: downloading github.com/hashicorp/errwrap v1.1.0
go: downloading github.com/go-audio/wav v1.1.0
go: downloading github.com/go-audio/riff v1.0.0
go: downloading github.com/go-audio/audio v1.0.0
Update submodules
Submodule 'third_party/whisper.cpp' (https://github.com/ggerganov/whisper.cpp) registered for path 'third_party/whisper.cpp'
Cloning into '/Users/rami/code/whisper/go-whisper/third_party/whisper.cpp'...
Submodule path 'third_party/whisper.cpp': checked out '87acd6d629461ff48c3d58a504ea797736d4b070'
Submodule 'bindings/ios' (https://github.com/ggerganov/whisper.spm) registered for path 'third_party/whisper.cpp/bindings/ios'
Cloning into '/Users/rami/code/whisper/go-whisper/third_party/whisper.cpp/bindings/ios'...
Submodule path 'third_party/whisper.cpp/bindings/ios': checked out 'a2085436c2eb796af90956b62bd64731f5e5b823'
Build whisper
I whisper.cpp build info:
I UNAME_S:  Darwin
I UNAME_P:  arm
I UNAME_M:  arm64
I CFLAGS:   -I.              -O3 -DNDEBUG -std=c11   -fPIC -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE -pthread -DGGML_USE_ACCELERATE -DACCELERATE_NEW_LAPACK -DACCELERATE_LAPACK_ILP64 -DGGML_USE_METAL
I CXXFLAGS: -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE -pthread -DGGML_USE_METAL
I LDFLAGS:   -framework Accelerate -framework Foundation -framework Metal -framework MetalKit
I CC:       Apple clang version 15.0.0 (clang-1500.3.9.4)
I CXX:      Apple clang version 15.0.0 (clang-1500.3.9.4)

cc  -I.              -O3 -DNDEBUG -std=c11   -fPIC -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE -pthread -DGGML_USE_ACCELERATE -DACCELERATE_NEW_LAPACK -DACCELERATE_LAPACK_ILP64 -DGGML_USE_METAL   -c ggml.c -o ggml.o
cc  -I.              -O3 -DNDEBUG -std=c11   -fPIC -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE -pthread -DGGML_USE_ACCELERATE -DACCELERATE_NEW_LAPACK -DACCELERATE_LAPACK_ILP64 -DGGML_USE_METAL   -c ggml-alloc.c -o ggml-alloc.o
cc  -I.              -O3 -DNDEBUG -std=c11   -fPIC -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE -pthread -DGGML_USE_ACCELERATE -DACCELERATE_NEW_LAPACK -DACCELERATE_LAPACK_ILP64 -DGGML_USE_METAL   -c ggml-backend.c -o ggml-backend.o
cc  -I.              -O3 -DNDEBUG -std=c11   -fPIC -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE -pthread -DGGML_USE_ACCELERATE -DACCELERATE_NEW_LAPACK -DACCELERATE_LAPACK_ILP64 -DGGML_USE_METAL   -c ggml-quants.c -o ggml-quants.o
c++ -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE -pthread -DGGML_USE_METAL -c whisper.cpp -o whisper.o
cc -I.              -O3 -DNDEBUG -std=c11   -fPIC -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE -pthread -DGGML_USE_ACCELERATE -DACCELERATE_NEW_LAPACK -DACCELERATE_LAPACK_ILP64 -DGGML_USE_METAL -c ggml-metal.m -o ggml-metal.o
ar rcs libwhisper.a ggml.o ggml-alloc.o ggml-backend.o ggml-quants.o whisper.o ggml-metal.o
Mkdir build models
Build cmd stream
# github.com/ggerganov/whisper.cpp/bindings/go
../../../go/pkg/mod/github.com/ggerganov/whisper.cpp/bindings/go@v0.0.0-20230119165033-21c569ba4acc/whisper.go:74:15: could not determine kind of name for C.WHISPER_N_MEL
cgo:
clang errors for preamble:
../../../go/pkg/mod/github.com/ggerganov/whisper.cpp/bindings/go@v0.0.0-20230119165033-21c569ba4acc/whisper.go:42:30: error: incompatible function pointer types assigning to 'whisper_new_segment_callback' (aka 'void (*)(struct whisper_context *, struct whisper_state *, int, void *)') from 'void (struct whisper_context *, int, void *)' [-Wincompatible-function-pointer-types]
        params.new_segment_callback = whisper_new_segment_cb;
                                    ^ ~~~~~~~~~~~~~~~~~~~~~~
../../../go/pkg/mod/github.com/ggerganov/whisper.cpp/bindings/go@v0.0.0-20230119165033-21c569ba4acc/whisper.go:44:32: error: incompatible function pointer types assigning to 'whisper_encoder_begin_callback' (aka 'bool (*)(struct whisper_context *, struct whisper_state *, void *)') from 'bool (struct whisper_context *, void *)' [-Wincompatible-function-pointer-types]
        params.encoder_begin_callback = whisper_encoder_begin_cb;
                                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

make: *** [cmd/stream] Error 1
❯
djthorpe commented 3 months ago

Just closing out this old issue! I've update the go-whisper repository. It currently no longer depends on the bindings in whisper.cpp as they are horribly out-of-date. You could try again now, if you are using CUDA then use:

GGML_CUDA=1 make

or else just make as usual. Please open up a new issue if you're still interested and having some issues.