if not hasattr(torch._C, '_cuda_getDeviceCount'):
raise AssertionError("Torch not compiled with CUDA enabled")
if _cudart is None:
raise AssertionError("libcudart functions unavailable. It looks like you have a broken build?")
出现此类问题,大概率就是Torch版本和CUDA版本不匹配或者没有加上导致的
MODEL.DEVICE cpu
对于第一种情况来说,可以打印出torch.cuda.is_available()看一下,然后可以查看自己的CUDA版本去pytorch官网重新下载匹配的版本
对于第二种情况来说,cpu如果能支持的话,试着把DEVICE改成cpu试一下,大概率没问题