python - 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]]
我用:
- 视窗 10
- 英伟达 GeForce GTX 1650
- 蟒蛇 3.7.9
tensorflow-gpu==1.15
- CUDA 10.1
- CUDNN 7.65
- Conda 虚拟环境。
我的尝试:
- 检查CUDA的环境变量
- 修复 DLL 错误
- 检查 GPU 是否被识别(是)
- 更改
CUDA_VISIBLE_DEVICES
为0
和0,1
- 卸载 tensorflow 和 protobuf(这个答案)
有人可以帮忙吗?
解决方案
推荐阅读
- azure - WSDL 的 Azure APIM 导入
- java - 线程启动后是否立即识别线程中断?
- typescript - 如何根据 Typescript 文档将可选参数传递给回调?
- c# - C#中的is object和is {}有什么区别
- reporting-services - SSRS:防止报表内容被下推
- python - Python模块无法识别模块变量
- python - Selenium Chromedriver 无法让我在某些网站上保持登录状态
- javascript - 如何将管道分隔的字符串拆分为对象数组
- c# - C# 中的正则表达式
- azure-devops - 我可以安全地将我的私钥保存在公共构建服务器上吗?