-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOC: LazyAdamOptimizer example #66
Conversation
cc @karmel . Do you mind giving this a once over? I'd like to have a small example in the first release branch. Going forward we'll strive for colab notebooks as well, and more interesting examples. |
@qlzh727 -- any chance you can take a look? I am unlikely to have time before the Dev Summit. |
Ack, I will take a quick look. |
Ah, sorry I forgot today is probably quite hectic. Probably doesn't need more than a glance its just MNIST with the LazyAdamOptimizer. I tested it and it converges fine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the change. Mostly just python style comments.
:return: Keras `Model` | ||
""" | ||
inputs = tf.keras.Input(shape=(784,), name='digits') | ||
net = tf.keras.layers.Dense(64, activation='relu', name='dense_1')(inputs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is just a sequential model, you can probably use keras.models.Sequential to get rid of "net". That said, this is purely optional, and depends on whether you want to show case the functional or sequential model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I have no real preference, but feel that the functional form is more familiar to other frameworks.
validation_data=(data['x_val'], data['y_val'])) | ||
|
||
# Evaluate the network | ||
print('\n# Evaluate on test data') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious why it need the leading '\n'. Alternatively you can use tf.logging, which will print with same format as other TF logs generated during training.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the small implementation details were mostly copied from this:
https://github.com/tensorflow/docs/blob/master/site/en/r2/guide/keras/training_and_evaluation.ipynb
@qlzh727 thanks for the review! |
* DOC: optimizer example
Simple example using LazyAdamOptimizer tested after installing the dev pip package. After we publish a 0.1 release we can install it in colab and have interactive examples.