-1

My Linux terminal screenshot here

# the error entry in linux terminal screenshot            
if FLAGS.validation_db:
      val_model.start_queue_runners(sess)
      Validation(sess, val_model, 0)

#the call func above val_model
def start_queue_runners(self, sess):
    logging.info('Starting queue runners (%s)', self.stage)
    # Distinguish the queue runner collection (for easily obtaining them by 
    collection key)
    queue_runners = tf.get_collection(tf.GraphKeys.QUEUE_RUNNERS, 
    scope=self.stage+'.*')
    for qr in queue_runners:
        if self.stage in qr.name:
            tf.add_to_collection(digits.GraphKeys.QUEUE_RUNNERS, qr)

    self.queue_coord = tf.train.Coordinator()
    self.queue_threads = tf.train.start_queue_runners(sess=sess, 
    coord=self.queue_coord,

    collection=digits.GraphKeys.QUEUE_RUNNERS)
    logging.info('Queue runners started (%s)', self.stage)

what happend in my linux-terminal,where is need to modify? i find some answer about it in stackoverflow,but its not sut me

the specific error under:

2017-12-19 05:49:34 [INFO] Starting queue runners (val)
Traceback (most recent call last):
File "/root/digits/digits/tools/tensorflow/main.py", line 627, in main
val_model.start_queue_runners(sess)
File "/root/digits/digits/tools/tensorflow/model.py", line 208, in 
start_queue_runners
tf.add_to_collection(digits.GraphKeys.QUEUE_RUNNERS, qr)
File "/usr/local/lib/python2.7/dist-
packages/tensorflow/python/framework/ops.py", line 4
248, in add_to_collection    get_default_graph().add_to_collection(name, 
value)
File "/usr/local/lib/python2.7/dist-
packages/tensorflow/python/framework/ops.py", line 2
792, in add_to_collection    self._check_not_finalized()
File "/usr/local/lib/python2.7/dist-
packages/tensorflow/python/framework/ops.py", line 2
181, in _check_not_finalized    raise RuntimeError("Graph is finalized and 
cannot be modified.")
RuntimeError: Graph is finalized and cannot be modified.
Adamanter
  • 11
  • 4

1 Answers1

0

You do not need to modify the graph to start queue runners. It's not immediately clear what you are trying to do here, but the following code is equivalent and does not modify the graph:

def start_queue_runners(self, sess):
    logging.info('Starting queue runners (%s)', self.stage)

    queue_runners = tf.get_collection(tf.GraphKeys.QUEUE_RUNNERS, 
                                      scope=self.stage+'.*')

    self.queue_coord = tf.train.Coordinator()

    # Start the queue runner threads directly without adding them to a collection.
    for qr in queue_runners:
        if self.stage in qr.name:
            qr.create_threads(sess, coord=self.queue_coord)

    logging.info('Queue runners started (%s)', self.stage)
mrry
  • 125,488
  • 26
  • 399
  • 400
  • thx,I dont want to modify the default Graph.I changed the digits-tf single machine to multi machine for distributed tensorflow,use the method sv = tf.train.Supervisor(),with sv.prepare_or_wait_for_session(server.target) as sess:,but nvidia-digits single machine used the method sess = tf.Session(),and after that in single ,have the method val_model.start_queue_runners(sess) Validation(sess, val_model, 0),so,i changed the single to distributed use supervisor() and (with sv.prepare_or_wait_for_session(server.target) as sess:),error is show,so i should modify all the structure about sess? – Adamanter Dec 20 '17 at 01:44
  • sorry ,i am a novice,Should i restructure the single machine tensorflow code of NVIDIA DIGITS to changed to distributed tensorflow? or modify the main tf code in digits about tf.session() as sess to MonitoredTrainingSession() as sess directly? I think that the distributed tf scripts in tensorflow.org is too simple to achieve a little complex enviroment. – Adamanter Dec 20 '17 at 02:05