0

I want to remove all warnings from pythons tensorflow==2.8 .

I do imports like this

import tensorflow
from tensorflow.keras.models import Sequential

I try the following, but nothing of these methods keep Warnings or Infos out of my results' cell.

modify the option parameters

tensorflow.compat.v1.logging.set_verbosity(tensorflow.compat.v1.logging.ERROR)
tensorflow.get_logger().setLevel('ERROR')
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # 2 is for Info and Warnings, 3 is everything

notebook magic

  • Try to use %%capture at the beginning of a cell
  • Try to use ; at the end of a line

with statements

from IPython.utils import io

    with io.capture_output() as captured:
        #Function to use where output should disappear

from @Usama Aleem

import warnings
warnings.filterwarnings('ignore')

One of the Warnings:

WARNING:absl:Found untraced functions such as lstm_cell_layer_call_fn, lstm_cell_layer_call_and_return_conditional_losses while saving (showing 2 of 2). These functions will not be directly callable after loading.

till Kadabra
  • 478
  • 9
  • 21

1 Answers1

1

you can ignore or hide all the warnings in ipython file by using this code

import warnings
warnings.filterwarnings('ignore')
Usama Aleem
  • 113
  • 7