Open Hochinghao opened 3 years ago
I think this article will help you out. https://www.tensorflow.org/tutorials/keras/save_and_load
but it seens work for keras model but it is tensorflow model .
I believe you can use the principle here. you can use a costume callback for the purpose as well. try tracing these variables: self.weights self.biases I think it will help.
is there anyway to save the trained model?
you can add this to model:
def save_model(self):
saver = tf.train.Saver()
save_path = "meltpool_model.ckpt"
saver.save(self.sess, save_path)
print(f"Model saved at {save_path}")
def load_model(self):
saver = tf.train.Saver()
save_path = "meltpool_model.ckpt"
saver.restore(self.sess, save_path)
print(f"Model loaded from {save_path}")
To save the model you should call save_model after training. and when you want to use the saved model before the train call the load_model.
is there anyway to save the trained model?