python - std::system_error after restoring model in Tensorflow -
i'm trying implement simple saver/restorer so: (copied tensorflow website)
saver:
import tensorflow tf # create variables. v1 = tf.get_variable("v1", shape=[3], initializer = tf.zeros_initializer) v2 = tf.get_variable("v2", shape=[5], initializer = tf.zeros_initializer) inc_v1 = v1.assign(v1+1) dec_v2 = v2.assign(v2-1) # add op initialize variables. init_op = tf.global_variables_initializer() # add ops save , restore variables. saver = tf.train.saver() # later, launch model, initialize variables, work, , save # variables disk. tf.session() sess: sess.run(init_op) # work model. inc_v1.op.run() dec_v2.op.run() # save variables disk. save_path = saver.save(sess, "/tmp/model.ckpt") print("model saved in file: %s" % save_path) restorer:
import tensorflow tf tf.reset_default_graph() # create variables. v1 = tf.get_variable("v1", shape=[3]) v2 = tf.get_variable("v2", shape=[5]) # add ops save , restore variables. saver = tf.train.saver() # later, launch model, use saver restore variables disk, , # work model. tf.session() sess: # restore variables disk. saver.restore(sess, "/tmp/model.ckpt") print("model restored.") # check values of variables print("v1 : %s" % v1.eval()) print("v2 : %s" % v2.eval()) it seems save model fine, when restoring gets stuck on line saver.restore(sess, "/tmp/model.ckpt") , end error message:
terminate called after throwing instance of 'std::system_error' what(): resource temporarily unavailable i don't see how can memory error running on work server has 100s of gb of memory.
python version 3.5, tensorflow version 1.2.1
Comments
Post a Comment