privacy icon indicating copy to clipboard operation
privacy copied to clipboard

Request the Support of Callback Feature in Keras

Open Sanghyun-Hong opened this issue 5 years ago • 0 comments

Hi,

The Keras tutorial (with the MNIST dataset) looks not compatible with the "callbacks" features. I added the 'callbacks=[lr_schedule]' as an argument of the 'model.fit' function, and it shows the errors below:

Traceback (most recent call last):
  File "mnist_dpsgd_tutorial_keras.py", line 158, in <module>
    app.run(main)
  File "<home>/python3.7/site-packages/absl/app.py", line 300, in run
    _run_main(main, args)
  File "<home>/site-packages/absl/app.py", line 251, in _run_main
    sys.exit(main(argv))
  File "mnist_dpsgd_tutorial_keras.py", line 148, in main
    verbose=2)
  File "<home>/python3.7/site-packages/tensorflow/python/keras/engine/training.py", line 780, in fit
    steps_name='steps_per_epoch')
  File "<home>/python3.7/site-packages/tensorflow/python/keras/engine/training_arrays.py", line 252, in model_iteration
    callbacks.on_epoch_begin(epoch, epoch_logs)
  File "<home>/python3.7/site-packages/tensorflow/python/keras/callbacks.py", line 295, in on_epoch_begin
    callback.on_epoch_begin(epoch, logs)
  File "<home>/python3.7/site-packages/tensorflow/python/keras/callbacks.py", line 1351, in on_epoch_begin
    raise ValueError('Optimizer must have a "lr" attribute.')
ValueError: Optimizer must have a "lr" attribute.

I used the "callbacks" argument to adjust the learning rate in training; I hope this will be supported in the future. :)

Sanghyun-Hong avatar Aug 11 '19 07:08 Sanghyun-Hong