-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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
fixed RemoteMonitor: Json to handle np.float32 and np.int32 types #9261
Conversation
Previously lr log had dtype numpy.float32 which throws JSON serializable error if used along with Remote monitor callback.
Fix this in the remote monitor callback directly. Changing the type of log values for all callbacks would break backwards compatibility (as seen in test failures for this PR). |
Noob at contribution here,Will fix it properly next time |
This reverts commit 6d3c3dd.
keras/callbacks.py
Outdated
if isinstance(v, (np.float16, np.float32)): | ||
send[k] = np.float64(v) | ||
elif isinstance(v, (np.int16, np.int32)): | ||
send[k] = np.int64(v) |
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.
if isinstance(v, np.ndarray):
send[k] = v.item()
else:
send[k] = v
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.
changed as per suggestion,Travis build failed due to some tensorflow installation error,I guess re-running the test will pass the PR
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.
LGTM
* 'master' of github.com:fchollet/keras: (57 commits) Minor README edit Speed up Travis tests (keras-team#9386) fix typo (keras-team#9391) Fix style issue in docstring Prepare 2.1.4 release. Fix activity regularizer + model composition test Corrected copyright years (keras-team#9375) Change default interpolation from nearest to bilinear. (keras-team#8849) a capsule cnn on cifar-10 (keras-team#9193) Enable us to use sklearn to do cv for functional api (keras-team#9320) Add support for stateful metrics. (keras-team#9253) The type of list keys was float (keras-team#9324) Fix mnist sklearn wrapper example (keras-team#9317) keras-team#9287 Fix most of the file-handle resource leaks. (keras-team#9309) Pass current learning rate to schedule() in LearningRateScheduler (keras-team#8865) Simplify with from six.moves import input (keras-team#9216) fixed RemoteMonitor: Json to handle np.float32 and np.int32 types (keras-team#9261) Update tweet length from 140 to 280 in docs Add `depthconv_conv2d` tests (keras-team#9225) Remove `force` option in progbar ...
Previously lr log had dtype numpy.float32 which throws JSON serializable error if used along with Remote monitor callback.Fixed it by casting it to float.