Use int8 on pre-Volta GPUs instead of float16 (fixes CUDA on Pascal)#48
Open
Suijiku wants to merge 1 commit into
Open
Use int8 on pre-Volta GPUs instead of float16 (fixes CUDA on Pascal)#48Suijiku wants to merge 1 commit into
Suijiku wants to merge 1 commit into
Conversation
CTranslate2 rejects float16 on pre-Volta NVIDIA GPUs (Pascal/GTX 10xx and older) with 'target device does not support efficient float16 computation', making the CUDA path unusable there even though int8 works (DP4A). Probe the compute capability and fall back to int8 (major < 7), surfacing a progress note; Volta+ keeps float16. On any probe failure we keep float16 so the existing error still surfaces. The model cache key already includes compute_type, so no cache change is needed.
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.
Closes #45.
Summary
transcriber.pyhardcodesfloat16whenever the compute device iscuda:CTranslate2 (faster-whisper's backend) rejects
float16on pre-Volta NVIDIA GPUs(Pascal / GTX 10xx and older), failing transcription with:
This makes the CUDA option unusable on those cards even though
int8works fine on them(Pascal supports DP4A int8). This PR adds a compute-capability check: pre-Volta GPUs
(compute capability major < 7) fall back to
int8and surface a one-line progress note;Volta and newer keep
float16. If the capability probe fails for any reason we keep theexisting
float16behavior so the current error still surfaces rather than being masked.The model cache key already includes
compute_type, so no cache changes are needed.Changes
app/transcription/transcriber.py— replace the one-line ternary with a capability check.Testing
Reproduced on a GTX 1080 (Pascal, compute capability 6.1), Windows 11, CUDA 12.6
PyTorch, faster-whisper 1.2.1 / CTranslate2 4.8.1.
CTranslate2's supported CUDA compute types on this device — note
float16is absent:TranscriptionWorker(device="cuda")before vs after, same machine:python -m pytest tests/ -vgreen, including 4 new tests covering theCPU / Volta+ / pre-Volta / probe-failure branches (torch mocked).
ValueErrorfrom CTranslate2 (not a silent fallback), sothe old CUDA path is genuinely unusable on pre-Volta cards; this PR makes it work.