Created
July 15, 2019 14:56
-
-
Save RodrigoCMoraes/f17094c397e81a87256f1c35086a2bb1 to your computer and use it in GitHub Desktop.
Make tensorflow less verbose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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