keras can save model with tf.keras.models.save_model(), then restore model from tf.keras.models.load_model()
Here is a scenario,
- train a model
xstep. save the weights to checkpoint file.save_format='tf' - restore weight from checkpoint file, train another
xstep. - In tensorflow the starting global step of 2nd training is
x+1step, but in keras, it seems that it reset the global steps.
So far, this behavior cause me 2 problems.
- tensorboad is messing up, the 2 training run all start from step 0. tensorboard
- I need save some information into file during the training, the file name will depends on the train step, so I can save information for different steps, eg: weight_1000steps, weight_2000steps, etc. But since step will restart if I start a new training, so some old file will be overwritten.
How can I restore the training step/epoch from model file in keras? (tf.__version_ is '2.3.1')