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

Cannot save keras model with tensorflow lattice layers #47

Closed
devavratTomar opened this issue Apr 3, 2020 · 7 comments
Closed

Cannot save keras model with tensorflow lattice layers #47

devavratTomar opened this issue Apr 3, 2020 · 7 comments

Comments

@devavratTomar
Copy link

Saving the model having keras tfl layers creates the following problem.

`/usr/local/lib/python3.6/dist-packages/h5py/_hl/group.py in setitem(self, name, obj)
371
372 if isinstance(obj, HLObject):
--> 373 h5o.link(obj.id, self.id, name, lcpl=lcpl, lapl=self._lapl)
374
375 elif isinstance(obj, SoftLink):

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/h5o.pyx in h5py.h5o.link()

RuntimeError: Unable to create link (name already exists)`

The error is reproduced in the colab example here.
https://colab.research.google.com/drive/1tknejj9CtM27bHGktsZSTnvLvH3eCgG8

@wbakst
Copy link
Contributor

wbakst commented Apr 7, 2020

Hi!
I looked through the colab that you linked but couldn't find any instances of model saving. Could you post a screenshot or code snippet that is causing the error so I can try to reproduce it on my end and see what's going on?

@devavratTomar
Copy link
Author

Hi, Sorry I tried to debug the problem. The error is now reproducible on the colab.
image
image

@devavratTomar
Copy link
Author

I think the problem is that we give same name to the weights for all the instances of a layer. That's why h5 complains that the key is already present while saving the weights

@devavratTomar
Copy link
Author

@wbakst
Copy link
Contributor

wbakst commented Apr 10, 2020

This is indeed the case. Thank you for pointing this out! I am going to work on a fix now.

@mmilanifard
Copy link
Collaborator

Thanks for reporting the issue. Turns out we should not explicitly call the inner layer .build() during the build for the ParallelCombination layer. The next release will fix this issue.

@mmilanifard
Copy link
Collaborator

Fixed in 2.0.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants