mirror of
https://github.com/mudler/LocalAI.git
synced 2026-10-10 07:47:29 -04:00
* chore(parakeet-cpp): bump parakeet.cpp to 2de154c Brings in the speaker registry encoder fingerprint, the VAD segment trim and the opt-in word filter, a fix for a per-call thread count that stayed set on the process-wide backend after a Silero VAD pass, and bundle components loaded from memory. Assisted-by: Claude:claude-sonnet-5-5 [Claude Code] * feat(parakeet-cpp): encoder fingerprint for speaker naming, vad_trim and guard_* options Speaker naming. A registered voice now carries the encoder that made it: the embedding family (voicedetect:<arch>:<name>:<dim>) and the sha256 of the weights. The backend reports the family of the loaded speaker model in Status, voice enrollment from speaker_profiles stores it as encoder_family (old entries load without it), and the registry sent to parakeet.cpp is built with parakeet_capi_speaker_registry_add_embedding_fp. The library then refuses a registry of another encoder family and the error names both families; another quantization of the same family only warns. A voice with only a weights hash gets the loaded family when the hashes are equal. Voices without a fingerprint (registered from audio: libvoicedetect cannot report one) keep the file-name rule and are used with a warning. The library cannot mix them with fingerprinted voices in one registry, so a request that has any uses the old registry for all. speaker_strict:true drops them instead. A library without the symbols behaves as before. Transcription. vad_trim (seconds, 0 keeps the whole cuts) goes through the VAD options JSON, so it reaches /v1/vad and the segmenter. The guard_* options guard_min_local_conf, guard_local_radius and guard_drop_punct_only turn on the word filter through parakeet_capi_transcribe_path_json_with, or through the segmenter with vad:true. They are off by default, bad values fail the load, and a library without the symbol fails it with a clear message. The dropped word count is logged at debug level. Assisted-by: Claude:claude-sonnet-5-5 [Claude Code] --------- Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
100 lines
3.9 KiB
Makefile
100 lines
3.9 KiB
Makefile
# parakeet-cpp backend Makefile.
|
|
#
|
|
# Upstream pin lives below as PARAKEET_VERSION?=2de154c622830b62bfcfb92556dbb71bf0263ddd
|
|
# (.github/bump_deps.sh) can find and update it - matches the
|
|
# whisper.cpp / ds4 / vibevoice-cpp convention.
|
|
#
|
|
# Local dev shortcut: if you already have an out-of-tree parakeet.cpp
|
|
# build, you can symlink the .so + header into this directory and skip
|
|
# the clone/cmake steps entirely, e.g.:
|
|
#
|
|
# ln -sf /path/to/parakeet.cpp/build-shared/libparakeet.so .
|
|
# ln -sf /path/to/parakeet.cpp/include/parakeet_capi.h .
|
|
# go build -o parakeet-cpp-grpc .
|
|
#
|
|
# That's what the L0 smoke test uses. The default target below does the
|
|
# proper clone-at-pin + cmake build so CI doesn't need a side-checkout.
|
|
|
|
PARAKEET_VERSION?=2de154c622830b62bfcfb92556dbb71bf0263ddd
|
|
PARAKEET_REPO?=https://github.com/mudler/parakeet.cpp
|
|
|
|
GOCMD?=go
|
|
GO_TAGS?=
|
|
JOBS?=$(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)
|
|
|
|
BUILD_TYPE?=
|
|
NATIVE?=false
|
|
|
|
# Build ggml statically into libparakeet.so (PIC) so the shared lib is
|
|
# self-contained: dlopen needs no libggml*.so alongside it, only system libs
|
|
# (libstdc++/libgomp/libc) that the runtime image already provides.
|
|
CMAKE_ARGS?=-DCMAKE_BUILD_TYPE=Release -DPARAKEET_SHARED=ON -DPARAKEET_BUILD_CLI=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
|
|
|
ifeq ($(NATIVE),false)
|
|
CMAKE_ARGS+=-DGGML_NATIVE=OFF
|
|
endif
|
|
|
|
# parakeet.cpp gates its GGML backends behind PARAKEET_GGML_* options and does
|
|
# set(GGML_CUDA ${PARAKEET_GGML_CUDA} CACHE BOOL "" FORCE), so a bare -DGGML_CUDA=ON
|
|
# is overwritten back to OFF and the build silently falls back to CPU. Forward the
|
|
# PARAKEET_GGML_* options instead. (openblas is not gated, so -DGGML_BLAS passes through.)
|
|
ifeq ($(BUILD_TYPE),cublas)
|
|
# GGML_CUDA_GRAPHS is OFF by ggml default; enabling it gives a small free
|
|
# speedup (~1% measured on GB10, never negative) by capturing/replaying the
|
|
# CUDA graph. Not gated by parakeet.cpp, so it passes straight through to ggml.
|
|
CMAKE_ARGS+=-DPARAKEET_GGML_CUDA=ON -DGGML_CUDA_GRAPHS=ON
|
|
else ifeq ($(BUILD_TYPE),openblas)
|
|
CMAKE_ARGS+=-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
|
|
else ifeq ($(BUILD_TYPE),hipblas)
|
|
CMAKE_ARGS+=-DPARAKEET_GGML_HIP=ON
|
|
else ifeq ($(BUILD_TYPE),vulkan)
|
|
CMAKE_ARGS+=-DPARAKEET_GGML_VULKAN=ON
|
|
else ifeq ($(BUILD_TYPE),metal)
|
|
CMAKE_ARGS+=-DPARAKEET_GGML_METAL=ON
|
|
endif
|
|
|
|
.PHONY: parakeet-cpp-grpc package build clean purge test all
|
|
|
|
all: parakeet-cpp-grpc
|
|
|
|
# Clone the upstream parakeet.cpp source at the pinned commit. Directory
|
|
# acts as the target so make only re-clones when missing. After a
|
|
# PARAKEET_VERSION bump, run 'make purge && make' to refetch.
|
|
sources/parakeet.cpp:
|
|
mkdir -p sources/parakeet.cpp
|
|
cd sources/parakeet.cpp && \
|
|
git init -q && \
|
|
git remote add origin $(PARAKEET_REPO) && \
|
|
git fetch --depth 1 origin $(PARAKEET_VERSION) && \
|
|
git checkout FETCH_HEAD && \
|
|
git submodule update --init --recursive --depth 1 --single-branch
|
|
|
|
# Build the shared lib + header out-of-tree, then stage them next to the
|
|
# Go sources so purego.Dlopen("libparakeet.so") and the cgo-less build
|
|
# both pick them up.
|
|
libparakeet.so: sources/parakeet.cpp
|
|
cmake -B sources/parakeet.cpp/build-shared -S sources/parakeet.cpp $(CMAKE_ARGS)
|
|
cmake --build sources/parakeet.cpp/build-shared --config Release -j$(JOBS)
|
|
cp -fv sources/parakeet.cpp/build-shared/libparakeet.so* ./ 2>/dev/null || true
|
|
cp -fv sources/parakeet.cpp/build-shared/libparakeet.dylib ./ 2>/dev/null || true
|
|
cp -fv sources/parakeet.cpp/include/parakeet_capi.h ./
|
|
|
|
parakeet-cpp-grpc: libparakeet.so main.go goparakeetcpp.go
|
|
CGO_ENABLED=0 $(GOCMD) build -tags "$(GO_TAGS)" -o parakeet-cpp-grpc .
|
|
|
|
package: parakeet-cpp-grpc
|
|
bash package.sh
|
|
|
|
build: package
|
|
|
|
# Test target. Smoke test is gated on PARAKEET_BACKEND_TEST_MODEL +
|
|
# PARAKEET_BACKEND_TEST_WAV; without them the spec auto-skips.
|
|
test:
|
|
LD_LIBRARY_PATH=$(CURDIR):$$LD_LIBRARY_PATH $(GOCMD) test ./... -count=1
|
|
|
|
clean: purge
|
|
rm -rf libparakeet.so* parakeet_capi.h package parakeet-cpp-grpc
|
|
|
|
purge:
|
|
rm -rf sources/parakeet.cpp
|