即使我成功安装了 torchvision 和 cuda,我也收到了这个错误:我在 VMWare(Ubuntu 18.04)中运行程序。
python3 ./decode/train_dataloader.py --img_data ./datasets/image_fmri --output ./tmp/feat_data
Traceback (most recent call last):
File "./decode/train_dataloader.py", line 26, in <module>
net = torchvision.models.vgg19_bn(pretrained=True).cuda()
File "/home/home/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 260, in cuda
return self._apply(lambda t: t.cuda(device))
File "/home/home/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 187, in _apply
module._apply(fn)
File "/home/home/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 187, in _apply
module._apply(fn)
File "/home/home/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 193, in _apply
param.data = fn(param.data)
File "/home/home/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 260, in <lambda>
return self._apply(lambda t: t.cuda(device))
File "/home/home/.local/lib/python3.6/site-packages/torch/cuda/__init__.py", line 161, in _lazy_init
_check_driver()
File "/home/home/.local/lib/python3.6/site-packages/torch/cuda/__init__.py", line 75, in _check_driver
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled