models icon indicating copy to clipboard operation
models copied to clipboard

2018-07-24 18:23:29.108372: W tensorflow/core/framework/op_kernel.cc:1306] Unknown: exceptions.RuntimeError: main thread is not in main loop

Open 5ertsa opened this issue 8 years ago • 5 comments

Hi.

System information

  • What is the top-level directory of the model you are using:object_detection
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):Ubuntu 16.04
  • TensorFlow installed from (source or binary):binary
  • Have I written custom code: No
  • Bazel version: N/A
  • Exact command to reproduce:python model_main.py --pipeline_config_path=${PIPELINE_CONFIG_PATH} --model_dir=${MODEL_DIR} --num_train_steps=100000 --num_eval_steps=1 --alsologtostderr
  • TensorFlow version (use command below):1.9.0
  • CUDA/cuDNN version:9.0/7
  • GPU model and memory:GTX1080Ti 11GB

Describe the problem

I train my model using "python model_main.py --pipeline_config_path=${PIPELINE_CONFIG_PATH} --model_dir=${MODEL_DIR} --num_train_steps=100000 --num_eval_steps=1 --alsologtostderr". It can't be done. Thank you for any helping.

Source code / logs

2018-07-24 18:23:07.794570: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA 2018-07-24 18:23:07.974755: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1392] Found device 0 with properties: name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.582 pciBusID: 0000:65:00.0 totalMemory: 10.91GiB freeMemory: 10.40GiB 2018-07-24 18:23:07.974946: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1471] Adding visible gpu devices: 0 2018-07-24 18:23:08.191079: I tensorflow/core/common_runtime/gpu/gpu_device.cc:952] Device interconnect StreamExecutor with strength 1 edge matrix: 2018-07-24 18:23:08.191120: I tensorflow/core/common_runtime/gpu/gpu_device.cc:958] 0 2018-07-24 18:23:08.191127: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0: N 2018-07-24 18:23:08.191334: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1084] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10057 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:65:00.0, compute capability: 6.1) ^[^R ^[2018-07-24 18:23:27.936487: W tensorflow/core/common_runtime/bfc_allocator.cc:219] Allocator (GPU_0_bfc) ran out of memory trying to allocate 2.09GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available. 2018-07-24 18:23:27.952529: W tensorflow/core/common_runtime/bfc_allocator.cc:219] Allocator (GPU_0_bfc) ran out of memory trying to allocate 2.19GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available. 2018-07-24 18:23:29.108372: W tensorflow/core/framework/op_kernel.cc:1306] Unknown: exceptions.RuntimeError: main thread is not in main loop Traceback (most recent call last):

File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/script_ops.py", line 158, in call ret = func(*args)

File "../object_detection/utils/visualization_utils.py", line 693, in cdf_plot fig = plt.figure(frameon=False)

File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 548, in figure **kwargs)

File "/usr/local/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 161, in new_figure_manager return cls.new_figure_manager_given_figure(num, fig)

File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/_backend_tk.py", line 1053, in new_figure_manager_given_figure icon_img = Tk.PhotoImage(file=icon_fname)

File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 3370, in init Image.init(self, 'photo', name, cnf, master, **kw)

File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 3324, in init self.tk.call(('image', 'create', imgtype, name,) + options)

RuntimeError: main thread is not in main loop

Traceback (most recent call last): File "model_main.py", line 107, in tf.app.run() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "model_main.py", line 103, in main tf.estimator.train_and_evaluate(estimator, train_spec, eval_specs[0]) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/training.py", line 447, in train_and_evaluate return executor.run() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/training.py", line 531, in run return self.run_local() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/training.py", line 669, in run_local hooks=train_hooks) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 366, in train loss = self._train_model(input_fn, hooks, saving_listeners) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 1119, in _train_model return self._train_model_default(input_fn, hooks, saving_listeners) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 1135, in _train_model_default saving_listeners) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 1336, in _train_with_estimator_spec _, loss = mon_sess.run([estimator_spec.train_op, estimator_spec.loss]) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py", line 577, in run run_metadata=run_metadata) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py", line 1053, in run run_metadata=run_metadata) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py", line 1144, in run raise six.reraise(*original_exc_info) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py", line 1129, in run return self._sess.run(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py", line 1201, in run run_metadata=run_metadata) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/monitored_session.py", line 981, in run return self._sess.run(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 900, in run run_metadata_ptr) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1135, in _run feed_dict_tensor, options, run_metadata) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1316, in _do_run run_metadata) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1335, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.UnknownError: exceptions.RuntimeError: main thread is not in main loop Traceback (most recent call last):

File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/script_ops.py", line 158, in call ret = func(*args)

File "../object_detection/utils/visualization_utils.py", line 693, in cdf_plot fig = plt.figure(frameon=False)

File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 548, in figure **kwargs)

File "/usr/local/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 161, in new_figure_manager return cls.new_figure_manager_given_figure(num, fig)

File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/_backend_tk.py", line 1053, in new_figure_manager_given_figure icon_img = Tk.PhotoImage(file=icon_fname)

File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 3370, in init Image.init(self, 'photo', name, cnf, master, **kw)

File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 3324, in init self.tk.call(('image', 'create', imgtype, name,) + options)

RuntimeError: main thread is not in main loop

 [[Node: Loss/PyFunc_1 = PyFunc[Tin=[DT_FLOAT], Tout=[DT_UINT8], token="pyfunc_1", _device="/job:localhost/replica:0/task:0/device:CPU:0"](Loss/Squeeze_1/_4691)]]

Caused by op u'Loss/PyFunc_1', defined at: File "model_main.py", line 107, in tf.app.run() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "model_main.py", line 103, in main tf.estimator.train_and_evaluate(estimator, train_spec, eval_specs[0]) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/training.py", line 447, in train_and_evaluate return executor.run() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/training.py", line 531, in run return self.run_local() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/training.py", line 669, in run_local hooks=train_hooks) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 366, in train loss = self._train_model(input_fn, hooks, saving_listeners) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 1119, in _train_model return self._train_model_default(input_fn, hooks, saving_listeners) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 1132, in _train_model_default features, labels, model_fn_lib.ModeKeys.TRAIN, self.config) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/estimator/estimator.py", line 1107, in _call_model_fn model_fn_results = self._model_fn(features=features, **kwargs) File "../object_detection/model_lib.py", line 281, in model_fn prediction_dict, features[fields.InputDataFields.true_image_shape]) File "../object_detection/meta_architectures/ssd_meta_arch.py", line 597, in loss flattened_class_ids, flattened_classification_losses) File "../object_detection/meta_architectures/ssd_meta_arch.py", line 660, in _summarize_anchor_classification_loss 'NegativeAnchorLossCDF') File "../object_detection/utils/visualization_utils.py", line 703, in add_cdf_image_summary cdf_plot = tf.py_func(cdf_plot, [values], tf.uint8) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/script_ops.py", line 384, in py_func func=func, inp=inp, Tout=Tout, stateful=stateful, eager=False, name=name) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/script_ops.py", line 227, in _internal_py_func input=inp, token=token, Tout=Tout, name=name) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_script_ops.py", line 128, in py_func "PyFunc", input=input, token=token, Tout=Tout, name=name) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 3414, in create_op op_def=op_def) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1740, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

UnknownError (see above for traceback): exceptions.RuntimeError: main thread is not in main loop Traceback (most recent call last):

File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/script_ops.py", line 158, in call ret = func(*args)

File "../object_detection/utils/visualization_utils.py", line 693, in cdf_plot fig = plt.figure(frameon=False)

File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 548, in figure **kwargs)

File "/usr/local/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 161, in new_figure_manager return cls.new_figure_manager_given_figure(num, fig)

File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/_backend_tk.py", line 1053, in new_figure_manager_given_figure icon_img = Tk.PhotoImage(file=icon_fname)

File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 3370, in init Image.init(self, 'photo', name, cnf, master, **kw)

File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 3324, in init self.tk.call(('image', 'create', imgtype, name,) + options)

RuntimeError: main thread is not in main loop

 [[Node: Loss/PyFunc_1 = PyFunc[Tin=[DT_FLOAT], Tout=[DT_UINT8], token="pyfunc_1", _device="/job:localhost/replica:0/task:0/device:CPU:0"](Loss/Squeeze_1/_4691)]]

Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) File "/usr/local/lib/python2.7/dist-packages/matplotlib/_pylab_helpers.py", line 78, in destroy_all manager.destroy() File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/_backend_tk.py", line 558, in destroy self.window.destroy() File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1862, in destroy for c in self.children.values(): c.destroy() File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 2100, in destroy self.tk.call('destroy', self._w) RuntimeError: main thread is not in main loop Error in sys.exitfunc: Traceback (most recent call last): File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) File "/usr/local/lib/python2.7/dist-packages/matplotlib/_pylab_helpers.py", line 78, in destroy_all manager.destroy() File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/_backend_tk.py", line 558, in destroy self.window.destroy() File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1862, in destroy for c in self.children.values(): c.destroy() File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 2100, in destroy self.tk.call('destroy', self._w) RuntimeError: main thread is not in main loop

5ertsa avatar Jul 24 '18 10:07 5ertsa

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks. Have I written custom code Bazel version Exact command to reproduce

tensorflowbutler avatar Jul 24 '18 19:07 tensorflowbutler

@derekjchow - looks like a visualization loop is complaining about being multi-processed?

karmel avatar Jul 24 '18 20:07 karmel

I have updated these in my question. Thank you. Have I written custom code Bazel version Exact command to reproduce

5ertsa avatar Jul 25 '18 01:07 5ertsa

I solved this . See #4791 kakpple's solution

5ertsa avatar Jul 25 '18 01:07 5ertsa

Great. Closing.

karmel avatar Jul 25 '18 14:07 karmel