I am currently using the TensorFlow source to save and restore the trained NN model weights:
# Save the weights
model.save_weights('./checkpoints/my_checkpoint')
# Create a new model instance
model = create_model()
# Restore the weights
model.load_weights('./checkpoints/my_checkpoint')
I am also familiar with checkpoints during training, but my question is:
Can we save the model/weights locally or globally while we are training the model instead of saving it to the file?
I am using something like grid search but I have a loop that in each iteration, I am training my model partially on some portion of the dataset and then save the trained/learned weights and continue to train/learn on another set of the dataset?
sample pseudo-code of my work:
for i in range(1,10):
- use dataset A1 for training
- train model on dataset A1
- test on the testing dataset X
- save model weights
- restore model weights
- now use dataset A2
- run model on trained weights to see initial accuracy
- retrain the model on dataset A2 and keep previously saved weights
- save model weights
end
I have already looked into the other post like this, but it's not answering my question.