Repository navigation
Expand file tree
/
Copy pathmake.sh
More file actions
executable file
·82 lines (67 loc) · 1.62 KB
/
Copy pathmake.sh
File metadata and controls
executable file
·82 lines (67 loc) · 1.62 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
set -Eeou pipefail
DOCKER_COMPOSE=$(docker compose > /dev/null 2>&1 && echo "docker compose" || echo "docker-compose")
build() {
$DOCKER_COMPOSE build
}
build_whisper_images() {
WHISPER_MODEL="${WHISPER_MODEL:-small.en}"
CUDA_VERSION="${CUDA_VERSION:-12.1.0}"
WHISPER_IMPLEMENTATIONS="${1:-whisper fasterwhisper whispers2t whispercpp}"
for WHISPER_IMPLEMENTATION in $WHISPER_IMPLEMENTATIONS; do
IMAGE_NAME="ghcr.io/crimeisdown/trunk-transcribe:test-${WHISPER_IMPLEMENTATION}-${WHISPER_MODEL}-cuda_${CUDA_VERSION}"
echo "Building ${IMAGE_NAME}"
docker buildx build \
--progress plain \
--platform linux/amd64 \
--build-arg "WHISPER_MODEL=${WHISPER_MODEL}" \
--build-arg "CUDA_VERSION=${CUDA_VERSION}" \
-t "${IMAGE_NAME}" \
-f "docker/Dockerfile.${WHISPER_IMPLEMENTATION}" .
done
}
start() {
if [ ! -f .env ]; then
echo "Missing .env file; copy from .env.example and edit"
exit 1
fi
if [ ! -f config/notifications.json ]; then
echo "Missing config/notifications.json file; copy from config/notifications.json.example and edit"
exit 1
fi
$DOCKER_COMPOSE up -d
}
stop() {
$DOCKER_COMPOSE stop
}
deps() {
uv sync --group whisper
}
lint() {
uv run -- mypy app
uv run -- ruff check app
uv run -- ruff format app --check
}
fmt() {
uv run -- ruff check app --fix
uv run -- ruff format app
uv run -- ruff check tests --fix
uv run -- ruff format tests
}
restart() {
$DOCKER_COMPOSE restart api worker
}
test() {
start
uv run python3 tests/wait_for_api.py
uv run python3 -m pytest $@
}
retest() {
restart
test $@
}
if [ -z "$1" ]; then
echo "Usage: $0 <command>"
exit 1
fi
$1 "${@:2}"