Open stsievert opened 5 years ago
It looks like we'll have to adapt the logic in keras/engine/saving.py#L137-L184.
I know, of course, that the use case here is serialization between processes, but I wonder: how would this look as a data source for Intake, i.e., that the model itself is data. The the particular hdf file saved by Keras constitute a well-defined format?
the particular hdf file saved by Keras constitute a well-defined format?
I think it's a well-defined format. They have some tests to check the file can be loaded and easily read (i.e., they cover more than dumping/loading some binary file).
Mostly, the file produced by keras.save
also includes optimizer information. This issue is aimed at that.
So, two questions here:
get/from_config
and get/set_weights/gradients
. Do these suffice?cc @bnaul, who wrote the original implementation.
Seems reasonable to me to include the parameters of the optimizer. I don't recall why this wasn't part of the original implementation but maybe that wasn't part of what got saved to disk back then? It was originally written against a much older version of keras
.
I don't suppose you have any inclination to repeat your previous excellent work and extend this to include the optimizer if present, do you @bnaul ?
On Sun, Aug 19, 2018 at 8:03 PM, Brett Naul notifications@github.com wrote:
Seems reasonable to me to include the parameters of the optimizer. I don't recall why this wasn't part of the original implementation but maybe that wasn't part of what got saved to disk back then? It was originally written against a much older version of keras.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dask/distributed/issues/2183#issuecomment-414165554, or mute the thread https://github.com/notifications/unsubscribe-auth/AASszCYI-WV7XksEpGV_-brEjtCLWYoZks5uSfzGgaJpZM4V7hyh .
:)
On Sun, Aug 19, 2018 at 9:02 PM, Matthew Rocklin mrocklin@anaconda.com wrote:
I don't suppose you have any inclination to repeat your previous excellent work and extend this to include the optimizer if present, do you @bnaul ?
On Sun, Aug 19, 2018 at 8:03 PM, Brett Naul notifications@github.com wrote:
Seems reasonable to me to include the parameters of the optimizer. I don't recall why this wasn't part of the original implementation but maybe that wasn't part of what got saved to disk back then? It was originally written against a much older version of keras.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dask/distributed/issues/2183#issuecomment-414165554, or mute the thread https://github.com/notifications/unsubscribe-auth/AASszCYI-WV7XksEpGV_-brEjtCLWYoZks5uSfzGgaJpZM4V7hyh .
I've been out of the keras loop for a while now so I'm afraid I probably won't have time to get into this
In the Keras FAQ,
serialize_keras_model
serializes the first two points, the weights and architecture of the model. It does not serialize the optimizer or it's state.A brief example:
which raises a Runtime error because the model hasn't been compiled:
Here's the definition of
model_and_data
: