-
Notifications
You must be signed in to change notification settings - Fork 19.4k
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
load_model fails with "TypeError: arg 5 (closure) must be tuple" for models with Lambda layer #6211
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed. |
I am having a similar issue and tried to revert my pip installation back to 2.0.0, which still didn't make it work.. |
You'll have to manually make the code changes detailed above. Seems like @fchollet removed that section of the code because there weren't any unit tests. I might have some time in the future to familiarise myself with that section of the codebase and submit a PR, but that may be a while. In the meantime, the workaround I've found is to use |
@nigeljyng thanks for the work on this! Hm, so to be clear the current state is that we can't To be clear, the changes you're suggesting are to bring back |
@adalca No, I'm suggesting to bring back |
@nigeljyng thanks for the quick clarification. That makes a lot more sense! had misread your original comment. Thank you. |
This is still an issue in 2.0.8. Is my understanding correct that all that needs to happen is to add unit tests to this PR? How many do we need and exactly what do they need to cover? Would a model consisting only of a simple lambda layer saved, then loaded suffice? |
This indeed still appears to be an issue. Is someone working on this? @gw0 ? |
@hgaiser Unfortunately, no. At the moment I am doing some embedded programming for IoT. I also understand it, that only unit tests for verifying that |
To add to this, it's not just re-adding the code that's necessary, as my network is failing in dropout reconstruction.
The inputs causing the problem:
(But, removing recurrent dropout does allow model loading) |
Seeing this on |
@dvaldivia This PR should provide working model loads with Lambda layers. |
@soaxelbrooke the change did work for me |
Got the same error... |
When loading a model with a
Lambda
layer, Keras throws the errorTypeError: arg 5 (closure) must be tuple
. But after implementing the changes outlined in explosion/spaCy#767 (comment),load_model()
works as expected.The issue is with edae178#diff-56dc3cc42e1732fdb3a3c2c3c8efa32a. This commit removes
func_reconstruct_closure()
, but when I added that back in and called it infunc_load()
, it works.Is there a fix planned for this?
Check that you are up-to-date with the master branch of Keras. You can update with:
pip install git+git://github.com/fchollet/keras.git --upgrade --no-deps
If running on TensorFlow, check that you are up-to-date with the latest version. The installation instructions can be found here.
If running on Theano, check that you are up-to-date with the master branch of Theano. You can update with:
pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps
Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short).
The text was updated successfully, but these errors were encountered: