Skip to content

Commit da2a7d2

Browse files
anandrayclaude
andauthored
fix(whisper): bound version guard to < 4.8 + guard explicit CUDA devices (#1052)
* fix(whisper): bound ctranslate2 version guard + protect explicit CUDA devices Addresses two post-merge nits from kwit75 on #1043: 1. Narrow version guard to (4,7) <= ct2 < (4,8) so the restriction auto-lifts when ctranslate2 4.8+ ships the cuBLAS 12.8.4 fix, rather than trapping 4.8/4.9/5.x indefinitely. 2. Run _check_gpu_compatible() for explicit device='cuda'/'cuda:N' in local mode, not just for auto-detect (device=None). The SIGABRT can occur regardless of how the CUDA device was selected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci: retrigger CI (Windows HuggingFace network flake) --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 08558ce commit da2a7d2

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

packages/ai/src/ai/common/models/audio/whisper.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ def _check_gpu_compatible(cls) -> bool:
8989
# 1. Version guard: ctranslate2 4.7.x + CUDA 12.8 causes a
9090
# tcache_thread_shutdown() SIGABRT during GPU transcription on H200
9191
# (heap corruption in cuBLAS 12.8.4). Exit non-zero to force CPU.
92-
# Remove this guard once ctranslate2 ships a fix.
92+
# Upper bound at 4.8 so the guard lifts automatically once
93+
# ctranslate2 ships a fix (expected in 4.8+).
9394
# 2. StorageView sanity: verify a CUDA StorageView can be created via
9495
# the documented from_array() API (no direct (shape,dtype,device)
9596
# constructor exists in the Python bindings).
@@ -102,7 +103,7 @@ def _check_gpu_compatible(cls) -> bool:
102103
'except (ValueError, AttributeError):\n'
103104
' ct2 = (999, 999)\n'
104105
'cuda = torch.version.cuda or ""\n'
105-
'if ct2 >= (4, 7) and cuda.startswith("12.8"):\n'
106+
'if (4, 7) <= ct2 < (4, 8) and cuda.startswith("12.8"):\n'
106107
' sys.exit(1)\n'
107108
't = torch.zeros(1, dtype=torch.float32, device="cuda")\n'
108109
'sv = ctranslate2.StorageView.from_array(t)\n'
@@ -213,6 +214,15 @@ def load(
213214
device = 'cuda'
214215
else:
215216
device = 'cpu'
217+
elif device != 'cpu' and not WhisperLoader._check_gpu_compatible():
218+
# Explicit cuda / cuda:N requested but probe failed — fall back to CPU
219+
# so the same SIGABRT protection applies regardless of how the caller
220+
# specified the device.
221+
logger.warning(
222+
'ctranslate2 CUDA probe failed for explicit device=%r — Whisper will use CPU instead.',
223+
device,
224+
)
225+
device = 'cpu'
216226

217227
if device == 'cpu':
218228
gpu_index = -1

0 commit comments

Comments
 (0)