diff --git a/.github/workflows/bump_deps.yaml b/.github/workflows/bump_deps.yaml index bd2de83d..e5b1b306 100644 --- a/.github/workflows/bump_deps.yaml +++ b/.github/workflows/bump_deps.yaml @@ -12,7 +12,7 @@ jobs: - repository: "ggml-org/llama.cpp" variable: "CPPLLAMA_VERSION" branch: "master" - - repository: "ggerganov/whisper.cpp" + - repository: "ggml-org/whisper.cpp" variable: "WHISPER_CPP_VERSION" branch: "master" - repository: "PABannier/bark.cpp" diff --git a/Makefile b/Makefile index 30849d8e..8979d6ee 100644 --- a/Makefile +++ b/Makefile @@ -9,8 +9,8 @@ DETECT_LIBS?=true CPPLLAMA_VERSION?=814f795e063c257f33b921eab4073484238a151a # whisper.cpp version -WHISPER_REPO?=https://github.com/ggerganov/whisper.cpp -WHISPER_CPP_VERSION?=6266a9f9e56a5b925e9892acf650f3eb1245814d +WHISPER_REPO?=https://github.com/ggml-org/whisper.cpp +WHISPER_CPP_VERSION?=cb2bd11ee86c6d2a8c8c22ea3043682cbf127bcd # go-piper version PIPER_REPO?=https://github.com/mudler/go-piper @@ -30,8 +30,11 @@ ONNX_OS?=linux export BUILD_TYPE?= export STABLE_BUILD_TYPE?=$(BUILD_TYPE) -export CMAKE_ARGS?= +export CMAKE_ARGS?=-DBUILD_SHARED_LIBS=OFF export BACKEND_LIBS?= +export WHISPER_DIR=$(abspath ./sources/whisper.cpp) +export WHISPER_INCLUDE_PATH=$(WHISPER_DIR)/include:$(WHISPER_DIR)/ggml/include +export WHISPER_LIBRARY_PATH=$(WHISPER_DIR)/build/src/:$(WHISPER_DIR)/build/ggml/src CGO_LDFLAGS?= CGO_LDFLAGS_WHISPER?= @@ -115,6 +118,7 @@ ifeq ($(OS),Darwin) ifeq ($(BUILD_TYPE),metal) # -lcblas removed: it seems to always be listed as a duplicate flag. CGO_LDFLAGS += -framework Accelerate + CMAKE_ARGS+=-DGGML_METAL=ON endif else CGO_LDFLAGS_WHISPER+=-lgomp @@ -128,6 +132,7 @@ endif ifeq ($(BUILD_TYPE),cublas) CGO_LDFLAGS+=-lcublas -lcudart -L$(CUDA_LIBPATH) -L$(CUDA_LIBPATH)/stubs/ -lcuda export GGML_CUDA=1 + CMAKE_ARGS+=-DGGML_CUDA=ON CGO_LDFLAGS_WHISPER+=-lcufft endif @@ -137,10 +142,12 @@ endif ifneq (,$(findstring sycl,$(BUILD_TYPE))) export GGML_SYCL=1 + CMAKE_ARGS+=-DGGML_SYCL=ON endif ifeq ($(BUILD_TYPE),sycl_f16) export GGML_SYCL_F16=1 + CMAKE_ARGS+=-DGGML_SYCL_F16=ON endif ifeq ($(BUILD_TYPE),hipblas) @@ -286,8 +293,9 @@ sources/whisper.cpp: git checkout $(WHISPER_CPP_VERSION) && \ git submodule update --init --recursive --depth 1 --single-branch -sources/whisper.cpp/libwhisper.a: sources/whisper.cpp - cd sources/whisper.cpp && $(MAKE) libwhisper.a libggml.a +sources/whisper.cpp/build/src/libwhisper.a: sources/whisper.cpp + cd sources/whisper.cpp && cmake $(CMAKE_ARGS) . -B ./build + cd sources/whisper.cpp/build && cmake --build . --config Release get-sources: sources/go-piper sources/stablediffusion-ggml.cpp sources/bark.cpp sources/whisper.cpp backend/cpp/llama/llama.cpp @@ -754,8 +762,8 @@ ifneq ($(UPX),) $(UPX) backend-assets/grpc/silero-vad endif -backend-assets/grpc/whisper: sources/whisper.cpp sources/whisper.cpp/libwhisper.a backend-assets/grpc - CGO_LDFLAGS="$(CGO_LDFLAGS) $(CGO_LDFLAGS_WHISPER)" C_INCLUDE_PATH="$(CURDIR)/sources/whisper.cpp/include:$(CURDIR)/sources/whisper.cpp/ggml/include" LIBRARY_PATH=$(CURDIR)/sources/whisper.cpp \ +backend-assets/grpc/whisper: sources/whisper.cpp sources/whisper.cpp/build/src/libwhisper.a backend-assets/grpc + CGO_LDFLAGS="$(CGO_LDFLAGS) $(CGO_LDFLAGS_WHISPER)" C_INCLUDE_PATH="${WHISPER_INCLUDE_PATH}" LIBRARY_PATH="${WHISPER_LIBRARY_PATH}" LD_LIBRARY_PATH="${WHISPER_LIBRARY_PATH}" \ $(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/whisper ./backend/go/transcribe/whisper ifneq ($(UPX),) $(UPX) backend-assets/grpc/whisper diff --git a/backend/go/transcribe/whisper/whisper.go b/backend/go/transcribe/whisper/whisper.go index 63416bb3..5c7ec0cb 100644 --- a/backend/go/transcribe/whisper/whisper.go +++ b/backend/go/transcribe/whisper/whisper.go @@ -74,7 +74,7 @@ func (sd *Whisper) AudioTranscription(opts *pb.TranscriptRequest) (pb.Transcript context.SetTranslate(true) } - if err := context.Process(data, nil, nil); err != nil { + if err := context.Process(data, nil, nil, nil); err != nil { return pb.TranscriptResult{}, err }