2016-06-28 11 views
8

मैं अपने टेन्सफोर्लो कोड को नोजेट के साथ बेकार कर रहा हूं लेकिन यह वर्बोज़ आउटपुट की मात्रा उत्पन्न करता है जो इसे बेकार बनाता है।वर्बोज़ Tensorflow लॉगिंग दबाने के लिए कैसे?

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 at 0x7f4379131c80>) in shape functions. 
tensorflow: Level 1: Registering Assert (<function no_outputs at 0x7f43791319b0>) in shape functions. 
tensorflow: Level 1: Registering Print (<function _PrintGrad at 0x7f4378effd70>) in gradient. 
tensorflow: Level 1: Registering Print (<function unchanged_shape at 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 at 0x7f4378f042a8>) in shape functions. 
tensorflow: Level 1: Registering MergeSummary (<function _ScalarShape at 0x7f4378f042a8>) in shape functions. 
tensorflow: Level 1: Registering AudioSummary (<function _ScalarShape at 0x7f4378f042a8>) in shape functions. 
tensorflow: Level 1: Registering ImageSummary (<function _ScalarShape at 0x7f4378f042a8>) in shape functions. 
tensorflow: Level 1: Registering HistogramSummary (<function _ScalarShape at 0x7f4378f042a8>) in shape functions. 
tensorflow: Level 1: Registering HistogramAccumulatorSummary (<function _ScalarShape at 0x7f4378f042a8>) in shape functions. 
tensorflow: Level 1: Registering Pack (<function _PackShape at 0x7f4378f047d0>) in shape functions. 
tensorflow: Level 1: Registering Unpack (<function _UnpackShape at 0x7f4378f048c0>) in shape functions. 
tensorflow: Level 1: Registering Concat (<function _ConcatShape at 0x7f4378f04938>) in shape functions. 
tensorflow: Level 1: Registering ConcatOffset (<function _ConcatOffsetShape at 0x7f4378f049b0>) in shape functions. 

...... 

IPython कंसोल से tensorflow का उपयोग कर, जबकि कि वर्बोज़ प्रतीत नहीं होता:

निम्नलिखित परीक्षण

import unittest 
import tensorflow as tf 

class MyTest(unittest.TestCase): 

    def test_creation(self): 
     self.assertEquals(True, False) 

जब nosetests के साथ चलाने के बेकार लॉगिंग की एक बड़ी राशि बनाता है

$ ipython 
Python 2.7.11+ (default, Apr 17 2016, 14:00:29) 
Type "copyright", "credits" or "license" for more information. 

IPython 4.2.0 -- An enhanced Interactive Python. 
?   -> Introduction and overview of IPython's features. 
%quickref -> Quick reference. 
help  -> Python's own help system. 
object? -> Details about 'object', use 'object??' for extra details. 

In [1]: import tensorflow as tf 
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.so locally 
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so locally 
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so locally 
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so locally 
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally 

In [2]: 

मैं दौड़ते समय पूर्व लॉगिंग को कैसे दबा सकता हूं nosetests?

+0

की संभावित डुप्लिकेट [अक्षम Tensorflow डिबगिंग जानकारी] (http://stackoverflow.com/questions/35911252/disable-tensorflow-debugging-information) – craymichael

+0

एक अन्य समाधान: https: //stackoverflow.com/questions/43337601/nosetests-with-tensorflow-lots-of-debugging-output-how-to-disable – vpekar

उत्तर

0

यह करने के लिए यहां an example है। दुर्भाग्य से इसे स्रोत और पुनर्निर्माण को संशोधित करने की आवश्यकता है। यहाँ एक tracking bug बनाने के लिए है यह आसान

18

1,0 अद्यतन (5/20/17):

TensorFlow 1.0 में, इस issue प्रति, अब आप पर्यावरण चर TF_CPP_MIN_LOG_LEVEL कहा जाता है के माध्यम से प्रवेश नियंत्रित कर सकते हैं; यह 0 (सभी लॉग दिखाए गए) को डिफ़ॉल्ट करता है, लेकिन INFO लॉग आउट करने के लिए 1 पर सेट किया जा सकता है, 2 WARNING लॉग आउट करने के लिए 2 और ERROR लॉग को अतिरिक्त रूप से फ़िल्टर करने के लिए 3 सेट किया जा सकता है। अजगर का उपयोग कर निम्नलिखित सामान्य OS उदाहरण देखें:

import os 
import tensorflow as tf 

os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' 

TensorFlow के पूर्व संस्करण या के लिए TF-जानें लॉगिंग, निम्न देखें:

देखें TensorFlow लॉगिंग जानकारी के लिए नीचे पेज; नए अपडेट के साथ, आप DEBUG, INFO, WARN, ERROR, या FATAL पर लॉगिंग वर्बोसिटी सेट करने में सक्षम हैं। उदाहरण के लिए:

tf.logging.set_verbosity(tf.logging.ERROR) 

पृष्ठ अतिरिक्त रूप से मॉनीटर पर चला जाता है जिसका उपयोग टीएफ-जानें मॉडल के साथ किया जा सकता है। Here is the page

यह सभी लॉगिंग ब्लॉक नहीं करता है, हालांकि (केवल टीएफ-जानें)। मेरे पास दो समाधान हैं; एक 'तकनीकी रूप से सही' समाधान (लिनक्स) है और दूसरे में टेंसरफ्लो का पुनर्निर्माण शामिल है।

script -c 'python [FILENAME].py' | grep -v 'I tensorflow/' 

अन्य के लिए, कृपया this answer जो स्रोत को संशोधित करने और TensorFlow पुनर्निर्माण शामिल है देखते हैं।

6

nosetests --nologcapture के साथ परीक्षण चलाना इन लॉगों के प्रदर्शन को अक्षम कर देगा। nosetests के लिए लॉगिंग के बारे में अधिक जानकारी: https://nose.readthedocs.io/en/latest/plugins/logcapture.html

संबंधित मुद्दे