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