I have created a custom layer for a model in keras but when I try to save it, keras throws this error:
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File
"h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5o.pyx", line 202, in h5py.h5o.link
RuntimeError: Unable to create link (name already exists)
As I searched the above error, I found out that there are a couple of duplicate weight names inside my model
eg:
8 transformer_test/attention_test/dense/kernel:0
9 transformer_test/attention_test/dense/bias:0
10 transformer_test/attention_test/dense/kernel:0
11 transformer_test/attention_test/dense/bias:0
The question is: What is causing those duplicate weight names? How could I prevent this from happening?
Here is the model's code. Thanks a lot in advance for your help! :)
Christos