2017-12-15 24 views
8

私はTensorflowバージョン1.4で作業しており、train()機能をデバッグしたいと考えています。このリンクでTensorflowのtf.estimatorでテンソルフローデバッグツールtfdbgを使用するにはどうすればよいですか?

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

tf.contrib.learn Estimatorsのためにそれを行うための方法ですが、私はtf.estimator(バージョン1.4の新機能)に適合させるための方法を見つけることができません。

これは私がしようとしたものです:

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) 

をしかし、私はこのエラーに実行しています:

> --------------------------------------------------------------------------- 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 

誰かが正しい方向に私を指すことができますか?

答えて

2

デフォルトはコマンドラインで動作するように設定されていますが、PycharmなどのIDEを使用する場合、最も簡単な解決策はUIタイプを変更することです。

試してみてください。

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

代わりに:あなたはPycharmを使用する場合は

hooks = [tf_debug.LocalCLIDebugHook()]  

、私はJupyterノートで働いています--debug

+0

設定パラメータに追加して、はいそれはあなたのソリューションで動作しています。ありがとう –

関連する問題