By default, TensorFlow 2 prints debugging information in the terminal. It can be useful if we want to know which CUDA libraries was loaded, GPU compute capability, selected device to run computations and other information.
2020-10-20 05:15:23.768388: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
2020-10-20 05:15:25.763107: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library nvcuda.dll
2020-10-20 05:15:27.319262: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1402] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2989 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1050, pci bus id: 0000:01:00.0, compute capability: 6.1)
............
We can disable debugging information by using TF_CPP_MIN_LOG_LEVEL
environment variable. It can be set before importing TensorFlow.
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1'
import tensorflow as tf
Or manually set this environment variable before running Python script.
SET TF_CPP_MIN_LOG_LEVEL=1
python main.py
TF_CPP_MIN_LOG_LEVEL
environment variable supports the following values:
Level | Name | Description |
---|---|---|
0 | DEBUG | All messages are logged (default). |
1 | INFO | INFO messages are not logged. |
2 | WARNING | INFO and WARNING messages are not logged. |
3 | ERROR | INFO, WARNING, and ERROR messages are not logged. |
Leave a Comment
Cancel reply