Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom layer calling in Tensorflow.js loadLayersModel() #3410

Closed
stevencheng1220 opened this issue Jun 8, 2020 · 4 comments
Closed

Custom layer calling in Tensorflow.js loadLayersModel() #3410

stevencheng1220 opened this issue Jun 8, 2020 · 4 comments

Comments

@stevencheng1220
Copy link

return loadLayersModelFromIOHandler(pathOrIOHandler, undefined, options);

It seems like there is already functionality for custom layer calling in Tensorflow.js's loadLayersModel() method. However, it seems like behind the scenes as seen from the function LoadLayersModelFromIOHandler(pathOrIOHandler, undefined, options), the input for custom objects is set as "undefined". Is this an intentional design?

Just linking the repo contributors here:
@pyu10055 @nsthorat @dsmilkov @caisq

@rthadur rthadur added comp:core type:support user support questions labels Jun 8, 2020
@pyu10055
Copy link
Collaborator

Hi @stevencheng1220 I think that is a placeholder for a great feature to add.

If you have custom layers, I think currently there is a work around for that:

  1. save the keras model as TF saved model format
  2. use tfjs converter to convert saved model to tfjs_graph_model.

@gaikwadrahul8
Copy link
Contributor

Hi, @stevencheng1220

Apologize for the delayed response and we have updated our official documentation w.r.t tf.loadLayersModel and This method is applicable to:

Models created with the tf.layers.*, tf.sequential(), and tf.model() APIs of TensorFlow.js and later saved with the tf.LayersModel.save() method.
Models converted from Keras or TensorFlow tf.keras using the tensorflowjs_converter.
This mode is not applicable to TensorFlow SavedModels or their converted forms. For those models, use tf.loadGraphModel().

Please refer these comments Ref-1 and Ref-2, I hope it help you to resolve your issue and if not please help me with sample code with model and error log to replicate the issue from our end ? Thank you!

@google-ml-butler
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you.

@google-ml-butler
Copy link

Closing as stale. Please @mention us if this needs more attention.

@gaikwadrahul8 gaikwadrahul8 self-assigned this May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants