KeyErrors when running pipeline test
WARNING: Logging before flag parsing goes to stderr.
W0729 11:47:31.899429 139645444425536 deprecation_wrapper.py:119] From /home/gus/seq2seq/seq2seq/training/hooks.py:44: The name tf.tr
ain.SessionRunHook is deprecated. Please use tf.estimator.SessionRunHook instead.
W0729 11:47:31.899979 139645444425536 deprecation_wrapper.py:119] From /home/gus/seq2seq/seq2seq/training/hooks.py:296: The name tf.t
rain.GlobalStepWaiterHook is deprecated. Please use tf.estimator.GlobalStepWaiterHook instead.
sW0729 11:47:32.115276 139645444425536 deprecation.py:323] From /home/gus/seq2seq/seq2seq/test/pipeline_test.py:58: get_or_create_glo
bal_step (from tensorflow.contrib.framework.python.ops.variables) is deprecated and will be removed in a future version.
Instructions for updating:
Please switch to tf.train.get_or_create_global_step
--- Logging error ---
Traceback (most recent call last):
File "/usr/lib/python3.6/logging/__init__.py", line 994, in emit
msg = self.format(record)
File "/usr/lib/python3.6/logging/__init__.py", line 840, in format
return fmt.format(record)
File "/home/gus/.local/lib/python3.6/site-packages/absl/logging/__init__.py", line 921, in format
if (not FLAGS['showprefixforinfo'].value and
File "/home/gus/.local/lib/python3.6/site-packages/absl/flags/_flagvalues.py", line 463, in __getitem__
return self._flags()[name]
KeyError: 'showprefixforinfo'
Call stack:
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.6/unittest/__main__.py", line 18, in <module>
main(module=None)
File "/usr/lib/python3.6/unittest/main.py", line 95, in __init__
self.runTests()
File "/usr/lib/python3.6/unittest/main.py", line 256, in runTests
self.result = testRunner.run(self.test)
File "/usr/lib/python3.6/unittest/runner.py", line 176, in run
test(result)
File "/usr/lib/python3.6/unittest/suite.py", line 84, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/suite.py", line 122, in run
test(result)
File "/usr/lib/python3.6/unittest/suite.py", line 84, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/suite.py", line 122, in run
test(result)
File "/usr/lib/python3.6/unittest/suite.py", line 84, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/suite.py", line 122, in run
test(result)
File "/usr/lib/python3.6/unittest/case.py", line 653, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/case.py", line 605, in run
testMethod()
File "/home/gus/seq2seq/seq2seq/test/pipeline_test.py", line 78, in test_train_infer
tf.reset_default_graph()
File "/home/gus/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation_wrapper.py", line 119, in __getattr__
_call_location(), full_name, rename)
File "/home/gus/.local/lib/python3.6/site-packages/tensorflow/python/platform/tf_logging.py", line 166, in warning
get_logger().warning(msg, *args, **kwargs)
File "/usr/lib/python3.6/logging/__init__.py", line 1320, in warning
self._log(WARNING, msg, args, **kwargs)
File "/usr/lib/python3.6/logging/__init__.py", line 1444, in _log
self.handle(record)
File "/usr/lib/python3.6/logging/__init__.py", line 1454, in handle
self.callHandlers(record)
File "/usr/lib/python3.6/logging/__init__.py", line 1516, in callHandlers
hdlr.handle(record)
File "/home/gus/.local/lib/python3.6/site-packages/absl/logging/__init__.py", line 891, in handle
return self._current_handler.handle(record)
File "/usr/lib/python3.6/logging/__init__.py", line 865, in handle
self.emit(record)
File "/home/gus/.local/lib/python3.6/site-packages/absl/logging/__init__.py", line 825, in emit
self._log_to_stderr(record)
File "/home/gus/.local/lib/python3.6/site-packages/absl/logging/__init__.py", line 797, in _log_to_stderr
super(PythonHandler, self).emit(record)
Message: 'From %s: The name %s is deprecated. Please use %s instead.\n'
Arguments: ('/home/gus/seq2seq/seq2seq/test/pipeline_test.py:78', 'tf.reset_default_graph', 'tf.compat.v1.reset_default_graph')
--- Logging error ---
Traceback (most recent call last):
File "/usr/lib/python3.6/logging/__init__.py", line 994, in emit
msg = self.format(record)
File "/usr/lib/python3.6/logging/__init__.py", line 840, in format
return fmt.format(record)
File "/home/gus/.local/lib/python3.6/site-packages/absl/logging/__init__.py", line 921, in format
if (not FLAGS['showprefixforinfo'].value and
File "/home/gus/.local/lib/python3.6/site-packages/absl/flags/_flagvalues.py", line 463, in __getitem__
return self._flags()[name]
KeyError: 'showprefixforinfo'
Call stack:
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.6/unittest/__main__.py", line 18, in <module>
main(module=None)
File "/usr/lib/python3.6/unittest/main.py", line 95, in __init__
self.runTests()
File "/usr/lib/python3.6/unittest/main.py", line 256, in runTests
self.result = testRunner.run(self.test)
File "/usr/lib/python3.6/unittest/runner.py", line 176, in run
test(result)
File "/usr/lib/python3.6/unittest/suite.py", line 84, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/suite.py", line 122, in run
test(result)
File "/usr/lib/python3.6/unittest/suite.py", line 84, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/suite.py", line 122, in run
test(result)
File "/usr/lib/python3.6/unittest/suite.py", line 84, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/suite.py", line 122, in run
test(result)
File "/usr/lib/python3.6/unittest/case.py", line 653, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/case.py", line 605, in run
testMethod()
File "/home/gus/seq2seq/seq2seq/test/pipeline_test.py", line 107, in test_train_infer
with gfile.GFile(config_path, "w") as config_file:
File "/home/gus/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation_wrapper.py", line 119, in __getattr__
_call_location(), full_name, rename)
File "/home/gus/.local/lib/python3.6/site-packages/tensorflow/python/platform/tf_logging.py", line 166, in warning
get_logger().warning(msg, *args, **kwargs)
File "/usr/lib/python3.6/logging/__init__.py", line 1320, in warning
self._log(WARNING, msg, args, **kwargs)
File "/usr/lib/python3.6/logging/__init__.py", line 1444, in _log
self.handle(record)
File "/usr/lib/python3.6/logging/__init__.py", line 1454, in handle
self.callHandlers(record)
File "/usr/lib/python3.6/logging/__init__.py", line 1516, in callHandlers
hdlr.handle(record)
File "/home/gus/.local/lib/python3.6/site-packages/absl/logging/__init__.py", line 891, in handle
return self._current_handler.handle(record)
File "/usr/lib/python3.6/logging/__init__.py", line 865, in handle
self.emit(record)
File "/home/gus/.local/lib/python3.6/site-packages/absl/logging/__init__.py", line 825, in emit
self._log_to_stderr(record)
File "/home/gus/.local/lib/python3.6/site-packages/absl/logging/__init__.py", line 797, in _log_to_stderr
super(PythonHandler, self).emit(record)
Message: 'From %s: The name %s is deprecated. Please use %s instead.\n'
Arguments: ('/home/gus/seq2seq/seq2seq/test/pipeline_test.py:107', 'tf.gfile.GFile', 'tf.io.gfile.GFile')
--- Logging error ---
Traceback (most recent call last):
File "/usr/lib/python3.6/logging/__init__.py", line 994, in emit
msg = self.format(record)
File "/usr/lib/python3.6/logging/__init__.py", line 840, in format
return fmt.format(record)
File "/home/gus/.local/lib/python3.6/site-packages/absl/logging/__init__.py", line 921, in format
if (not FLAGS['showprefixforinfo'].value and
File "/home/gus/.local/lib/python3.6/site-packages/absl/flags/_flagvalues.py", line 463, in __getitem__
return self._flags()[name]
KeyError: 'showprefixforinfo'
Call stack:
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.6/unittest/__main__.py", line 18, in <module>
main(module=None)
File "/usr/lib/python3.6/unittest/main.py", line 95, in __init__
self.runTests()
File "/usr/lib/python3.6/unittest/main.py", line 256, in runTests
self.result = testRunner.run(self.test)
File "/usr/lib/python3.6/unittest/runner.py", line 176, in run
test(result)
File "/usr/lib/python3.6/unittest/suite.py", line 84, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/suite.py", line 122, in run
test(result)
File "/usr/lib/python3.6/unittest/suite.py", line 84, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/suite.py", line 122, in run
test(result)
File "/usr/lib/python3.6/unittest/suite.py", line 84, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/suite.py", line 122, in run
test(result)
File "/usr/lib/python3.6/unittest/case.py", line 653, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/case.py", line 605, in run
testMethod()
File "/home/gus/seq2seq/seq2seq/test/pipeline_test.py", line 148, in test_train_infer
tf.logging.set_verbosity(tf.logging.INFO)
File "/home/gus/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation_wrapper.py", line 119, in __getattr__
_call_location(), full_name, rename)
File "/home/gus/.local/lib/python3.6/site-packages/tensorflow/python/platform/tf_logging.py", line 166, in warning
get_logger().warning(msg, *args, **kwargs)
File "/usr/lib/python3.6/logging/__init__.py", line 1320, in warning
self._log(WARNING, msg, args, **kwargs)
File "/usr/lib/python3.6/logging/__init__.py", line 1444, in _log
self.handle(record)
File "/usr/lib/python3.6/logging/__init__.py", line 1454, in handle
self.callHandlers(record)
File "/usr/lib/python3.6/logging/__init__.py", line 1516, in callHandlers
hdlr.handle(record)
File "/home/gus/.local/lib/python3.6/site-packages/absl/logging/__init__.py", line 891, in handle
return self._current_handler.handle(record)
File "/usr/lib/python3.6/logging/__init__.py", line 865, in handle
self.emit(record)
File "/home/gus/.local/lib/python3.6/site-packages/absl/logging/__init__.py", line 825, in emit
self._log_to_stderr(record)
File "/home/gus/.local/lib/python3.6/site-packages/absl/logging/__init__.py", line 797, in _log_to_stderr
super(PythonHandler, self).emit(record)
Message: 'From %s: The name %s is deprecated. Please use %s instead.\n'
Arguments: ('/home/gus/seq2seq/seq2seq/test/pipeline_test.py:148', 'tf.logging.set_verbosity', 'tf.compat.v1.logging.set_verbosity')
--- Logging error ---
Traceback (most recent call last):
File "/usr/lib/python3.6/logging/__init__.py", line 994, in emit
msg = self.format(record)
File "/usr/lib/python3.6/logging/__init__.py", line 840, in format
return fmt.format(record)
File "/home/gus/.local/lib/python3.6/site-packages/absl/logging/__init__.py", line 921, in format
if (not FLAGS['showprefixforinfo'].value and
File "/home/gus/.local/lib/python3.6/site-packages/absl/flags/_flagvalues.py", line 463, in __getitem__
return self._flags()[name]
KeyError: 'showprefixforinfo'
Call stack:
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.6/unittest/__main__.py", line 18, in <module>
main(module=None)
File "/usr/lib/python3.6/unittest/main.py", line 95, in __init__
self.runTests()
File "/usr/lib/python3.6/unittest/main.py", line 256, in runTests
self.result = testRunner.run(self.test)
File "/usr/lib/python3.6/unittest/runner.py", line 176, in run
test(result)
File "/usr/lib/python3.6/unittest/suite.py", line 84, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/suite.py", line 122, in run
test(result)
File "/usr/lib/python3.6/unittest/suite.py", line 84, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/suite.py", line 122, in run
test(result)
File "/usr/lib/python3.6/unittest/suite.py", line 84, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/suite.py", line 122, in run
test(result)
File "/usr/lib/python3.6/unittest/case.py", line 653, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python3.6/unittest/case.py", line 605, in run
testMethod()
File "/home/gus/seq2seq/seq2seq/test/pipeline_test.py", line 148, in test_train_infer
tf.logging.set_verbosity(tf.logging.INFO)
File "/home/gus/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation_wrapper.py", line 119, in __getattr__
_call_location(), full_name, rename)
File "/home/gus/.local/lib/python3.6/site-packages/tensorflow/python/platform/tf_logging.py", line 166, in warning
get_logger().warning(msg, *args, **kwargs)
File "/usr/lib/python3.6/logging/__init__.py", line 1320, in warning
self._log(WARNING, msg, args, **kwargs)
File "/usr/lib/python3.6/logging/__init__.py", line 1444, in _log
self.handle(record)
File "/usr/lib/python3.6/logging/__init__.py", line 1454, in handle
self.callHandlers(record)
File "/usr/lib/python3.6/logging/__init__.py", line 1516, in callHandlers
hdlr.handle(record)
File "/home/gus/.local/lib/python3.6/site-packages/absl/logging/__init__.py", line 891, in handle
return self._current_handler.handle(record)
File "/usr/lib/python3.6/logging/__init__.py", line 865, in handle
self.emit(record)
File "/home/gus/.local/lib/python3.6/site-packages/absl/logging/__init__.py", line 825, in emit
self._log_to_stderr(record)
File "/home/gus/.local/lib/python3.6/site-packages/absl/logging/__init__.py", line 797, in _log_to_stderr
super(PythonHandler, self).emit(record)
Message: 'From %s: The name %s is deprecated. Please use %s instead.\n'
Arguments: ('/home/gus/seq2seq/seq2seq/test/pipeline_test.py:148', 'tf.logging.INFO', 'tf.compat.v1.logging.INFO')
E
======================================================================
ERROR: test_train_infer (seq2seq.test.pipeline_test.PipelineTest)
test_train_infer (seq2seq.test.pipeline_test.PipelineTest)
Tests training and inference scripts.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/gus/seq2seq/seq2seq/test/pipeline_test.py", line 149, in test_train_infer
train_script.main(['--logtostderr'])
File "/home/gus/seq2seq/bin/train.py", line 237, in main
tf.logging.info("Loading config from %s", config_path)
File "/home/gus/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation_wrapper.py", line 119, in __getattr__
_call_location(), full_name, rename)
File "/home/gus/.local/lib/python3.6/site-packages/tensorflow/python/platform/tf_logging.py", line 166, in warning
get_logger().warning(msg, *args, **kwargs)
File "/usr/lib/python3.6/logging/__init__.py", line 1320, in warning
self._log(WARNING, msg, args, **kwargs)
File "/usr/lib/python3.6/logging/__init__.py", line 1444, in _log
self.handle(record)
File "/usr/lib/python3.6/logging/__init__.py", line 1454, in handle
self.callHandlers(record)
File "/usr/lib/python3.6/logging/__init__.py", line 1516, in callHandlers
hdlr.handle(record)
File "/home/gus/.local/lib/python3.6/site-packages/absl/logging/__init__.py", line 891, in handle
return self._current_handler.handle(record)
File "/usr/lib/python3.6/logging/__init__.py", line 865, in handle
self.emit(record)
File "/home/gus/.local/lib/python3.6/site-packages/absl/logging/__init__.py", line 826, in emit
elif FLAGS['logtostderr'].value:
File "/home/gus/.local/lib/python3.6/site-packages/absl/flags/_flagvalues.py", line 463, in __getitem__
return self._flags()[name]
KeyError: 'logtostderr'
----------------------------------------------------------------------
Ran 2 tests in 0.278s
FAILED (errors=1, skipped=1)
This occurred after performing the fixes in #68. Seems like default values of flags aren't getting set, somehow?
I am facing the same problem , any solution for this ?
Same here, after applying suggestions from #316
I am facing the same problem , any solution for this ?
I met same problem, then I downgraded tensorflow 1.14.0 to1.12.0, it works
Is there a fix for this aside from downgrading tensorflow? I am having the same issue.
Any news on this issue ?
I added the following lines of code:
if not hasattr(flags.FLAGS, 'showprefixforinfo'):
flags.DEFINE_string(
'showprefixforinfo', 'true',
'If False, do not prepend prefix to info messages when it is logged to stderr'
)
Please check if it works for you?
I'm getting this error: return self._flags()[name] KeyError: 'verbosity'
Here is the code:
def del_all_flags(FLAGS):
flags_dict = FLAGS._flags()
keys_list = [keys for keys in flags_dict]
for keys in keys_list:
FLAGS.delattr(keys)
del_all_flags(tf.flags.FLAGS)
flags.DEFINE_string(
'model_dir', None, 'Path to output model directory '
'where event and checkpoint files will be written.')
flags.DEFINE_string('pipeline_config_path', None, 'Path to pipeline config '
'file.')
flags.DEFINE_integer('num_train_steps', None, 'Number of train steps.')
flags.DEFINE_boolean('eval_training_data', False,
'If training data should be evaluated for this job. Note '
'that one call only use this in eval-only mode, and '
'checkpoint_dir must be supplied.')
flags.DEFINE_integer('sample_1_of_n_eval_examples', 1, 'Will sample one of '
'every n eval input examples, where n is provided.')
flags.DEFINE_integer('sample_1_of_n_eval_on_train_examples', 5, 'Will sample '
'one of every n train input examples for evaluation, '
'where n is provided. This is only used if '
'eval_training_data is True.')
flags.DEFINE_string(
'checkpoint_dir', None, 'Path to directory holding a checkpoint. If '
'checkpoint_dir is provided, this binary operates in eval-only mode, '
'writing resulting metrics to model_dir.')
flags.DEFINE_boolean(
'run_once', False, 'If running in eval-only mode, whether to run just '
'one round of eval vs running continuously (default).'
)
flags.DEFINE_integer(
'max_eval_retries', 0, 'If running continuous eval, the maximum number of '
'retries upon encountering tf.errors.InvalidArgumentError. If negative, '
'will always retry the evaluation.'
)
FLAGS = flags.FLAGS
def main(unused_argv): flags.mark_flag_as_required('model_dir') flags.mark_flag_as_required('pipeline_config_path') config = tf.estimator.RunConfig(model_dir=FLAGS.model_dir)
train_and_eval_dict = model_lib.create_estimator_and_inputs( run_config=config, pipeline_config_path=FLAGS.pipeline_config_path, train_steps=FLAGS.num_train_steps, sample_1_of_n_eval_examples=FLAGS.sample_1_of_n_eval_examples, sample_1_of_n_eval_on_train_examples=( FLAGS.sample_1_of_n_eval_on_train_examples)) estimator = train_and_eval_dict['estimator'] train_input_fn = train_and_eval_dict['train_input_fn'] eval_input_fns = train_and_eval_dict['eval_input_fns'] eval_on_train_input_fn = train_and_eval_dict['eval_on_train_input_fn'] predict_input_fn = train_and_eval_dict['predict_input_fn'] train_steps = train_and_eval_dict['train_steps']
if FLAGS.checkpoint_dir: if FLAGS.eval_training_data: name = 'training_data' input_fn = eval_on_train_input_fn else: name = 'validation_data' # The first eval input will be evaluated. input_fn = eval_input_fns[0] if FLAGS.run_once: estimator.evaluate(input_fn, steps=None, checkpoint_path=tf.train.latest_checkpoint( FLAGS.checkpoint_dir)) else: model_lib.continuous_eval(estimator, FLAGS.checkpoint_dir, input_fn, train_steps, name, FLAGS.max_eval_retries) else: train_spec, eval_specs = model_lib.create_train_and_eval_specs( train_input_fn, eval_input_fns, eval_on_train_input_fn, predict_input_fn, train_steps, eval_on_train_data=False)
# Currently only a single Eval Spec is allowed.
tf.estimator.train_and_evaluate(estimator, train_spec, eval_specs[0])
if name == 'main': tf.app.run()
ANY HELP WOULD BE APPRECIATED!