OpenGVLab/DragGAN

Mac 电脑上异常: AssertionError: Torch not compiled with CUDA enabled

chwshuang opened this issue · 1 comments

drag_gan.py 171 行
api.py 171 行
···
File "/Users/abc/DragGAN/drag_gan.py", line 171, in neighbor
points.append(torch.tensor([i, j]).float().cuda())
File "/Users/abc/miniconda3/envs/draggan2/lib/python3.7/site-packages/torch/cuda/init.py", line 221, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled
···

没有CUAD的机器上,代码需要修改为:
167 行
·device = F.device·
171行
···
points.append(torch.tensor([i, j]).float().cuda())
上面的代码修改为下面代码:
points.append(torch.tensor([i, j]).float().to(device))
···

1.打开 draggan.py 搜索 cuda 替换成 cpu
2.使用 python -m draggan.web --device cpu 运行