2017-12-15 166 views
8

Tensorflow sürüm 1.4 ile çalışıyorum ve train() işlevimde hata ayıklamak istiyorum. Bu bağlantıyı https://www.tensorflow.org/programmers_guide/debugger#debugging_tf-learn_estimators_and_experimentsTensorflow'da tf.estimator'da tensorflow hata ayıklama aracı tfdbg nasıl kullanılır?

İçeride

tf.contrib.learn Estimators için bunu yapmak için bir yoldur, ama ben tf.estimator (1.4 sürümü yeni) uyarlamak için bir yol bulmak mümkün değil.

Bu ben denedim budur:

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) 

Ama bu hata içine çalıştırıyorum:

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

birisi bana doğru yönde işaret edebilir?

cevap

2

Varsayılan değer, komut satırında çalışmak üzere ayarlanır; Pycharm gibi IDE kullanıyorsanız, UI türünü değiştirmek en basit çözümdür.

Dene:

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

yerine:

Eğer pycharm kullanmak durumunda
hooks = [tf_debug.LocalCLIDebugHook()]  

, yapılandırma parametreleri --debug

Bir Jupyter dizüstü ile çalışan ve am
+0

evet eklemek senin çözümünle çalışıyor. Teşekkürler –

İlgili konular