stutiagrawal Claude commited on
Commit
08c0be3
·
unverified ·
1 Parent(s): 3440aa9

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>

Files changed (1) hide show
  1. 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
- _whisper = WhisperModel(
11
- WHISPER_MODEL_SIZE,
12
- device=WHISPER_DEVICE,
13
- compute_type=WHISPER_COMPUTE_TYPE
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
  """