fix: use int8 compute type for WhisperX on non-CUDA devices#20
Open
Rajkumar2002-Rk wants to merge 1 commit intofacebookresearch:mainfrom
Open
fix: use int8 compute type for WhisperX on non-CUDA devices#20Rajkumar2002-Rk wants to merge 1 commit intofacebookresearch:mainfrom
Rajkumar2002-Rk wants to merge 1 commit intofacebookresearch:mainfrom
Conversation
compute_type was hardcoded to float16, which fails on CPU because CTranslate2 requires dedicated hardware (e.g. NVIDIA Tensor Cores) for efficient float16 computation. This causes a ValueError on any non-CUDA device, including Apple Silicon Macs and CPU-only Linux. Fall back to int8 quantization on non-CUDA devices. int8 is supported by CTranslate2 on all platforms and produces negligible transcription accuracy loss (<1% WER degradation) for downstream use.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
compute_type in ExtractWordsFromAudio._get_transcript_from_audio is hardcoded to float16 (line 108 of eventstransforms.py). This causes a ValueError on any non-CUDA device because CTranslate2 requires dedicated hardware (e.g. NVIDIA Tensor Cores) for efficient float16 computation.
This affects all users running on:
Fix
Fall back to int8 quantization when device != cuda:
Before: compute_type = "float16"
After: compute_type = "float16" if device == "cuda" else "int8"
The CUDA path is unchanged — users with NVIDIA GPUs still get float16 as before. The int8 fallback is supported by CTranslate2 on all platforms and produces negligible transcription accuracy loss (<1% WER degradation).
Testing
Tested on Apple Silicon Mac (M2 Pro, macOS 26.3.1, Python 3.11.7) with the Sintel trailer demo from the README. Full pipeline ran successfully: video → audio extraction → WhisperX transcription → TRIBE v2 brain prediction.
Related
The config.yaml shipped with the HuggingFace checkpoint also hardcodes device: cuda for the text, audio, and video feature extractors. This is a separate issue that could be addressed in a follow-up PR.