From 51c785f7c91b8c032a1fa79c0e8f862dea81b860 Mon Sep 17 00:00:00 2001 From: Jong Wook Kim Date: Wed, 18 Jan 2023 14:44:02 -0800 Subject: [PATCH] add another hasattr check for torch.backends.mps --- whisper/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/whisper/__init__.py b/whisper/__init__.py index 080c303..4f45f99 100644 --- a/whisper/__init__.py +++ b/whisper/__init__.py @@ -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"