To get help from the community, check out our Google group.
0.10.2
any
If a user creates a custom layer, such as the one in this example, then any model which includes this layer is no longer serializable.
Hi, I am looking for this feature too.
Just checked the code, how about do the following to allow pass a customObjects dict to loadModel?
What we need to do is:
customObjects to loadModel src/models.ts#L187 and loadModelInternal src/exports.ts#L158customObjects to src/models.ts#L202@tafsiri Will look into incorporating an example such as https://codepen.io/caisq/pen/jdBgwB in the new documentation.
@tafsiri Will look into incorporating an example such as https://codepen.io/caisq/pen/jdBgwB in the new documentation.
Uncaught (in promise) TypeError: tf.loadModel is not a function
at main (pen.js:93)
just update tf.loadModel -> tf.loadLayersModel.
@tafsiri, could you please tell me whether writing a custom layer implementation still does not work with the converted keras model? What will it take to make it work?
In other words, is the comment still valid for something like EfficientNet converted from the Keras implementation with custom layers?
@sdll By converted keras model, do you mean converting a model with a (pytnon) lambda layer? If so there is an issue related to that here. I'm not sure how possible it will be to do that but pinging the folks assigned on that issue might be a good way to get an update.
This issue was for saving a model written in JavaScript with a custom layer. Is that what you were thinking of?
@tafsiri, sorry for the confusion. In my case, custom layers subclassed from python keras.layers did not convert to a working model, which seems obvious in retrospect, since the converter does not translate layer specifications. I was thinking of writing the missing infra in tf.js, but the solution turned out to be simpler: porting the Keras implementation to tf.keras and converting to tf.SavedModel instead of keras hdf5. Thanks for your support!
Hi, we use custom layers and “add loss” extensively and would like to switch from python to JavaScript. Can we save JavaScript models with custom layers?
@bionicles yes you can use and also there is a detailed explanation from @caisq here , will be closing this and track the same in #674.