2017-12-15 25 views
8

Tensorflow 버전 1.4에서 작업 중이며 train() 기능을 디버그하고 싶습니다. 이 링크 https://www.tensorflow.org/programmers_guide/debugger#debugging_tf-learn_estimators_and_experimentsTensorflow의 tf.estimator에서 tensorflow 디버깅 도구 tfdbg를 사용하는 방법은 무엇입니까?

거기에서

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()]  

, 구성 매개 변수 --debug

나는 Jupyter 노트북으로 작업하고 있어요
+0

예에 추가 그것은 당신의 솔루션과 함께 일하고 있습니다. 감사 –