forked from KoljaB/RealtimeVoiceChat
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_complete_dependencies.sh
More file actions
209 lines (174 loc) ยท 6.71 KB
/
Copy pathinstall_complete_dependencies.sh
File metadata and controls
209 lines (174 loc) ยท 6.71 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/bin/bash
# install_complete_dependencies.sh - Complete dependency installation for RealtimeVoiceChat on RunPod
set -e # Exit on any error
echo "๐ Complete RealtimeVoiceChat Dependency Installation for RunPod"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
NC='\033[0m' # No Color
# Configuration
MODELS_DIR="/workspace/models"
ORPHEUS_MODEL_PATH="${MODELS_DIR}/Orpheus-3b-FT-Q8_0.gguf"
ORPHEUS_MODEL_URL="https://huggingface.co/lex-au/Orpheus-3b-FT-Q8_0.gguf/resolve/main/Orpheus-3b-FT-Q8_0.gguf"
echo -e "${BLUE}๐ Installation Plan:${NC}"
echo -e " 1. Update system packages"
echo -e " 2. Install system audio dependencies"
echo -e " 3. Install PyTorch with CUDA support"
echo -e " 4. Install llama-cpp-python with server support"
echo -e " 5. Install all Python dependencies"
echo -e " 6. Download Orpheus model"
echo -e " 7. Verify installation"
echo ""
# Step 1: Update system packages
echo -e "${YELLOW}๐ฆ Step 1: Updating system packages...${NC}"
apt-get update
# Step 2: Install system audio dependencies
echo -e "${YELLOW}๐ Step 2: Installing system audio dependencies...${NC}"
apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
libsndfile1 \
libsndfile1-dev \
libportaudio2 \
portaudio19-dev \
libasound2-dev \
libpulse-dev \
ffmpeg \
git \
curl \
wget
echo -e "${GREEN}โ
System dependencies installed${NC}"
# Step 3: Install PyTorch with CUDA support
echo -e "${YELLOW}๐ฅ Step 3: Installing PyTorch with CUDA 12.1 support...${NC}"
pip install --no-cache-dir \
torch==2.5.1+cu121 \
torchaudio==2.5.1+cu121 \
torchvision==0.20.1+cu121 \
--index-url https://download.pytorch.org/whl/cu121
echo -e "${GREEN}โ
PyTorch with CUDA support installed${NC}"
# Step 4: Install llama-cpp-python with server support and CUDA
echo -e "${YELLOW}๐ฆ Step 4: Installing llama-cpp-python with server support and CUDA...${NC}"
export CMAKE_ARGS="-DLLAMA_CUDA=on"
pip install --no-cache-dir llama-cpp-python[server] --force-reinstall
echo -e "${GREEN}โ
llama-cpp-python[server] with CUDA support installed${NC}"
# Step 5: Install core scientific computing libraries
echo -e "${YELLOW}๐งฎ Step 5: Installing core scientific computing libraries...${NC}"
pip install --no-cache-dir \
numpy \
scipy \
transformers \
huggingface_hub
echo -e "${GREEN}โ
Core scientific libraries installed${NC}"
# Step 6: Install speech processing libraries
echo -e "${YELLOW}๐ค Step 6: Installing speech processing libraries...${NC}"
pip install --no-cache-dir \
realtimestt==0.3.104 \
"realtimetts[kokoro,coqui,orpheus]==0.5.7"
echo -e "${GREEN}โ
Speech processing libraries installed${NC}"
# Step 7: Install web server and utility dependencies
echo -e "${YELLOW}๐ Step 7: Installing web server and utility dependencies...${NC}"
pip install --no-cache-dir \
fastapi \
uvicorn \
python-dotenv \
requests \
openai \
ollama
echo -e "${GREEN}โ
Web server and utility dependencies installed${NC}"
# Step 8: Install compatibility constraints
echo -e "${YELLOW}๐ง Step 8: Installing compatibility constraints...${NC}"
pip install --no-cache-dir "ctranslate2<4.5.0"
echo -e "${GREEN}โ
Compatibility constraints applied${NC}"
# Step 9: Create models directory and download Orpheus model
echo -e "${YELLOW}๐ Step 9: Setting up models directory...${NC}"
mkdir -p "${MODELS_DIR}"
if [ -f "${ORPHEUS_MODEL_PATH}" ]; then
echo -e "${GREEN}โ
Orpheus model already exists at ${ORPHEUS_MODEL_PATH}${NC}"
else
echo -e "${YELLOW}โฌ Downloading Orpheus model (this may take a while)...${NC}"
echo -e "${BLUE}๐ฅ Downloading from: ${ORPHEUS_MODEL_URL}${NC}"
if command -v wget &> /dev/null; then
wget "${ORPHEUS_MODEL_URL}" -O "${ORPHEUS_MODEL_PATH}"
elif command -v curl &> /dev/null; then
curl -L "${ORPHEUS_MODEL_URL}" -o "${ORPHEUS_MODEL_PATH}"
else
echo -e "${RED}โ Neither wget nor curl found. Please install one of them.${NC}"
exit 1
fi
if [ -f "${ORPHEUS_MODEL_PATH}" ]; then
echo -e "${GREEN}โ
Orpheus model downloaded successfully${NC}"
else
echo -e "${RED}โ Failed to download Orpheus model${NC}"
exit 1
fi
fi
# Check model file size (should be around 3GB)
MODEL_SIZE=$(du -h "${ORPHEUS_MODEL_PATH}" | cut -f1)
echo -e "${BLUE}๐ Model size: ${MODEL_SIZE}${NC}"
# Step 10: Verification
echo -e "${YELLOW}๐งช Step 10: Verifying installation...${NC}"
echo -e "${BLUE}Testing core imports...${NC}"
python -c "
import torch
import numpy as np
import scipy
import transformers
import huggingface_hub
print('โ
Core scientific libraries: OK')
"
echo -e "${BLUE}Testing PyTorch CUDA...${NC}"
python -c "
import torch
print(f'โ
PyTorch version: {torch.__version__}')
print(f'โ
CUDA available: {torch.cuda.is_available()}')
if torch.cuda.is_available():
print(f'โ
CUDA device count: {torch.cuda.device_count()}')
print(f'โ
Current CUDA device: {torch.cuda.current_device()}')
"
echo -e "${BLUE}Testing speech libraries...${NC}"
python -c "
try:
from RealtimeSTT import AudioToTextRecorder
print('โ
RealtimeSTT: OK')
except ImportError as e:
print(f'โ RealtimeSTT: {e}')
try:
from RealtimeTTS import CoquiEngine, KokoroEngine, OrpheusEngine
print('โ
RealtimeTTS: OK')
except ImportError as e:
print(f'โ RealtimeTTS: {e}')
"
echo -e "${BLUE}Testing llama-cpp-python server...${NC}"
python -c "
try:
import llama_cpp.server
print('โ
llama-cpp-python server module: OK')
except ImportError as e:
print(f'โ llama-cpp-python server: {e}')
"
echo -e "${BLUE}Testing web server dependencies...${NC}"
python -c "
import fastapi
import uvicorn
import requests
print('โ
Web server dependencies: OK')
"
# Get PyTorch version for summary
TORCH_VERSION=$(python -c "import torch; print(torch.__version__)" 2>/dev/null || echo "unknown")
echo -e "${GREEN}๐ Complete dependency installation finished successfully!${NC}"
echo -e "${BLUE}๐ Installation Summary:${NC}"
echo -e " โข System audio dependencies installed"
echo -e " โข PyTorch ${TORCH_VERSION} with CUDA support"
echo -e " โข llama-cpp-python[server] with CUDA support"
echo -e " โข All scientific computing libraries (numpy, scipy, transformers)"
echo -e " โข Speech processing libraries (RealtimeSTT, RealtimeTTS)"
echo -e " โข Web server dependencies (FastAPI, uvicorn)"
echo -e " โข Orpheus model: ${ORPHEUS_MODEL_PATH} (${MODEL_SIZE})"
echo -e ""
echo -e "${YELLOW}๐ก The application should now start without dependency errors.${NC}"
echo -e "${BLUE}๐ To start the application:${NC}"
echo -e " cd /workspace/RealtimeVoiceChat/code"
echo -e " python server.py"