Чтобы сохранить модель вы можете сделать так:
model_checkpoint = 'model.chkpt'
# Create the model
...
...
with tf.Session() as sess:
sess.run(tf.initialize_all_variables())
# Create a saver so we can save and load the model as we train it
tf_saver = tf.train.Saver(tf.all_variables())
# (Optionally) do some training of the model
...
...
tf_saver.save(sess, model_checkpoint)
Я предполагаю, что вы уже сделали это, так как вы получили три файла. Если вы хотите, чтобы загрузить модель в другом классе, вы можете сделать это следующим образом:
# The same file as we saved earlier
model_checkpoint = 'model.chkpt'
# Create the SAME model as before
...
...
with tf.Session() as sess:
# Restore the model
tf_saver = tf.train.Saver()
tf_saver.restore(sess, model_checkpoint)
# Now your model is loaded with the same values as when you saved,
# and you can do prediction or continue training
спасибо. Я получил сообщение об ошибке: ValueError: нет переменных для сохранения –
Получаете ли вы ошибку при попытке восстановить модель или при попытке ее сохранить? –
, когда я пытаюсь его восстановить .. –