tensorflow / tensorflow/privacy
Request the Support of Callback Feature in Keras
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2k
- Forks
- 477
- Avg merge
- 22h 12m
- Merged PRs (30d)
- 1
Description
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. :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with mnist_dpsgd_tutorial_keras.py, especially the model.fit call around the reported line 148, and reproduce the failure using callbacks=[lr_schedule]. Trace the callback error about the optimizer lacking an "lr" attribute; done means the MNIST Keras tutorial supports the requested learning-rate callback without raising that error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- keras, python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100