Is it possible to continue training from a specific epoch?

You can save weights after every epoch by specifying a callback:

weight_save_callback = ModelCheckpoint('/path/to/weights.{epoch:02d}-{val_loss:.2f}.hdf5', monitor='val_loss', verbose=0, save_best_only=False, mode='auto')
model.fit(X_train,y_train,batch_size=batch_size,nb_epoch=nb_epoch,callbacks=[weight_save_callback])

This will save the weights after every epoch. You can then load them with:

model = Sequential()
model.add(...)
model.load('path/to/weights.hf5')

Of course your model needs to be the same in both cases.


You can add the initial_epoch argument. This will allow you to continue training from a specific epoch.

Tags:

Keras