kotlindl
kotlindl copied to clipboard
Model save/load compatibility with Keras
@zaleslaw, I was wondering if we are aiming for a two-way compatibility with Keras in terms of saving and loading of the models. In particular, should both of the following conditions satisfy?
- Models trained and saved with Keras could be fully loaded in KotlinDL.
- Models trained and saved with KotlinDL could be fully loaded in Keras.
Yes, but the first priority is the loading model from Keras for Transfer Learning purposes. It's an important and popular use case.
Also, we need a good way to save the model for KotlinDL needs (currently, there are a few ways, and one of the exports to Keras-like JSON format); it's the second point here.
It's a good idea to have full export/import with Keras in both directions, hope to return to this task and open a few tickets about that.
I worry that loading to Keras will not work fully due to issues with weights export (I could not find any library for h5 writing, only for reading) and some missed things in JSON but it could be fixed in the future.
I mark this ticket as "research" and suggest to continue discussion here
I found two potentially useful projects with regards to writing h5
- https://github.com/h5jan/h5jan-core
- https://github.com/saddle/jhdf5
P.S Read the Contributing Guidelines.