Вы можете сохранить историю тренировок следующим образом
hist = model.fit_generator(generator(features, labels, batch_size), samples_epoch=50, nb_epoch=10)
import pickle
with open('text3', 'wb') as f:
pickle.dump(hist.history, f)
Для сохранения истории тренировок после каждой эпохи
import pickle
hist1 = []
for _ in range(10):
hist = model.fit(X_train, y_train, epochs=1, batch_size=batch_size, validation_split=0.1)
hist1.append(hist.history)
with open('text3', 'wb') as f:
pickle.dump(hist1.history, f)
Для контрольно-пропускного пункта
filepath="weights.best.hdf5"
checkpoint = ModelCheckpoint(filepath, monitor='val_acc', verbose=1, save_best_only=True, mode='max')
callbacks_list = [checkpoint]
# Fit the model
model.fit(X, Y, validation_split=0.33, epochs=150, batch_size=10, callbacks=callbacks_list, verbose=0)