Skip to content

Commit 2ef3f3a

Browse files
authored
Fix MyPy error when Torch without MPS support is installed (#708)
1 parent 0640617 commit 2ef3f3a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

thinc/compat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
has_torch_cuda_gpu = torch.cuda.device_count() != 0
3535
has_torch_mps_gpu = (
3636
hasattr(torch, "has_mps")
37-
and torch.has_mps
38-
and torch.backends.mps.is_available()
37+
and torch.has_mps # type: ignore[attr-defined]
38+
and torch.backends.mps.is_available() # type: ignore[attr-defined]
3939
)
4040
has_torch_gpu = has_torch_cuda_gpu
4141
torch_version = Version(str(torch.__version__))

0 commit comments

Comments
 (0)