I just can't get Tensorflow 2.4 to use less verbose logging messages. Basically, I wished to display less info (I) logging messages, or warnings (W) only.
What I have tried so far:
# (module imports...)
import tensorflow as tf
import os
# Source: https://stackoverflow.com/questions/38073432/how-to-suppress-verbose-tensorflow-logging
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
# https://www.tensorflow.org/api_docs/python/tf/autograph/set_verbosity
os.environ["AUTOGRAPH_VERBOSITY"] = "0"
tf.get_logger().setLevel("WARNING")
# (every other code for the model)
My environment:
- NVIDIA Docker container nvidia/cuda:11.2.1-cudnn8-devel-ubuntu18.04 where training is happening
- Tensorflow 2.4.0
- Python 3.8
Actual results:
2021-04-29 00:34:22.218556: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
2021-04-29 00:34:22.218650: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublas.so.11
2021-04-29 00:34:22.218683: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublasLt.so.11
2021-04-29 00:34:22.218714: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcufft.so.10
2021-04-29 00:34:22.218746: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcurand.so.10
2021-04-29 00:34:22.218777: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusolver.so.10
2021-04-29 00:34:22.218809: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusparse.so.11
2021-04-29 00:34:22.218841: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.8
2021-04-29 00:34:22.222104: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-04-29 00:34:22.222182: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.11.0
2021-04-29 00:34:22.906654: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-04-29 00:34:22.906697: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267] 0
2021-04-29 00:34:22.906707: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0: N
Expected results:
Anything less verbose.
Any setting resulting in less logging messages.
Ideal solution: only warning level logging messages.