I installed the lastest torch
and torchvision
nightly as per online instructions, eager to testdrive M1 GPU support. Testing with mps.is_available()
returns True
(yeah!). But when running YoloX
model, the system crashes with the following error:
ox_files/detector.py", line 321, in _postprocess
nms_out_index = torchvision.ops.nms(
File "/usr/local/Caskroom/miniforge/base/envs/pt/lib/python3.8/site-packages/torchvision/ops/boxes.py", line 40, in nms
_assert_has_ops()
File "/usr/local/Caskroom/miniforge/base/envs/pt/lib/python3.8/site-packages/torchvision/extension.py", line 33, in _assert_has_ops
raise RuntimeError(
2022-05-30 11:07:08 root ERROR: RuntimeError: Couldn't load custom C++ ops. This can happen if your PyTorch and torchvision versions are incompatible, or if you had errors while compiling torchvision from source. For further information on the compatible versions, check https://github.com/pytorch/vision#installation for the compatibility matrix. Please check your PyTorch version with torch.__version__ and your torchvision version with torchvision.__version__ and verify if they are compatible, and if not please reinstall torchvision so that it matches your PyTorch install.
NB: The above code has been CI/CD-tested and runs perfectly on M1 macOS (torch cpu), Intel macOS, Windows and Linux, so it’s not a code error.
My M1 MacBook Air specs:
- macOS 12.3.1
- python 3.8
-
platform()
=macOS-12.3.1-arm64-arm-64bit
torch==1.13.0.dev20220529
torchvision==0.14.0a0+d592925
From the error messages, it seems that either
-
torchvision.ops.nms
is buggy, or - the
torch
andtorchvision
versions are incompatible.
Wonder if any one knows whether it is 1
, in which case I will abort my M1 test until later builds, or 2
? If 2
, how do I get and build a compatible torchvision
version (appreciate some detailed instructions/commands here).