machine learning - Does training tensorflow model automatically save parameters? -
i ran demo tensorflow mnist model(in models/image/mnist) by
python -m tensorflow.models.image.mnist.convolutional
does mean after model completes training, parameters/weights automatically stored on secondary storage? or have edit code include "saver" functions parameters stored?
no not automatically saved. in memory. have explicitly add saver function store model secondary storage.
first create saver operation
saver = tf.train.saver(tf.all_variables())
then want save model progresses in train process, after n steps. intermediate steps commonly named "checkpoints".
# save model checkpoint periodically. if step % 1000 == 0: checkpoint_path = os.path.join('.train_dir', 'model.ckpt') saver.save(sess, checkpoint_path)
then can restore model checkpoint:
saver.restore(sess, model_checkpoint_path)
take @ tensorflow.models.image.cifar10
concrete example
Comments
Post a Comment