Skip to content

Commit dc21604

Browse files
authored
chore(deps): bump whisper.cpp (#5338)
* chore(deps): bump whisper.cpp Signed-off-by: Ettore Di Giacinto <[email protected]> * add libggml-metal Signed-off-by: Ettore Di Giacinto <[email protected]> * Fixups macOS arm64 Signed-off-by: Ettore Di Giacinto <[email protected]> * adjust cublas for whisper.cpp Signed-off-by: Ettore Di Giacinto <[email protected]> --------- Signed-off-by: Ettore Di Giacinto <[email protected]>
1 parent 5433f1a commit dc21604

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

.github/workflows/bump_deps.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- repository: "ggml-org/llama.cpp"
1313
variable: "CPPLLAMA_VERSION"
1414
branch: "master"
15-
- repository: "ggerganov/whisper.cpp"
15+
- repository: "ggml-org/whisper.cpp"
1616
variable: "WHISPER_CPP_VERSION"
1717
branch: "master"
1818
- repository: "PABannier/bark.cpp"

Makefile

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ DETECT_LIBS?=true
99
CPPLLAMA_VERSION?=f05a6d71a0f3dbf0730b56a1abbad41c0f42e63d
1010

1111
# whisper.cpp version
12-
WHISPER_REPO?=https://github.com/ggerganov/whisper.cpp
13-
WHISPER_CPP_VERSION?=6266a9f9e56a5b925e9892acf650f3eb1245814d
12+
WHISPER_REPO?=https://github.com/ggml-org/whisper.cpp
13+
WHISPER_CPP_VERSION?=cb2bd11ee86c6d2a8c8c22ea3043682cbf127bcd
1414

1515
# go-piper version
1616
PIPER_REPO?=https://github.com/mudler/go-piper
@@ -30,8 +30,11 @@ ONNX_OS?=linux
3030

3131
export BUILD_TYPE?=
3232
export STABLE_BUILD_TYPE?=$(BUILD_TYPE)
33-
export CMAKE_ARGS?=
33+
export CMAKE_ARGS?=-DBUILD_SHARED_LIBS=OFF
3434
export BACKEND_LIBS?=
35+
export WHISPER_DIR=$(abspath ./sources/whisper.cpp)
36+
export WHISPER_INCLUDE_PATH=$(WHISPER_DIR)/include:$(WHISPER_DIR)/ggml/include
37+
export WHISPER_LIBRARY_PATH=$(WHISPER_DIR)/build/src/:$(WHISPER_DIR)/build/ggml/src
3538

3639
CGO_LDFLAGS?=
3740
CGO_LDFLAGS_WHISPER?=
@@ -115,6 +118,15 @@ ifeq ($(OS),Darwin)
115118
ifeq ($(BUILD_TYPE),metal)
116119
# -lcblas removed: it seems to always be listed as a duplicate flag.
117120
CGO_LDFLAGS += -framework Accelerate
121+
CGO_LDFLAGS_WHISPER+=-lggml-metal -lggml-blas
122+
CMAKE_ARGS+=-DGGML_METAL=ON
123+
CMAKE_ARGS+=-DGGML_METAL_USE_BF16=ON
124+
CMAKE_ARGS+=-DGGML_METAL_EMBED_LIBRARY=ON
125+
CMAKE_ARGS+=-DWHISPER_BUILD_EXAMPLES=OFF
126+
CMAKE_ARGS+=-DWHISPER_BUILD_TESTS=OFF
127+
CMAKE_ARGS+=-DWHISPER_BUILD_SERVER=OFF
128+
CMAKE_ARGS+=-DGGML_OPENMP=OFF
129+
export WHISPER_LIBRARY_PATH:=$(WHISPER_LIBRARY_PATH):$(WHISPER_DIR)/build/ggml/src/ggml-metal/:$(WHISPER_DIR)/build/ggml/src/ggml-blas
118130
endif
119131
else
120132
CGO_LDFLAGS_WHISPER+=-lgomp
@@ -128,7 +140,9 @@ endif
128140
ifeq ($(BUILD_TYPE),cublas)
129141
CGO_LDFLAGS+=-lcublas -lcudart -L$(CUDA_LIBPATH) -L$(CUDA_LIBPATH)/stubs/ -lcuda
130142
export GGML_CUDA=1
131-
CGO_LDFLAGS_WHISPER+=-lcufft
143+
CMAKE_ARGS+=-DGGML_CUDA=ON
144+
CGO_LDFLAGS_WHISPER+=-lcufft -lggml-cuda
145+
export WHISPER_LIBRARY_PATH:=$(WHISPER_LIBRARY_PATH):$(WHISPER_DIR)/build/ggml/src/ggml-cuda/
132146
endif
133147

134148
ifeq ($(BUILD_TYPE),vulkan)
@@ -137,10 +151,12 @@ endif
137151

138152
ifneq (,$(findstring sycl,$(BUILD_TYPE)))
139153
export GGML_SYCL=1
154+
CMAKE_ARGS+=-DGGML_SYCL=ON
140155
endif
141156

142157
ifeq ($(BUILD_TYPE),sycl_f16)
143158
export GGML_SYCL_F16=1
159+
CMAKE_ARGS+=-DGGML_SYCL_F16=ON
144160
endif
145161

146162
ifeq ($(BUILD_TYPE),hipblas)
@@ -286,8 +302,9 @@ sources/whisper.cpp:
286302
git checkout $(WHISPER_CPP_VERSION) && \
287303
git submodule update --init --recursive --depth 1 --single-branch
288304

289-
sources/whisper.cpp/libwhisper.a: sources/whisper.cpp
290-
cd sources/whisper.cpp && $(MAKE) libwhisper.a libggml.a
305+
sources/whisper.cpp/build/src/libwhisper.a: sources/whisper.cpp
306+
cd sources/whisper.cpp && cmake $(CMAKE_ARGS) . -B ./build
307+
cd sources/whisper.cpp/build && cmake --build . --config Release
291308

292309
get-sources: sources/go-piper sources/stablediffusion-ggml.cpp sources/bark.cpp sources/whisper.cpp backend/cpp/llama/llama.cpp
293310

@@ -754,8 +771,8 @@ ifneq ($(UPX),)
754771
$(UPX) backend-assets/grpc/silero-vad
755772
endif
756773

757-
backend-assets/grpc/whisper: sources/whisper.cpp sources/whisper.cpp/libwhisper.a backend-assets/grpc
758-
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 \
774+
backend-assets/grpc/whisper: sources/whisper.cpp sources/whisper.cpp/build/src/libwhisper.a backend-assets/grpc
775+
CGO_LDFLAGS="$(CGO_LDFLAGS) $(CGO_LDFLAGS_WHISPER)" C_INCLUDE_PATH="${WHISPER_INCLUDE_PATH}" LIBRARY_PATH="${WHISPER_LIBRARY_PATH}" LD_LIBRARY_PATH="${WHISPER_LIBRARY_PATH}" \
759776
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/whisper ./backend/go/transcribe/whisper
760777
ifneq ($(UPX),)
761778
$(UPX) backend-assets/grpc/whisper

backend/go/transcribe/whisper/whisper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (sd *Whisper) AudioTranscription(opts *pb.TranscriptRequest) (pb.Transcript
7474
context.SetTranslate(true)
7575
}
7676

77-
if err := context.Process(data, nil, nil); err != nil {
77+
if err := context.Process(data, nil, nil, nil); err != nil {
7878
return pb.TranscriptResult{}, err
7979
}
8080

0 commit comments

Comments
 (0)