mirror of
https://github.com/openai/whisper.git
synced 2025-11-27 07:48:45 +00:00
add another hasattr check for torch.backends.mps
This commit is contained in:
parent
4b77a81c1f
commit
51c785f7c9
@ -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"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user