当前位置: 首页 > 知识库问答 >
问题:

在没有GPU的情况下加载张量流时的错误消息

叶冥夜
2023-03-14

当使用tensorflow时,我不想安装Cuda。现在,在用pip安装了当前版本(2.4.1)并运行任何代码后,我得到了一堆错误消息

2021-02-22 18:03:10.286577: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2021-02-22 18:03:10.286603: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2021-02-22 18:03:11.427455: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-02-22 18:03:11.427576: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2021-02-22 18:03:11.427590: W tensorflow/stream_executor/cuda/cuda_driver.cc:326] failed call to cuInit: UNKNOWN ERROR (303)
2021-02-22 18:03:11.427607: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (XXX): /proc/driver/nvidia/version does not exist
2021-02-22 18:03:11.427774: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-02-22 18:03:11.427918: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set

它们由以下三行代码生成

import tensorflow as tf
from tensorflow import keras
model = keras.Sequential()

我知道一个类似问题的答案在不能加载动态库'cudart64_101.dll'在tensorflow仅CPU安装

但是解决方案建议通过设置环境变量来提高调试级别。不过,我确实希望收到有关我的编程不一致的警告。

真的没有办法单独禁用这些消息并使张量流接受我不想使用GPU或没有GPU吗?

共有1个答案

江建明
2023-03-14

您可以使用以下代码来禁用这些信息性的< code>I和警告< code>W消息。

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
 类似资料:
  • 文档说这个库运行在GPU上。如果我功能强大的笔记本电脑没有GPU,我还能运行Deeplearning4J吗?

  • 我刚刚通过nodejs.org上的软件包安装了node和npm,每当我试图搜索或安装npm时,它都会抛出以下错误,除非我执行该命令。我觉得这是一个权限问题?我已经是管理员了。

  • 问题内容: 我正在学习d3。有某些方法可以在d3 js 中加载数据。但是他们似乎都进行了HTTP GET。在我的场景中,我已经在字符串中包含了json数据。如何使用此字符串代替发出另一个http请求?我试图为此寻找文档,但没有找到。 这有效: 现在,如果我有: 如何在d3中使用已计算的“ myjson”并避免对服务器的异步调用?谢谢。 问题答案: 只需将通话替换为 IE浏览器: 更新09/2013

  • 我正在使用Transform创建一个windows安装包,使其成为多实例。我的mst文件更新了某些注册表项组件的产品代码和GUID。这是每台机器安装。现在我无法卸载我的产品,如果: 我的mst文件从其原始位置删除 TransformsSecure策略设置为1 安装程序尝试在原始位置查找mst文件,但无法执行此操作,卸载失败。在这两种情况下,我可以做什么让我的产品卸载? 一些额外信息。我看到我的ms

  • 当我加载一个相当大的文件时,我的Java程序崩溃(在Eclipse中)。 我已经运行了VisualVM,在崩溃之前,我的CPU似乎以20%的使用率达到峰值,堆大小似乎也不太高。崩溃时运行的线程数约为20。 我确实收到错误消息——但不是每次崩溃发生时都收到。我收到的两条错误消息是: [错误太多,中止] 和 #Java运行时环境检测到一个致命错误: # #在pc=0x00007f096d096942、

  • 问题内容: 我正在尝试编写一个执行脚本;但是,如果没有要提交的内容,则git会退出,状态为。部署脚本将其视为不成功,然后退出。我确实想检测 实际 要提交的故障,因此我不能仅仅给Fabric全面忽略故障。如何允许忽略空提交故障,以便部署可以继续进行,但仍然可以捕获实际提交失败时导致的错误? 问题答案: 通过检查git diff?的退出代码来预先捕获此条件。 例如(在shell中): 编辑:根据霍尔格