Spaces:
Runtime error
Runtime error
Fix CUDA runtime error by forcing CPU-only execution
Browse files- Force device="cpu" to avoid CUDA driver version mismatch
- Add error handling with fallback to base model
- Resolves RuntimeError: CUDA driver version is insufficient
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- app/services/asr.py +14 -5
app/services/asr.py
CHANGED
|
@@ -7,11 +7,20 @@ WHISPER_MODEL_SIZE = os.getenv("WHISPER_MODEL_SIZE", "base")
|
|
| 7 |
WHISPER_DEVICE = os.getenv("WHISPER_DEVICE", "cpu")
|
| 8 |
WHISPER_COMPUTE_TYPE = os.getenv("WHISPER_COMPUTE_TYPE", "int8")
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
def transcribe(audio_path: str) -> List[Dict]:
|
| 17 |
"""
|
|
|
|
| 7 |
WHISPER_DEVICE = os.getenv("WHISPER_DEVICE", "cpu")
|
| 8 |
WHISPER_COMPUTE_TYPE = os.getenv("WHISPER_COMPUTE_TYPE", "int8")
|
| 9 |
|
| 10 |
+
try:
|
| 11 |
+
_whisper = WhisperModel(
|
| 12 |
+
WHISPER_MODEL_SIZE,
|
| 13 |
+
device="cpu", # Force CPU to avoid CUDA issues
|
| 14 |
+
compute_type="int8"
|
| 15 |
+
)
|
| 16 |
+
except Exception as e:
|
| 17 |
+
print(f"Error loading Whisper model: {e}")
|
| 18 |
+
# Fallback to base model with explicit CPU settings
|
| 19 |
+
_whisper = WhisperModel(
|
| 20 |
+
"base",
|
| 21 |
+
device="cpu",
|
| 22 |
+
compute_type="int8"
|
| 23 |
+
)
|
| 24 |
|
| 25 |
def transcribe(audio_path: str) -> List[Dict]:
|
| 26 |
"""
|