deep learning - How to suppress verbose Tensorflow logging? -


i'm unittesting tensorflow code nosetests produces such amount of verbose output makes useless.

the following test

import unittest import tensorflow tf  class mytest(unittest.testcase):      def test_creation(self):         self.assertequals(true, false) 

when run nosetests creates huge amount of useless logging:

fail: test_creation (tests.test_tf.mytest) ---------------------------------------------------------------------- traceback (most recent call last):   file "/home/cebrian/git/thesis-nilm/code/deepmodels/tests/test_tf.py", line 10, in test_creation     self.assertequals(true, false) assertionerror: true != false -------------------- >> begin captured logging << -------------------- tensorflow: level 1: registering const (<function _constantshape @ 0x7f4379131c80>) in shape functions. tensorflow: level 1: registering assert (<function no_outputs @ 0x7f43791319b0>) in shape functions. tensorflow: level 1: registering print (<function _printgrad @ 0x7f4378effd70>) in gradient. tensorflow: level 1: registering print (<function unchanged_shape @ 0x7f4379131320>) in shape functions. tensorflow: level 1: registering histogramaccumulatorsummary (none) in gradient. tensorflow: level 1: registering histogramsummary (none) in gradient. tensorflow: level 1: registering imagesummary (none) in gradient. tensorflow: level 1: registering audiosummary (none) in gradient. tensorflow: level 1: registering mergesummary (none) in gradient. tensorflow: level 1: registering scalarsummary (none) in gradient. tensorflow: level 1: registering scalarsummary (<function _scalarshape @ 0x7f4378f042a8>) in shape functions. tensorflow: level 1: registering mergesummary (<function _scalarshape @ 0x7f4378f042a8>) in shape functions. tensorflow: level 1: registering audiosummary (<function _scalarshape @ 0x7f4378f042a8>) in shape functions. tensorflow: level 1: registering imagesummary (<function _scalarshape @ 0x7f4378f042a8>) in shape functions. tensorflow: level 1: registering histogramsummary (<function _scalarshape @ 0x7f4378f042a8>) in shape functions. tensorflow: level 1: registering histogramaccumulatorsummary (<function _scalarshape @ 0x7f4378f042a8>) in shape functions. tensorflow: level 1: registering pack (<function _packshape @ 0x7f4378f047d0>) in shape functions. tensorflow: level 1: registering unpack (<function _unpackshape @ 0x7f4378f048c0>) in shape functions. tensorflow: level 1: registering concat (<function _concatshape @ 0x7f4378f04938>) in shape functions. tensorflow: level 1: registering concatoffset (<function _concatoffsetshape @ 0x7f4378f049b0>) in shape functions.  ...... 

whereas using tensorflow ipython console doesn't seem verbose:

$ ipython python 2.7.11+ (default, apr 17 2016, 14:00:29)  type "copyright", "credits" or "license" more information.  ipython 4.2.0 -- enhanced interactive python. ?         -> introduction , overview of ipython's features. %quickref -> quick reference.      -> python's own system. object?   -> details 'object', use 'object??' details.  in [1]: import tensorflow tf tensorflow/stream_executor/dso_loader.cc:108] opened cuda library libcublas.so locally tensorflow/stream_executor/dso_loader.cc:108] opened cuda library libcudnn.so locally tensorflow/stream_executor/dso_loader.cc:108] opened cuda library libcufft.so locally tensorflow/stream_executor/dso_loader.cc:108] opened cuda library libcuda.so locally tensorflow/stream_executor/dso_loader.cc:108] opened cuda library libcurand.so locally  in [2]: 

how suppress former logging when running nosetests?

1.0 update (5/20/17):

in tensorflow 1.0, per issue, can control logging via environmental variable called tf_cpp_min_log_level; defaults 0 (all logs shown), can set 1 filter out info logs, 2 additionally filter out warning logs, , 3 additionally filter out error logs. see following generic os example using python:

import os import tensorflow tf  os.environ['tf_cpp_min_log_level'] = '3' 

for prior versions of tensorflow or tf-learn logging, see following:

view page below information on tensorflow logging; new update, you're able set logging verbosity either debug, info, warn, error, or fatal. example:

tf.logging.set_verbosity(tf.logging.error) 

the page additionally goes on monitors can used tf-learn models. here page.

this doesn't block logging, though (only tf-learn). have 2 solutions; 1 'technically correct' solution (linux) , other involves rebuilding tensorflow.

script -c 'python [filename].py' | grep -v 'i tensorflow/' 

for other, please see this answer involves modifying source , rebuilding tensorflow.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -