Open jminsol opened 3 years ago
If you have find the best solution to save the model, please let me know!
@jminsol @HariniNarasimhan. You can both save the model or save the weights. In the case we want to save the weights (less memory usage):
# Include the epoch in the file name (uses `str.format`)
checkpoint_path = "training/cp-{epoch:04d}.ckpt"
checkpoint_dir = os.path.dirname(checkpoint_path)
# Create a callback that saves the model's weights every 5 epochs
cp_callback = tf.keras.callbacks.ModelCheckpoint(
filepath=checkpoint_path,
verbose=1,
save_weights_only=True,
save_freq=5*batch_size)
# Create a new model instance
model = create_model()
# Save the weights using the `checkpoint_path` format
model.save_weights(checkpoint_path.format(epoch=0))
# Train the model
model.fit(...)
# And we want to load the weights used
model = create_model()
model.load_weights(...)
For documentation here.
Hello, I am a student who just started to learn machine learning. Your codes were really helpful. I'd like save the codes and restore them later when there were different date sets. I am wondering how I can save the models and successfully restore them later?
Here is my code that I've worked on so far.
`
output_predict = minmax.inverse_transform(output_predict) deep_future = self.anchor(output_predict[:, 0], 0.3)