首页 > 解决方案 > TensorFlow 1.0 和 StyleGAN - InvalidArgumentError:无法分配设备进行操作

问题描述

我正在尝试使用 NVIDIA GeForce GTX 1650 在我的笔记本电脑上运行Style GAN,我正在关注本教程。我能够生成 .tfrecord 文件。之后,我尝试运行python train.py,但出现以下错误:

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]]

我用:

我的尝试:

  1. 检查CUDA的环境变量
  2. 修复 DLL 错误
  3. 检查 GPU 是否被识别(是)
  4. 更改CUDA_VISIBLE_DEVICES00,1
  5. 卸载 tensorflow 和 protobuf(这个答案

有人可以帮忙吗?

标签: pythontensorflowkerasgenerative-adversarial-network

解决方案


推荐阅读