StyleGAN TensorFlow dev with software-emulated CUDA?

I’m fascinated by the recent popular StyleGAN AI-face generation technology ( ). I have a Threadripper 1950x (3.9 ghz, 16 core, 32 thread) box, but no CUDA hardware at present, and for reasons not pertinent to the discussion it’s not a practical option for some time.

While hardware is clearly the ideal solution, for at least initial dev/testing purposes emulation is fine in my case, and that’s flexibility I’d like to have anyways. A perfomance hit of 10-100x is acceptable, somewhat mitigated by this high-end CPU.

I suspect the solution is configuring my Win10 environment and CUDA toolkit such that it finds an emulated GPU:

InvalidArgumentError (see above for traceback): Cannot assign a device for operation Gs/_Run/Gs/latents_in: node Gs/_Run/Gs/latents_in (defined at C:\dev\StyleGAN\dnnlib\tflib\ was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0 ]. Make sure the device specification refers to a valid device. The requested device appears to be a GPU, but CUDA is not enabled.
[[node Gs/_Run/Gs/latents_in (defined at C:\dev\StyleGAN\dnnlib\tflib\ ]]

The answer may be staring me in the face, but I felt this was likely to be a common question due to what appears to be emerging popularity of StyleGAN.


There is no such animal as an emulated GPU for purposes such as the relatively complex software stacks you want to run (tensorflow-gpu linked to CUDA libraries).

The styleGAN code you linked to expects tensorflow-gpu and an actual GPU among other things. If you wanted to run this code without a GPU, the starting point would be to use the tensorflow (not tensorflow-gpu) that doesn’t depend on a GPU. But there would almost certainly be modifications that would have to be made to the project code (e.g. the python code) to get that to work. I don’t have a recipe for that.

Perfect. That answers that question, thank you.

I was unable to find a styleGAN specific forum to post this in, and styleGAN is an Nvidia project, is anyone aware of such a forum? It’s probably a question for that team.

I’m playing with this code too and there are (non-academic) questions I have. Where is the best place to discuss?