mirror of
https://github.com/mudler/LocalAI.git
synced 2026-07-13 01:33:36 -04:00
feat(backend): Add Sherpa ONNX backend and Omnilingual ASR Adds a new Go backend wrapping sherpa-onnx via purego (no cgo). Same approach as opus/stablediffusion-ggml/whisper — a thin C shim (csrc/shim.c + shim.h → libsherpa-shim.so) wraps the bits purego can't reach directly: nested struct config writes, result-struct field reads, and the streaming TTS callback trampoline. The Go side uses opaque uintptr handles and purego.NewCallback for the TTS callback. Supports: - VAD via sherpa-onnx's Silero VAD - Offline ASR: Whisper, Paraformer, SenseVoice, Omnilingual CTC - Online/streaming ASR: zipformer transducer with endpoint detection (AudioTranscriptionStream emits delta events during decode) - Offline TTS: VITS (LJS, etc.) - Streaming TTS: sherpa-onnx's callback API → PCM chunks on a channel, prefixed by a streaming WAV header Gallery entries: omnilingual-0.3b-ctc-q8-sherpa (1600-language offline ASR), streaming-zipformer-en-sherpa (low-latency streaming ASR), silero-vad-sherpa, vits-ljs-sherpa. E2E coverage: tests/e2e-backends for offline + streaming ASR, tests/e2e for the full realtime pipeline (VAD + STT + TTS). Assisted-by: claude-opus-4-7-1M [Claude Code] Signed-off-by: Richard Palethorpe <io@richiejp.com>
13 lines
420 B
Bash
Executable File
13 lines
420 B
Bash
Executable File
#!/bin/bash
|
|
# Unit tests for the sherpa-onnx backend. Exercises error-path and
|
|
# dispatch logic via SherpaBackend directly (no gRPC). Integration
|
|
# coverage (gRPC TTS / streaming ASR / realtime pipeline) lives in
|
|
# tests/e2e-backends and tests/e2e and runs against the Docker image.
|
|
set -e
|
|
|
|
CURDIR=$(dirname "$(realpath $0)")
|
|
cd "$CURDIR"
|
|
|
|
PACKAGES=$(go list ./... | grep -v /sources/)
|
|
go test -v -timeout 60s $PACKAGES
|