forked from shashikg/WhisperS2T
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_setup.py
More file actions
165 lines (145 loc) · 4.74 KB
/
verify_setup.py
File metadata and controls
165 lines (145 loc) · 4.74 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
#!/usr/bin/env python3
"""
Setup verification script for WhisperS2T
"""
import sys
import os
def check_python_version():
"""Check Python version."""
version = sys.version_info
if version.major == 3 and version.minor >= 10:
print(f"✅ Python {version.major}.{version.minor}.{version.micro}")
return True
else:
print(f"❌ Python {version.major}.{version.minor}.{version.micro} - Need Python 3.10+")
return False
def check_conda_env():
"""Check if we're in a conda environment."""
conda_env = os.environ.get('CONDA_DEFAULT_ENV')
if conda_env:
print(f"✅ Conda environment: {conda_env}")
return True
else:
print("⚠️ Not in a conda environment (optional but recommended)")
return True
def check_cuda():
"""Check CUDA availability."""
try:
import torch
cuda_available = torch.cuda.is_available()
if cuda_available:
device_name = torch.cuda.get_device_name(0)
print(f"✅ CUDA available: {device_name}")
return True
else:
print("❌ CUDA not available - GPU acceleration disabled")
return False
except ImportError:
print("❌ PyTorch not installed")
return False
def check_cudnn():
"""Check CuDNN availability."""
try:
import torch
cudnn_version = torch.backends.cudnn.version()
if cudnn_version:
print(f"✅ CuDNN version: {cudnn_version}")
return True
else:
print("❌ CuDNN not available")
return False
except:
print("❌ CuDNN check failed")
return False
def check_whisper_s2t():
"""Check WhisperS2T installation."""
try:
import whisper_s2t
print("✅ WhisperS2T installed")
return True
except ImportError:
print("❌ WhisperS2T not installed")
return False
def check_pyaudio():
"""Check PyAudio installation."""
try:
import pyaudio
print("✅ PyAudio installed")
return True
except ImportError:
print("❌ PyAudio not installed - microphone recording disabled")
return False
def check_microphones():
"""Check available microphones."""
try:
import pyaudio
audio = pyaudio.PyAudio()
input_count = 0
for i in range(audio.get_device_count()):
if audio.get_device_info_by_index(i).get('maxInputChannels', 0) > 0:
input_count += 1
audio.terminate()
if input_count > 0:
print(f"✅ Found {input_count} microphone(s)")
return True
else:
print("❌ No microphones found")
return False
except:
print("❌ Could not check microphones")
return False
def check_ffmpeg():
"""Check FFmpeg availability."""
import subprocess
try:
result = subprocess.run(['ffmpeg', '-version'],
capture_output=True, text=True, timeout=5)
if result.returncode == 0:
# Extract version from first line
version_line = result.stdout.split('\n')[0]
print(f"✅ FFmpeg available: {version_line}")
return True
else:
print("❌ FFmpeg not found in PATH")
return False
except (subprocess.TimeoutExpired, FileNotFoundError):
print("❌ FFmpeg not found in PATH")
return False
def main():
"""Run all checks."""
print("🔍 WhisperS2T Setup Verification")
print("=" * 40)
checks = [
("Python Version", check_python_version),
("Conda Environment", check_conda_env),
("CUDA GPU", check_cuda),
("CuDNN", check_cudnn),
("FFmpeg", check_ffmpeg),
("WhisperS2T", check_whisper_s2t),
("PyAudio", check_pyaudio),
("Microphones", check_microphones),
]
results = []
for name, check_func in checks:
print(f"\n{name}:")
result = check_func()
results.append(result)
# Summary
print("\n" + "=" * 40)
print("📊 SUMMARY:")
passed = sum(results)
total = len(results)
if passed == total:
print(f"🎉 All checks passed! ({passed}/{total})")
print("\n🚀 Your WhisperS2T setup is ready!")
print("Try: python demo_mic.py --device 1")
elif passed >= total - 1: # Allow 1 failure
print(f"✅ Setup mostly ready ({passed}/{total})")
print("Some optional components missing but core functionality should work.")
else:
print(f"❌ Setup incomplete ({passed}/{total})")
print("Please check the SETUP.md guide for missing components.")
return passed == total
if __name__ == "__main__":
success = main()
sys.exit(0 if success else 1)