Keras: Model save error: RuntimeError: Unable to create link (Name already exists)

Created on 3 Jun 2017  路  3Comments  路  Source: keras-team/keras

I just recently update keras, and run my old codes. The trained CNN model cannot be saved for some reason, which makes me has to turn back to the old keras at this moment.

 model.save(os.path.join(modelDir,'M48DA_ACDCRT.h5'),overwrite=True)
 Traceback (most recent call last):

 File "<ipython-input-33-a3a0461bebd2>", line 2, in <module>
model.save(os.path.join(modelDir,'M48DA_ACDCRT.h5'),overwrite=True)

  File "C:\Users\YL\Anaconda2\lib\site-packages\keras\engine\topology.py", line 2472, in save
save_model(self, filepath, overwrite, include_optimizer)

 File "C:\Users\YL\Anaconda2\lib\site-packages\keras\models.py", line 160, in save_model
dtype=val.dtype)

 File "C:\Users\YL\Anaconda2\lib\site-packages\h5py\_hl\group.py", line 111, in create_dataset
self[name] = dset

 File "h5py\_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (C:\Minonda\conda-bld\h5py_1490029245709\work\h5py\_objects.c:2867)

 File "h5py\_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (C:\Minonda\conda-bld\h5py_1490029245709\work\h5py\_objects.c:2825)

 File "C:\Users\YL\Anaconda2\lib\site-packages\h5py\_hl\group.py", line 276, in __setitem__
h5o.link(obj.id, self.id, name, lcpl=lcpl, lapl=self._lapl)

 File "h5py\_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (C:\Minonda\conda-bld\h5py_1490029245709\work\h5py\_objects.c:2867)

 File "h5py\_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (C:\Minonda\conda-bld\h5py_1490029245709\work\h5py\_objects.c:2825)

 File "h5py\h5o.pyx", line 202, in h5py.h5o.link (C:\Minonda\conda-bld\h5py_1490029245709\work\h5py\h5o.c:3789)

 RuntimeError: Unable to create link (Name already exists)
stale

Most helpful comment

I had the same issue after I applied a custom kernel regularizer to my model, but there is no problem using save_weights_only=True.

All 3 comments

I also get this problem. Sometimes I save a model and it works fine. Other times I get this error. Then later I run the same code - pretty sure I have not changed anything - and it saves fine again.

I had the same issue after I applied a custom kernel regularizer to my model, but there is no problem using save_weights_only=True.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fredtcaroli picture fredtcaroli  路  3Comments

nryant picture nryant  路  3Comments

MarkVdBergh picture MarkVdBergh  路  3Comments

farizrahman4u picture farizrahman4u  路  3Comments

amityaffliction picture amityaffliction  路  3Comments