TensorFlow 1.0 and StyleGAN - InvalidArgumentError: Cannot assign a device for operation

314 views Asked by At

I am trying to run Style GAN on my laptop with an NVIDIA GeForce GTX 1650 and I am following this tutorial. I am able to generate the .tfrecord files. After that I am trying to run python train.py but I am getting the following errors:

Building TensorFlow graph...

.... some warnings here

tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device for operation G_synthesis_2/lod: {{node G_synthesis_2/lod}} was explicitly assigned to /device:GPU:1 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0, /job:localhost/replica:0/task:0/device:GPU:0 ]. Make sure the device specification refers to a valid device.

.... stack of the errors

During handling of the above exception, another exception occurred:

.... stack of the errors

tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device for operation G_synthesis_2/lod: node G_synthesis_2/lod (defined at C:\Users\Acer\anaconda3\envs\tf\lib\site-packages\tensorflow_core\python\framework\ops.py:1748)  was explicitly assigned to /device:GPU:1 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0, /job:localhost/replica:0/task:0/device:GPU:0 ]. Make sure the device specification refers to a valid device.
         [[G_synthesis_2/lod]]

I use:

  • Windows 10
  • NVIDIA GeForce GTX 1650
  • Python 3.7.9
  • tensorflow-gpu==1.15
  • CUDA 10.1
  • CUDNN 7.65
  • Conda virtual environment.

My Attempts:

  1. Check environment variables of CUDA
  2. Fix DLL errors
  3. Check if GPU is being recognized (yes)
  4. Change CUDA_VISIBLE_DEVICES to 0 and 0,1
  5. Uninstall tensorflow and protobuf (this answer)

Can someone please help with this?

0

There are 0 answers