From 4fa778b269cbea264aea1478d02762b493eb4d16 Mon Sep 17 00:00:00 2001 From: streamer45 Date: Wed, 23 Oct 2024 15:38:56 -0600 Subject: [PATCH] Upgrade to whisper.cpp v1.7.1 --- Makefile | 4 ++-- build/Dockerfile | 13 +++++++++---- build/build.sh | 4 ++-- build/lint.sh | 4 ++-- build/run_tests.sh | 4 ++-- cmd/transcriber/apis/whisper.cpp/context.go | 2 +- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 6b4f78f..cd6fd25 100644 --- a/Makefile +++ b/Makefile @@ -45,8 +45,8 @@ endif ## CGO dependencies # Whisper.cpp -WHISPER_VERSION ?= "1.6.2" -WHISPER_SHA ?= "da7988072022acc3cfa61b370b3c51baad017f1900c3dc4e68cb276499f66894" +WHISPER_VERSION ?= "1.7.1" +WHISPER_SHA ?= "97f19a32212f2f215e538ee37a16ff547aaebc54817bd8072034e02466ce6d55" WHISPER_MODELS ?= "tiny base small" # Opus OPUS_VERSION ?= "1.4" diff --git a/build/Dockerfile b/build/Dockerfile index aaf47f2..0155d39 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -2,15 +2,15 @@ # A multi stage build, with golang used as a builder # and debian:sid-slim as runner ARG GO_VERSION -FROM --platform=$TARGETPLATFORM debian:bookworm-20240612-slim as base +FROM --platform=$TARGETPLATFORM debian:bookworm-20240612-slim AS base # Setup system dependencies WORKDIR /workdir -# Install TLS certificates +# Install TLS certificates and libgomp # hadolint ignore=DL3008 RUN apt-get update && \ - apt-get install --no-install-recommends -y ca-certificates && \ + apt-get install --no-install-recommends -y ca-certificates libgomp1 && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* @@ -18,7 +18,12 @@ RUN apt-get update && \ RUN groupadd -r calls && useradd -mr -g calls calls ARG GO_VERSION -FROM --platform=$TARGETPLATFORM golang:${GO_VERSION}-bookworm as builder +FROM --platform=$TARGETPLATFORM golang:${GO_VERSION}-bookworm AS builder +# Install patch +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install --no-install-recommends -y patch + ARG TARGETOS ARG TARGETARCH ARG GO_BUILD_PLATFORMS=${TARGETOS}-${TARGETARCH} diff --git a/build/build.sh b/build/build.sh index f067c4f..25efff0 100644 --- a/build/build.sh +++ b/build/build.sh @@ -12,9 +12,9 @@ AZURE_SDK_VERSION=$8 AZURE_SDK_SHA=$9 OPUS_INCLUDE_PATH="/tmp/opus-${OPUS_VERSION}/include" -WHISPER_INCLUDE_PATH="/tmp/whisper.cpp-${WHISPER_VERSION}" +WHISPER_INCLUDE_PATH="/tmp/whisper.cpp-${WHISPER_VERSION}/include:/tmp/whisper.cpp-${WHISPER_VERSION}/ggml/include" OPUS_LIBRARY_PATH="/tmp/opus-${OPUS_VERSION}/.libs" -WHISPER_LIBRARY_PATH=${WHISPER_INCLUDE_PATH} +WHISPER_LIBRARY_PATH="/tmp/whisper.cpp-${WHISPER_VERSION}" ONNX_INCLUDE_PATH="/tmp/onnxruntime-linux-${ONNX_VERSION}/include" ONNX_LIBRARY_PATH="/tmp/onnxruntime-linux-${ONNX_VERSION}/lib" AZURE_SDK_INCLUDE_PATH="/tmp/SpeechSDK-Linux-${AZURE_SDK_VERSION}/include/c_api" diff --git a/build/lint.sh b/build/lint.sh index 326ce75..6dbc16d 100644 --- a/build/lint.sh +++ b/build/lint.sh @@ -11,9 +11,9 @@ AZURE_SDK_VERSION=$7 AZURE_SDK_SHA=$8 OPUS_INCLUDE_PATH="/tmp/opus-${OPUS_VERSION}/include" -WHISPER_INCLUDE_PATH="/tmp/whisper.cpp-${WHISPER_VERSION}" +WHISPER_INCLUDE_PATH="/tmp/whisper.cpp-${WHISPER_VERSION}/include:/tmp/whisper.cpp-${WHISPER_VERSION}/ggml/include" OPUS_LIBRARY_PATH="/tmp/opus-${OPUS_VERSION}/.libs" -WHISPER_LIBRARY_PATH=${WHISPER_INCLUDE_PATH} +WHISPER_LIBRARY_PATH="/tmp/whisper.cpp-${WHISPER_VERSION}" ONNX_INCLUDE_PATH="/tmp/onnxruntime-linux-${ONNX_VERSION}/include" ONNX_LIBRARY_PATH="/tmp/onnxruntime-linux-${ONNX_VERSION}/lib" AZURE_SDK_INCLUDE_PATH="/tmp/SpeechSDK-Linux-${AZURE_SDK_VERSION}/include/c_api" diff --git a/build/run_tests.sh b/build/run_tests.sh index db0fc0a..f43c723 100644 --- a/build/run_tests.sh +++ b/build/run_tests.sh @@ -12,9 +12,9 @@ AZURE_SDK_VERSION=$8 AZURE_SDK_SHA=$9 OPUS_INCLUDE_PATH="/tmp/opus-${OPUS_VERSION}/include" -WHISPER_INCLUDE_PATH="/tmp/whisper.cpp-${WHISPER_VERSION}" +WHISPER_INCLUDE_PATH="/tmp/whisper.cpp-${WHISPER_VERSION}/include:/tmp/whisper.cpp-${WHISPER_VERSION}/ggml/include" OPUS_LIBRARY_PATH="/tmp/opus-${OPUS_VERSION}/.libs" -WHISPER_LIBRARY_PATH=${WHISPER_INCLUDE_PATH} +WHISPER_LIBRARY_PATH="/tmp/whisper.cpp-${WHISPER_VERSION}" ONNX_INCLUDE_PATH="/tmp/onnxruntime-linux-${ONNX_VERSION}/include" ONNX_LIBRARY_PATH="/tmp/onnxruntime-linux-${ONNX_VERSION}/lib" AZURE_SDK_INCLUDE_PATH="/tmp/SpeechSDK-Linux-${AZURE_SDK_VERSION}/include/c_api" diff --git a/cmd/transcriber/apis/whisper.cpp/context.go b/cmd/transcriber/apis/whisper.cpp/context.go index 9f0e17c..fcbe580 100644 --- a/cmd/transcriber/apis/whisper.cpp/context.go +++ b/cmd/transcriber/apis/whisper.cpp/context.go @@ -1,6 +1,6 @@ package whisper -// #cgo linux LDFLAGS: -l:libwhisper.a -lm -lstdc++ +// #cgo linux LDFLAGS: -l:libwhisper.a -lm -lstdc++ -fopenmp // #cgo darwin LDFLAGS: -lwhisper -lstdc++ -framework Accelerate // #include // #include