File: whisper.cpp-transcribe

package info (click to toggle)
whisper.cpp 1.8.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 32,228 kB
  • sloc: cpp: 188,765; ansic: 121,729; lisp: 10,221; sh: 4,272; objc: 2,159; ruby: 1,682; python: 1,177; javascript: 594; makefile: 144
file content (38 lines) | stat: -rwxr-xr-x 1,325 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
set -u

# We need a special testbed that tells us where to find models we can use
if [ -z "${MODELS_DIR:-}" ]; then
	echo "Environment variable MODELS_DIR not set, skipping tests."
	exit 77
elif ! [ -d "$MODELS_DIR" ]; then
	echo "Not a directory: $MODELS_DIR" >&2
	exit 1
fi

if [ -z "${MODEL_NAMES:-}" ]; then
	MODEL_NAMES="$(grep -Ev '^(#.*|[[:space:]]*)$' debian/tests/supported-models.non-free)"
fi

at_least_one=0
exitcode=
for model_name in $MODEL_NAMES; do
	model_fullpath="$MODELS_DIR/$model_name"
	if ! [ -f "$model_fullpath" ]; then
		echo "Model $model_fullpath not found, skipping"
		continue
	fi
	at_least_one=1

	echo "Running tests using model: $model_fullpath"

	whisper-cli /usr/share/sounds/debian/samples/en-Wikipedia-Ignore_All_Rules.wav --threads $(nproc) --model "$model_fullpath" || exitcode=1
	whisper-cli --language ar /usr/share/sounds/debian/samples/ar-Wikipedia-Five_Pillars.wav --threads $(nproc) --model "$model_fullpath" || exitcode=1
	whisper-cli --translate --language ar /usr/share/sounds/debian/samples/ar-Wikipedia-Five_Pillars.wav --threads $(nproc) --model "$model_fullpath" || exitcode=1

	echo "Finished running tests using model: $model_fullpath"
done

# If not a single test could be run, treat this as an overall skip
[ "$at_least_one" -gt 0 ] ||  exit 77
exit $exitcode