addons icon indicating copy to clipboard operation
addons copied to clipboard

Migrate register_keras_custom_object to core

Open markomernick opened this issue 7 years ago • 5 comments

TensorFlow version (you are using): All TensorFlow Addons version: head Is it in the tf.contrib (if so, where): N/A Are you willing to contribute it (yes/no): Yes Are you willing to maintain it going forward? (yes/no): Yes

Describe the feature and the current behavior/state. The Tensorflow Text team is interested in being able to register custom Keras serializables. This functionality is in addons at https://github.com/tensorflow/addons/blob/9c671021ba422be8077f3c3ff1d7765947388a0f/tensorflow_addons/utils/keras_utils.py#L23.

Will this change the current api? How? Yes. The internal implementation will handle custom names (not simply cls.name) and will require objects to have a package in their name (following https://github.com/tensorflow/community/pull/126/files#diff-91eaafbf41ccf12b96fe24b158113068). Users will still be able to invoke the decorator with no args, which will register the object under "Custom>cls.name". (This is an API break with the exisiting registration, unfortunately, but can be worked around by editing the global name dictionary if necessary.)

Any Other info. @seanpmorgan -- thoughts?

markomernick avatar Aug 22 '19 17:08 markomernick

Makes sense to me that this functionality be moved to core. Addons is still very much in beta so modifying the serialized object names is fine with us.

CC Keras team for inputs / see if they agree with this migration @fchollet @karmel

seanpmorgan avatar Aug 22 '19 20:08 seanpmorgan

+1 from the Keras side-- thanks, all--

karmel avatar Aug 22 '19 20:08 karmel

I suppose tf.keras.utils.register_keras_serializable is ready in keras now.

@seanpmorgan @karmel @markomernick Could anyone confirm this? Thank you!

WindQAQ avatar Oct 31 '19 20:10 WindQAQ

Yes, it is there, and will be released with 2.1: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/keras/utils/generic_utils.py#L134

karmel avatar Oct 31 '19 21:10 karmel

Closing this as a public API is now available in TF core. See https://github.com/tensorflow/addons/issues/664

seanpmorgan avatar Nov 05 '19 00:11 seanpmorgan