| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,4 @@ | |||
| 1 | + import os | ||
| 1 | 2 | import logging | |
| 2 | 3 | try: | |
| 3 | 4 | import absl.logging | |
@@ -15,3 +16,12 @@ | |||
| 15 | 16 | category=FutureWarning, | |
| 16 | 17 | message=r"passing \(type, 1\) or '1type' as a synonym of type is deprecated", # noqa | |
| 17 | 18 | module="tensorflow") | |
| 19 | + | ||
| 20 | + # Optional: disable the C-based library diagnostic info and warning messages: | ||
| 21 | + # 2019-11-06 18:27:31.698908: I ... dynamic library libcublas.so.10 | ||
| 22 | + # (independent from tf.logging.set_verbosity() diagnostic control) | ||
| 23 | + # Must be set before first import of tensorflow v0.12+ | ||
| 24 | + # (either directly or via Keras backend) | ||
| 25 | + # os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' | ||
| 26 | + # Ref: https://github.com/tensorflow/tensorflow/issues/1258 | ||
| 27 | + # https://stackoverflow.com/questions/35911252/disable-tensorflow-debugging-information/38645250#38645250 # noqa | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -69,7 +69,7 @@ | |||
| 69 | 69 | # But many TF deprecation warnings in 1.14.0, e.g.: | |
| 70 | 70 | # "The name tf.GPUOptions is deprecated. Please use tf.compat.v1.GPUOptions | |
| 71 | 71 | # instead". See tf_export.py | |
| 72 | - if tf_ver > parse_version('1.13.0'): | ||
| 72 | + if tf_ver >= parse_version('1.13.0'): | ||
| 73 | 73 | import tensorflow.compat.v1 as tf | |
| 74 | 74 | else: | |
| 75 | 75 | import tensorflow as tf | |
@@ -86,7 +86,6 @@ | |||
| 86 | 86 | config = tf.ConfigProto(gpu_options=gpu_options) | |
| 87 | 87 | set_session(tf.Session(config=config)) | |
| 88 | 88 | g.flush_all_inorder() | |
| 89 | - g.comm.Barrier() | ||
| 90 | 89 | else: | |
| 91 | 90 | os.environ['KERAS_BACKEND'] = 'theano' | |
| 92 | 91 | base_compile_dir = '{}/tmp/{}-{}'.format( | |
@@ -143,7 +142,6 @@ def __init__(self, lr): | |||
| 143 | 142 | ||
| 144 | 143 | def get_deltas(self, raw_deltas): | |
| 145 | 144 | deltas = [] | |
| 146 | - | ||
| 147 | 145 | if self.iterations == 0: | |
| 148 | 146 | self.velocity_list = [np.zeros_like(g) for g in raw_deltas] | |
| 149 | 147 | ||
@@ -784,7 +782,34 @@ def mpi_train(conf, shot_list_train, shot_list_validate, loader, | |||
| 784 | 782 | conf['num_workers'] = g.comm.Get_size() | |
| 785 | 783 | ||
| 786 | 784 | specific_builder = builder.ModelBuilder(conf) | |
| 785 | + | ||
| 786 | + # TODO(KGF): next line suppresses ALL info and warning messages, not just | ||
| 787 | + # deprecation warnings... | ||
| 788 | + # tf.logging.set_verbosity(tf.logging.ERROR) | ||
| 789 | + | ||
| 790 | + # Internal TensorFlow flags, subject to change (v1.14.0+ only?) | ||
| 791 | + try: | ||
| 792 | + from tensorflow.python.util import module_wrapper as deprecation | ||
| 793 | + except ImportError: | ||
| 794 | + from tensorflow.python.util import deprecation_wrapper as deprecation | ||
| 795 | + # deprecation._PRINT_DEPRECATION_WARNINGS = False # does nothing | ||
| 796 | + deprecation._PER_MODULE_WARNING_LIMIT = 0 | ||
| 797 | + # Suppresses warnings from "keras/backend/tensorflow_backend.py", except: | ||
| 798 | + # "Rate should be set to `rate = 1 - keep_prob`" | ||
| 799 | + # Also suppresses warnings from "keras/optimizers.py | ||
| 800 | + # does NOT suppresses warn from "/tensorflow/python/ops/math_grad.py" | ||
| 801 | + | ||
| 802 | + # TODO(KGF): for TF>v1.13.0 (esp v1.14.0), this next line prompts a ton of | ||
| 803 | + # deprecation warnings with externally-packaged Keras, e.g.: | ||
| 804 | + # WARNING:tensorflow:From .../keras/backend/tensorflow_backend.py:174: | ||
| 805 | + # The name tf.get_default_session is deprecated. | ||
| 806 | + # Please use tf.compat.v1.get_default_session instead. | ||
| 787 | 807 | train_model = specific_builder.build_model(False) | |
| 808 | + # Cannot fix these Keras internals via "import tensorflow.compat.v1 as tf" | ||
| 809 | + # | ||
| 810 | + # TODO(KGF): note, these are different than C-based info diagnostics e.g.: | ||
| 811 | + # 2019-11-06 18:27:31.698908: I ... dynamic library libcublas.so.10 | ||
| 812 | + # which are NOT suppressed by set_verbosity. See top level __init__.py | ||
| 788 | 813 | ||
| 789 | 814 | # load the latest epoch we did. Returns -1 if none exist yet | |
| 790 | 815 | e = specific_builder.load_model_weights(train_model) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments