0

I'd like to disable tensorflow messages such as:

2021-11-09 20:10:12.646426: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1733] Found device 0 with properties: pciBusID: 0000:b3:00.0 name: NVIDIA RTX A6000 computeCapability: 8.6 coreClock: 1.8GHz coreCount: 84 deviceMemorySize: 47.54GiB deviceMemoryBandwidth: 715.34GiB/s 2021-11-09 20:10:12.652244: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1871] Adding visible gpu devices: 0 2021-11-09 20:10:12.652308: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1258] Device interconnect StreamExecutor with strength 1 edge matrix: 2021-11-09 20:10:12.652321: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1264] 0 2021-11-09 20:10:12.652332: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1277] 0: N 2021-11-09 20:10:12.657207: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1418] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 42983 MB memory) -> physical GPU (device: 0, name: NVIDIA RTX A6000, pci bus id: 0000:b3:00.0, compute capability: 8.6)

that appears when I run some lines of code such as:

config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.compat.v1.Session(config=config)

I tried this:

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 

But it doesn't work.

MVMV
  • 37
  • 6
  • have you looked at this https://stackoverflow.com/questions/35911252/disable-tensorflow-debugging-information – smitty_werbenjagermanjensen Nov 09 '21 at 20:45
  • Yes, but none of the solutions in this link solved my problem. I'm still having the same infos getting printed. – MVMV Nov 10 '21 at 14:58
  • This does not show any error or informational message when I tried running this code in my Jupyter notebook with `TF-gpu/ TF-cpu` virtual environment. It may be due to `Tensorflow` not installed properly in your system. Please follow [this](https://stackoverflow.com/a/70850191/14290681) reference to install `Tensorflow` in conda and try executing above code again after that. Let us know if issue still persists. –  Feb 02 '22 at 06:36

1 Answers1

0

I ran into this same problem. The solution for me was to set that environment variable in the shell when I launch Jupyter:

$ TF_CPP_MIN_LOG_LEVEL=3 jupyter notebook

I don't know what the root cause is, but it seems the value set via os.environ doesn't get through to the Tensorflow C++ library when set in a notebook. I suspect Jupyter is loading the underlying library when it starts the notebook server, so the logging level is already set.

Unfortunately, this solution will only work if you run your own notebook server. If you use someone else's I don't know how to solve this other than asking them to restart it with the logging level environment variable set.

vonmoltke
  • 108
  • 9