essentia icon indicating copy to clipboard operation
essentia copied to clipboard

How to disable Warning and tensorflow logger?

Open Jimmy880 opened this issue 4 years ago • 3 comments

Thanks for your great work. It is very useful. I want to use essential to tag music files. Hence, I want to feed a list of music one after another to the model. However, I keep getting the warning "No network created, or last created network has been deleted..." and the log of Tensorflow. I can not get the prediction of the model while the output is filled by the warning messages and log of Tensorflow. Besides, the warning message may slow down my process. QQ截图20201206145949 The codes are written in python. QQ截图20201206150229 Are there any solutions to disable the warning messages and TensorFlow logger?

Jimmy880 avatar Dec 06 '20 07:12 Jimmy880

You can set it using an environment variable at the top of your script like this:

# quiet tensorflow warnings
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' 

Defaults to 0, so all logs are shown. Set TF_CPP_MIN_LOG_LEVEL to 1 to filter out INFO logs, 2 to additionall filter out WARNING, 3 to additionally filter out ERROR.

jcurtis-cc avatar Dec 10 '20 15:12 jcurtis-cc

You can set it using an environment variable at the top of your script like this:

# quiet tensorflow warnings
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' 

Defaults to 0, so all logs are shown. Set TF_CPP_MIN_LOG_LEVEL to 1 to filter out INFO logs, 2 to additionall filter out WARNING, 3 to additionally filter out ERROR.

Thanks for your reply. I have tried this method before but It didn't work. Besides, the warning about "No network created, or last created network has been deleted..." is the major output when I run my program.

Jimmy880 avatar Dec 14 '20 02:12 Jimmy880

You can deactivate Essentia logging as in #1213 The proposed solution for the TensorFlow logging does work for me. It is important that the TF_CPP_MIN_LOG_LEVEL variable is set before importing TensorFlow. Did you do it this way?

palonso avatar Dec 29 '21 16:12 palonso

Closing due to inactivity. Feel free to re-open if there is any question about the provided solutions.

palonso avatar Oct 10 '22 06:10 palonso