Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uses MPS (Mac acceleration) by default when available #382

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
hasattr check for torch.backends.mps
  • Loading branch information
jongwook committed Jan 18, 2023
commit 4b77a81c1fa29fcbcf470d16a4fdd7d09cb0fd3a
2 changes: 1 addition & 1 deletion whisper/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def transcribe(
if model.device == torch.device("cpu"):
if torch.cuda.is_available():
warnings.warn("Performing inference on CPU when CUDA is available")
if torch.backends.mps.is_available():
if hasattr(torch.backends, "mps") and torch.backends.mps.is_available():
warnings.warn("Performing inference on CPU when MPS is available")
if dtype == torch.float16:
warnings.warn("FP16 is not supported on CPU; using FP32 instead")
Expand Down