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
add another hasattr check for torch.backends.mps
  • Loading branch information
jongwook committed Jan 18, 2023
commit 51c785f7c91b8c032a1fa79c0e8f862dea81b860
2 changes: 1 addition & 1 deletion whisper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def load_model(name: str, device: Optional[Union[str, torch.device]] = None, dow
if device is None:
if torch.cuda.is_available():
device = "cuda"
elif torch.backends.mps.is_available():
elif hasattr(torch.backends, "mps") and torch.backends.mps.is_available():
device = "mps"
else:
device = "cpu"
Expand Down