-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·118 lines (97 loc) · 3.01 KB
/
setup.sh
File metadata and controls
executable file
·118 lines (97 loc) · 3.01 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/env bash
# Cross-platform setup for NVIDIA Parakeet ASR Service
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
OS="$(uname -s)"
USE_CUDA="${USE_CUDA:-0}"
log() { printf "%s\n" "$*"; }
install_system_deps_linux() {
local have_pkg=0
if command -v apt-get >/dev/null 2>&1; then
have_pkg=1
log "Installing Linux dependencies via apt-get..."
sudo apt-get update
sudo apt-get install -y ffmpeg libsndfile1 python3-pip python3-venv
elif command -v dnf >/dev/null 2>&1; then
have_pkg=1
log "Installing Linux dependencies via dnf..."
sudo dnf install -y ffmpeg libsndfile python3-pip python3-virtualenv
elif command -v yum >/dev/null 2>&1; then
have_pkg=1
log "Installing Linux dependencies via yum..."
sudo yum install -y ffmpeg libsndfile python3-pip python3-virtualenv
elif command -v pacman >/dev/null 2>&1; then
have_pkg=1
log "Installing Linux dependencies via pacman..."
sudo pacman -S --noconfirm ffmpeg libsndfile python-pip python-virtualenv
fi
if [ "$have_pkg" -eq 0 ]; then
log "Warning: no supported Linux package manager detected."
log "Install dependencies manually: ffmpeg, libsndfile, python3-venv, pip"
fi
}
install_system_deps_macos() {
if ! command -v brew >/dev/null 2>&1; then
log "Homebrew not found. Install from https://brew.sh and rerun setup."
exit 1
fi
log "Installing macOS dependencies via Homebrew..."
brew update
brew install ffmpeg libsndfile python@3.12
}
install_torch() {
if [ "$OS" = "Linux" ]; then
if [ "$USE_CUDA" = "1" ]; then
log "Installing PyTorch with CUDA 11.8 wheels..."
pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu118
else
log "Installing PyTorch CPU wheels..."
pip install torch torchaudio --index-url https://download.pytorch.org/whl/cpu
fi
else
log "Installing PyTorch wheels for macOS..."
pip install torch torchaudio
fi
}
log "================================"
log "Parakeet ASR Setup"
log "================================"
if ! command -v python3 >/dev/null 2>&1; then
log "python3 is required but was not found."
exit 1
fi
PYTHON_VERSION="$(python3 --version 2>&1 | awk '{print $2}')"
log "OS: $OS"
log "Python: $PYTHON_VERSION"
case "$OS" in
Linux)
install_system_deps_linux
;;
Darwin)
install_system_deps_macos
;;
*)
log "Unsupported OS: $OS"
exit 1
;;
esac
if [ ! -d "venv" ]; then
log "Creating Python virtual environment..."
python3 -m venv venv
fi
# shellcheck disable=SC1091
source venv/bin/activate
log "Upgrading pip..."
pip install --upgrade pip setuptools wheel
install_torch
log "Installing NVIDIA NeMo (ASR)..."
pip install "nemo-toolkit[asr]>=1.20.0"
log "Installing remaining dependencies..."
pip install -r requirements.txt
log ""
log "================================"
log "Setup complete"
log "================================"
log "Start service: ./start-parakeet.sh"
log "Health: curl http://localhost:9001/health"