From b6e6813a679e2a136efa05aff2cdf54c6da4e0ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danie=CC=88l=20de=20Kok?= Date: Sat, 25 Jun 2022 11:09:29 +0200 Subject: [PATCH] Fix MyPy error when Torch without MPS support is installed --- thinc/compat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/thinc/compat.py b/thinc/compat.py index 75bfe69e6..d04ff97c3 100644 --- a/thinc/compat.py +++ b/thinc/compat.py @@ -34,8 +34,8 @@ has_torch_cuda_gpu = torch.cuda.device_count() != 0 has_torch_mps_gpu = ( hasattr(torch, "has_mps") - and torch.has_mps - and torch.backends.mps.is_available() + and torch.has_mps # type: ignore[attr-defined] + and torch.backends.mps.is_available() # type: ignore[attr-defined] ) has_torch_gpu = has_torch_cuda_gpu torch_version = Version(str(torch.__version__))