How to use tfdbg tool for tf.estimator in Tensorflow?

I am working with Tensorflow version 1.4 and want to debug my train() function.

In this link https://www.tensorflow.org/programmers_guide/debugger#debugging_tf-learn_estimators_and_experiments

There is a way to do this for tf.contrib.learn Estimators , but I cannot find a way to adapt it to (new in version 1.4) tf.estimator .

Here is what I tried:

 from tensorflow.python import debug as tf_debug # Create an estimator my_estimator = tf.estimator.Estimator(model_fn=model_fn, params=model_params, model_dir='/tb_dir', config=config_estimator) # Create a LocalCLIDebugHook and use it as a hook when calling train(). hooks = [tf_debug.LocalCLIDebugHook()] # Train my_estimator.train(input_fn=train_input_fn, steps=10,hooks=hooks) 

But I am facing this error:

 > --------------------------------------------------------------------------- error Traceback (most recent call > last) <ipython-input-14-71325f3c8f14> in <module>() > 7 > 8 # Train > ----> 9 my_estimator.train(input_fn=train_input_fn, steps=10,hooks=hooks) > [...] > > /root/anaconda3/lib/python3.6/site-packages/tensorflow/python/debug/cli/curses_ui.py > in _screen_launch(self, enable_mouse_on_start) > 443 > 444 curses.noecho() > --> 445 curses.cbreak() > 446 self._stdscr.keypad(1) > 447 > > error: cbreak() returned ERR 

Can someone point me in the right direction?

+8
python debugging tensorflow tensorflow-estimator
source share
1 answer

The default value is set to work on the command line if you are using an IDE such as Pycharm, the easiest solution is to change the type of user interface.

Try:

 hooks = [tf_debug.LocalCLIDebugHook(ui_type="readline")] 

instead:

 hooks = [tf_debug.LocalCLIDebugHook()] 

If you are using Pycharm, add --debug configuration options

+2
source share

All Articles