【问题标题】:I don't have an Nvidia GPU and want to run a Tensorflow model on the CPU. Why does it keep asking for some CUDA DLL?我没有 Nvidia GPU,想在 CPU 上运行 Tensorflow 模型。为什么它一直要求一些 CUDA DLL?
【发布时间】:2019-12-04 02:01:21
【问题描述】:

我关注了these instructions

具体来说,我想运行从 Github 下载的 Tensorflow 模型。我的电脑上只有一个 Intel GPU,所以我想在我的 CPU 上执行 Tensorflow 模型。如here on GitHub 所述,应该可以通过将 use-gpu 参数设置为 false 来实现。所以我运行这个命令:

python test_model.py model=iphone_orig dped_dir=dped/ test_subset=full iteration=all resolution=orig use_gpu=false

但是,我收到以下错误,最后两行表明 tensorflow 尝试在 GPU 上运行,这是控制台窗口:

C:\Users\username\Downloads\DPED-master\DPED-master>python test_model.py model=iphone_orig dped_dir=dped/ test_subset=full iteration=all resolution=orig use_gpu=false
Traceback (most recent call last):
  File "C:\Users\username\Downloads\WPy64-3720\python-3.7.2.amd64\lib\site-packages\tensorflow\python\platform\self_check.py", line 62, in preload_check
    ctypes.WinDLL(build_info.nvcuda_dll_name)
  File "C:\Users\username\Downloads\WPy64-3720\python-3.7.2.amd64\lib\ctypes\__init__.py", line 356, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] Das angegebene Modul wurde nicht gefunden

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test_model.py", line 5, in <module>
    import tensorflow as tf
  File "C:\Users\username\Downloads\WPy64-3720\python-3.7.2.amd64\lib\site-packages\tensorflow\__init__.py", line 28, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\Users\username\Downloads\WPy64-3720\python-3.7.2.amd64\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\username\Downloads\WPy64-3720\python-3.7.2.amd64\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module>
    self_check.preload_check()
  File "C:\Users\username\Downloads\WPy64-3720\python-3.7.2.amd64\lib\site-packages\tensorflow\python\platform\self_check.py", line 70, in preload_check
    % build_info.nvcuda_dll_name)
ImportError: Could not find 'nvcuda.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Typically it is installed in 'C:\Windows\System32'. If it is not present, ensure that you have a CUDA-capable GPU with the correct driver installed.

你找到相关的test_model.py文件here

我尝试了几次执行,有无 GPU 设置。我能做些什么来解决它?

【问题讨论】:

  • 你是如何在你的系统上安装 tensorflow 的?链接的文章执行以下操作:pip install tensorflow-gpu 明确安装了 TF GPU 请检查此 [年龄](tensorflow.org/install/pip) 或直接执行pip install tensorflow
  • 可能是因为您安装了tensorflow-gpu。尝试安装 tensorflow 的常规版本

标签: python tensorflow gpu cpu


【解决方案1】:

tensorlfow有两个模块:'tensorflow','tensorflow-gpu' 在 cpu 上,您需要使用 pip install tensorflow 或 conda conda install tensorflow 安装 tensorlfow

编辑第二个问题:

如果将 TensorFlow 操作放在 GPU 上,则执行引擎必须具有该操作的 GPU 实现,称为内核。
如果内核不存在,则放置会导致运行时错误。此外,如果请求的 GPU 设备不存在,则会引发运行时错误。
最好的处理方式是,如果请求 GPU 设备导致错误,则允许将操作放在 CPU 上。

一个答案是删除所有 GPU 配置,第二个是软放置,如果如上所述未找到 GPU,请使用 config.allow_soft_placement = True

【讨论】:

  • 谢谢。首先我也安装了“tensorflow”,但它一直给我同样的错误信息。然后我删除了 'tensorflow-gpu',但现在我收到了这个错误: Traceback (most recent call last): File "test_model.py", line 21, in config = tf.ConfigProto(device_count={'GPU' : 0}) if use_gpu == "false" else None AttributeError: module 'tensorflow' has no attribute 'ConfigProto'
  • @doKno.. 检查答案
  • 谢谢!我只需要升级 pip 然后 tensorflow 来解决第二个问题。
猜你喜欢
  • 2019-10-23
  • 1970-01-01
  • 2018-05-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-09-16
  • 1970-01-01
  • 2020-01-20
相关资源
最近更新 更多