DragGAN
DragGAN copied to clipboard
Is it possible to run DragGan from CPU?
Is it possible to run DragGan from CPU? What configuration would be required to get it to work? Operating system: Windows 10
Thanks!
没有配置GPU环境默认的就是CPU环境,但是CPU是很慢的,建议有条件还是使用GPU吧
It is possible, but you need to load the Generator in the correct way, so you'll most likely have to tinker with the code. For example, to load the Generator to the CPU, you need to do the following:
# Load the Generator as usual
import legacy
import dnnlib
network_pkl = 'path/to/network.pkl' # This can also be a URL
with dnnlib.util.open_url(network_pkl) as f:
G = legacy.load_network_pkl(f)['G_ema'].eval().requires_grad_(False)
# Move to the CPU
import functools
G.forward = functools.partial(G.forward, force_fp32=True)
Then you're good to go. Might have a look to implement this later on, if I have the time. Otherwise, this is basically how you should do it.