1

I used LearningRateScheduler for my model training. I want to save learning rates on each epoch in CSV file (or other document files).
Is there any way to save those learning rates using callbacks?

AIFahim
  • 273
  • 1
  • 3
  • 15

1 Answers1

4

You may write a Custom Callback and save the LR in a file.
You will get it by - self.model.optimizer.learning_rate
Custom Callback - Keras docs

class CustomCallback(keras.callbacks.Callback):
def on_epoch_end(self, epoch, logs=None):

    print("LR - {}".format(self.model.optimizer.learning_rate))

my_callbacks = [ CustomCallback() ]

LR - <tf.Variable 'Adam/learning_rate:0' shape=() dtype=float32, numpy=0.001>

10xAI
  • 5,584
  • 2
  • 8
  • 24