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
customObject from loadLayersModel() is passed as undefined to loadLayersModelFromIOHandler() #8179
Comments
Hi, @Gruhit13 Thank you for bringing this issue to our attention and to confirm, did you try to re-register the custom layer class before attempting to load the model using
Could you please help us with your Github repo with complete steps or code snippet along with your model file to replicate the same behavior from our end to investigate this issue further ? Thank you for your cooperation and patience. |
I have created a TensorFlow model consisting of a custom layer saved in tensorflowjs format. Now when I try loading the model using
tf.loadLayersModel()
it does not load stating that the custom layer is not serialized but is serialized using thetf.serialization.registerClass()
method.To overcome this I passed a custom object to the loadLayersModel() method but in git, I found out that the customObject is by default passed as undefined irrespective of being passed to
loadLayersModelFromIOHandler()
method which does further handling of model loading or not which seems to be a bug as it would never allow loading a custom object.It would be better if it gets resolved allowing the user the flexibility to pass custom objects or if there is an alternative to this then mention it along with the right tutorial or steps for using the alternative solution.
Error Details:
loadLayersModel()
is at line 248 in https://github.com/tensorflow/tfjs/blob/tfjs-v4.17.0/tfjs-layers/src/models.ts#L248-L270loadLayersModelFromIOHandler()
is at line 282 https://github.com/tensorflow/tfjs/blob/tfjs-v4.17.0/tfjs-layers/src/models.ts#L248-L270The text was updated successfully, but these errors were encountered: