-
Notifications
You must be signed in to change notification settings - Fork 74k
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
Cant save keras RNN model with custom cell whose call function accepts constants #43369
Comments
I know saving using the h5 format will work, it is stated in the original bug description. But saving using the SavedModel has one big advantage, from your link:
In the mean time, what would you suggest be the best way of saving my custom layer? |
I am experiencing the same problem. A CustomCell i created, takes constants as an argument to cal(), which results in an error when trying to save (in the standard tf format). Conversely, it is possible to save the CustomCell if I remove the constants-argument. Similar to @juulie, I want to save the execution graph in addition the the weights. Using eager execution and the debugger, it somehow loops through the CustomCell and at a certain iteration, the state-tuple is empty, and the constants-tuple contains a copy of the input-tuple...? Any way to save the computation graph, other then using the standard tf format? System information
|
Was able to reproduce your issue in TF 2.11, please find the gist here. Thanks! |
System information
Describe the current behavior
When creating an RNN model with custom cells that accept constants. saving the model with the default SavedModel format will raise a ValueError "RNN cell does not support constants". Using the h5 format does work
Describe the expected behavior
I dont expect the ValueError, since the call function does support the constants argument
Standalone code to reproduce the issue
I've re-used the custom cell sample from https://keras.io/guides/working_with_rnns/#rnns-with-listdict-inputs-or-nested-inputs
but just added the constants argument:
The text was updated successfully, but these errors were encountered: