【发布时间】:2021-07-04 15:42:17
【问题描述】:
我知道 stackoverflow 上已经有一些类似的问题,但没有一个能解决我的问题。在 python 脚本中,我必须多次训练一个 keras 模型,并且我想通过 GPU 支持来做到这一点。每次我在输出控制台中得到一堆令人不安的行,因为我再也看不到有用的信息了。这是输出的一部分。
2021-04-08 19:43:40.804324: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2021-04-08 19:43:40.804368: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2021-04-08 19:43:40.804409: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-04-08 19:43:40.804418: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165] 0
2021-04-08 19:43:40.804424: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0: N
2021-04-08 19:43:40.804495: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/device:GPU:0 with 1356 MB memory) -> physical GPU (device: 0, name: NVIDIA GeForce MX250, pci bus id: 0000:06:00.0, compute capability: 6.1)
2021-04-08 19:45:27.918402: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:
name: NVIDIA GeForce MX250 major: 6 minor: 1 memoryClockRate(GHz): 1.582
pciBusID: 0000:06:00.0
我尝试了一些我在互联网上找到的方法,包括以下方法,但没有任何效果。
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
import logging
logging.getLogger("tensorflow").setLevel(logging.ERROR)
logging.getLogger("tensorflow").addHandler(logging.NullHandler(logging.ERROR))
欢迎提出任何建议。
关于我的设置:
- python 3.6.8
- keras 2.3.1
- tensorflow 2.0.0
- cudatoolkit 10.0.130
【问题讨论】:
-
我发现 tf 的那些日志行很有用,也许你可以打印一些标记来查看它旁边的值:print("="*80)
-
感谢您的建议,但我希望摆脱这些输出。
标签: python tensorflow keras