tensorflow / lattice

Lattice methods in TensorFlow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot save keras model with tensorflow lattice layers

devavratTomar opened this issue · comments

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

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?

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

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

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

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.

Fixed in 2.0.4.