I am working with Tensorflow version 1.4, and I 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 it for tf.contrib.learn Estimators
, but I can not find a way to adapt it to the (new in version 1.4) tf.estimator
.
This is what I have 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 running into 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?
Estimators simplify sharing implementations between model developers. You can develop a great model with high-level intuitive code, as they usually are easier to use if you need to create models compared to the low-level TensorFlow APIs. Estimators are themselves built on tf. keras.
It is recommended using pre-made Estimators when just getting started. To write a TensorFlow program based on pre-made Estimators, you must perform the following tasks: Create one or more input functions. Define the model's feature columns.
The default is set for working in command line, if you use IDE such as Pycharm the simplest solution is to change UI type.
Try:
hooks = [tf_debug.LocalCLIDebugHook(ui_type="readline")]
instead of:
hooks = [tf_debug.LocalCLIDebugHook()]
In case you use Pycharm, add to the configuration parameters --debug
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With