mirror of
https://github.com/openai/whisper.git
synced 2025-11-26 23:46:09 +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 device is None:
|
||||||
if torch.cuda.is_available():
|
if torch.cuda.is_available():
|
||||||
device = "cuda"
|
device = "cuda"
|
||||||
elif torch.backends.mps.is_available():
|
elif hasattr(torch.backends, "mps") and torch.backends.mps.is_available():
|
||||||
device = "mps"
|
device = "mps"
|
||||||
else:
|
else:
|
||||||
device = "cpu"
|
device = "cpu"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user