From 47737b2e82405cb1e857142a576288b5f27f18b6 Mon Sep 17 00:00:00 2001 From: Eric Tendian Date: Thu, 26 Jan 2023 17:13:31 -0600 Subject: [PATCH 1/2] livestream.sh : run main with model arg instead of default (#453) Actually utilizes the $model var when calling ./main. --- examples/livestream.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/livestream.sh b/examples/livestream.sh index e24d0de..42d0102 100755 --- a/examples/livestream.sh +++ b/examples/livestream.sh @@ -100,7 +100,7 @@ while [ $running -eq 1 ]; do err=$(cat /tmp/whisper-live.err | wc -l) done - ./main -t 8 -m ./models/ggml-base.en.bin -f /tmp/whisper-live.wav --no-timestamps -otxt 2> /tmp/whispererr | tail -n 1 + ./main -t 8 -m ./models/ggml-${model}.bin -f /tmp/whisper-live.wav --no-timestamps -otxt 2> /tmp/whispererr | tail -n 1 while [ $SECONDS -lt $((($i+1)*$step_s)) ]; do sleep 1 From beb9512be34bf2389e276caf4cb0d06ff0d022b7 Mon Sep 17 00:00:00 2001 From: Robin Date: Thu, 26 Jan 2023 15:14:20 -0800 Subject: [PATCH 2/2] go : add WhisperLangAutoDetect method to go binding (#451) --- bindings/go/pkg/whisper/context.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bindings/go/pkg/whisper/context.go b/bindings/go/pkg/whisper/context.go index a4496b8..b26a4b7 100644 --- a/bindings/go/pkg/whisper/context.go +++ b/bindings/go/pkg/whisper/context.go @@ -117,6 +117,17 @@ func (context *context) PrintTimings() { context.model.ctx.Whisper_print_timings() } +// Use mel data at offset_ms to try and auto-detect the spoken language +// Make sure to call whisper_pcm_to_mel() or whisper_set_mel() first. +// Returns the probabilities of all languages. +func (context *context) WhisperLangAutoDetect(offset_ms int, n_threads int) ([]float32, error) { + langProbs, err := context.model.ctx.Whisper_lang_auto_detect(offset_ms, n_threads) + if err != nil { + return nil, err + } + return langProbs, nil +} + // Process new sample data and return any errors func (context *context) Process(data []float32, cb SegmentCallback) error { if context.model.ctx == nil {