Keras: does save_model save all optimizer weights?

Suppose you have a Keras model with an optimizer like Adam that you save through save_model. If you download the model again using load_model, will it really load ALL optimizer parameters + weights?


Based on the code save_model( Link ), Keras saves the optimizer configuration:

f.attrs['training_config'] = json.dumps({
                             'optimizer_config': {
                             'class_name': model.optimizer.__class__.__name__,
                             'config': model.optimizer.get_config()},

which, for example, for Adam ( Link ) is as follows:

def get_config(self):
    config = {'lr': float(K.get_value(self.lr)),
              'beta_1': float(K.get_value(self.beta_1)),
              'beta_2': float(K.get_value(self.beta_2)),
              'decay': float(K.get_value(self.decay)),
              'epsilon': self.epsilon}

Thus, this only saves the basic parameters, but does not have the weight of an optimizer for each variable.

, config save_model, , (). , , .


, load_model, 100% , ? . SGD , ?

, , , save/load_model?

+4

Source: https://habr.com/ru/post/1690440/


All Articles