kotlindl icon indicating copy to clipboard operation
kotlindl copied to clipboard

Model save/load compatibility with Keras

Open mkaze opened this issue 4 years ago • 3 comments

@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.

mkaze avatar Jun 01 '21 12:06 mkaze

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

zaleslaw avatar Jun 01 '21 13:06 zaleslaw

I found two potentially useful projects with regards to writing h5

  • https://github.com/h5jan/h5jan-core
  • https://github.com/saddle/jhdf5

dosier avatar Jun 16 '21 10:06 dosier

P.S Read the Contributing Guidelines.

zaleslaw avatar Jun 16 '21 11:06 zaleslaw