Skip to content

Instantly share code, notes, and snippets.

@RodrigoCMoraes
Created July 15, 2019 14:56
Show Gist options
  • Save RodrigoCMoraes/f17094c397e81a87256f1c35086a2bb1 to your computer and use it in GitHub Desktop.
Save RodrigoCMoraes/f17094c397e81a87256f1c35086a2bb1 to your computer and use it in GitHub Desktop.
Make tensorflow less verbose
# source : https://stackoverflow.com/a/54950981/7195250
def tensorflow_shutup():
"""
Make Tensorflow less verbose
"""
try:
# noinspection PyPackageRequirements
import os
from tensorflow import logging
logging.set_verbosity(logging.ERROR)
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
# Monkey patching deprecation utils to shut it up! Maybe good idea to disable this once after upgrade
# noinspection PyUnusedLocal
def deprecated(date, instructions, warn_once=True):
def deprecated_wrapper(func):
return func
return deprecated_wrapper
from tensorflow.python.util import deprecation
deprecation.deprecated = deprecated
except ImportError:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment