Skip to content

Commit

Permalink
Upgrade to whisper.cpp v1.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
streamer45 committed Oct 23, 2024
1 parent fc292b6 commit 1d92eb4
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 10 additions & 5 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@
# 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/*

# Create unprivileged user to run the recorder process
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}
Expand All @@ -37,7 +42,7 @@ ARG AZURE_SDK_SHA
# We first copy just the build directory so that we can properly cache dependencies which can take a while to download.
COPY ./build /src/build
WORKDIR /src
RUN /bin/bash ./build/prepare_deps.sh ${OPUS_VERSION} ${OPUS_SHA} ${WHISPER_VERSION} ${WHISPER_SHA} "${WHISPER_MODELS}" ${ONNX_VERSION} ${TARGETARCH} ${AZURE_SDK_VERSION} ${AZURE_SDK_SHA}
RUN /bin/bash ./build/prepare_deps.sh ${OPUS_VERSION} ${OPUS_SHA} ${WHISPER_VERSION} ${WHISPER_SHA} "${WHISPER_MODELS}" ${ONNX_VERSION} ${TARGETARCH} ${AZURE_SDK_VERSION} ${AZURE_SDK_SHA} "true"

COPY . /src
RUN /bin/bash ./build/build.sh ${OPUS_VERSION} ${OPUS_SHA} ${WHISPER_VERSION} ${WHISPER_SHA} "${WHISPER_MODELS}" ${ONNX_VERSION} ${TARGETARCH} ${AZURE_SDK_VERSION} ${AZURE_SDK_SHA}
Expand Down
4 changes: 2 additions & 2 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions build/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions build/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cmd/transcriber/apis/whisper.cpp/context.go
Original file line number Diff line number Diff line change
@@ -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 <whisper.h>
// #include <stdlib.h>
Expand Down

0 comments on commit 1d92eb4

Please sign in to comment.