OpenGVLab / DragGAN

Unofficial Implementation of DragGAN - "Drag Your GAN: Interactive Point-based Manipulation on the Generative Image Manifold" (DragGAN 全功能实现,在线Demo,本地部署试用,代码、模型已全部开源,支持Windows, macOS, Linux)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

chwshuang opened this issue · 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 运行