2017-01-23 39 views
0

我有一個工作TF安裝和苗條工作也很好。TensorFlow:苗條的訓練循環崩潰「沒有會話工廠註冊」

但是,當我嘗試運行一個苗條的訓練循環時,我的應用程序崩潰。

最少的代碼:

import tensorflow as tf 
import tensorflow.contrib.slim as slim 


# Load data. 
... 


graph = tf.Graph() 
with graph.as_default(): 

    # Build model 
    ... 

    # Add losses 
    ... 

    # Create training operation and start the actual training loop. 
    train_op = ... 

    # Start training loop 

    slim.learning.train(
     train_op, 
     logdir=FLAGS.logdir, 
     save_summaries_secs=FLAGS.save_summaries_secs, 
     save_interval_secs=FLAGS.save_interval_secs, 
     master=FLAGS.master, 
     is_chief=(FLAGS.task == 0), 
     startup_delay_steps=(FLAGS.task * 20), 
     log_every_n_steps=FLAGS.log_every_n_steps) 

當我跑,我得到:

E tensorflow/core/common_runtime/session.cc:69] Not found: No session factory registered for the given session options: {target: "local" config: } Registered factories are {DIRECT_SESSION, GRPC_SESSION}. 
Traceback (most recent call last): 
File "tensorflow/tensorflow/contrib/my_package/python/my_package/train.py", line 467, in <module> 
    app.run() 
File "$HOME/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 44, in run 
    _sys.exit(main(_sys.argv[:1] + flags_passthrough)) 
File "tensorflow/tensorflow/contrib/my_package/python/my_package/train.py", line 462, in main 
    log_every_n_steps=FLAGS.log_every_n_steps) 
File "$HOME/.local/lib/python2.7/site-packages/tensorflow/contrib/slim/python/slim/learning.py", line 776, in train 
    master, start_standard_services=False, config=session_config) as sess: 
File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__ 
    return self.gen.next() 
File "$HOME/.local/lib/python2.7/site-packages/tensorflow/python/training/supervisor.py", line 973, in managed_session 
    self.stop(close_summary_writer=close_summary_writer) 
File "$HOME/.local/lib/python2.7/site-packages/tensorflow/python/training/supervisor.py", line 801, in stop 
    stop_grace_period_secs=self._stop_grace_secs) 
File "$HOME/.local/lib/python2.7/site-packages/tensorflow/python/training/coordinator.py", line 386, in join 
    six.reraise(*self._exc_info_to_raise) 
File "$HOME/.local/lib/python2.7/site-packages/tensorflow/python/training/supervisor.py", line 962, in managed_session 
    start_standard_services=start_standard_services) 
File "$HOME/.local/lib/python2.7/site-packages/tensorflow/python/training/supervisor.py", line 719, in prepare_or_wait_for_session 
    init_feed_dict=self._init_feed_dict, init_fn=self._init_fn) 
File "$HOME/.local/lib/python2.7/site-packages/tensorflow/python/training/session_manager.py", line 256, in prepare_session 
    config=config) 
File "$HOME/.local/lib/python2.7/site-packages/tensorflow/python/training/session_manager.py", line 161, in _restore_checkpoint 
    sess = session.Session(self._target, graph=self._graph, config=config) 
File "$HOME/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1187, in __init__ 
    super(Session, self).__init__(target, graph, config=config) 
File "$HOME/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 552, in __init__ 
    self._session = tf_session.TF_NewDeprecatedSession(opts, status) 
File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__ 
    self.gen.next() 
File "$HOME/.local/lib/python2.7/site-packages/tensorflow/python/framework/errors_impl.py", line 469, in raise_exception_on_not_ok_status 
    pywrap_tensorflow.TF_GetCode(status)) 
tensorflow.python.framework.errors_impl.NotFoundError: No session factory registered for the given session options: {target: "local" config: } Registered factories are {DIRECT_SESSION, GRPC_SESSION}. 

相反,同樣的模型將訓練時train_op爲 「手動」 之稱:

有沒有人有一個想法在哪裏開始調試?

謝謝 菲利普

回答

1

它看起來像這條線是造成問題:

master=FLAGS.master, 

從錯誤信息,似乎修身正試圖創建一個會話sess = tf.Session("local"),這是不一個有效的會話目標。嘗試在運行腳本時傳遞標誌--master="",或在調用slim.learning.train()時明確設置master=""

+0

太棒了。這樣可行。謝謝!我認爲master =「local」是默認的。但是,這似乎只適用於你在一個不同的環境,如在某家公司的實習生:-) – Phil

+0

是的,這絕對是一個錯誤:-)。 'master =「local」'從來沒有在開源版本中工作! – mrry