+-
ValueError: Unable to create group (name already exists)

问题描述:

在tensorflow2.0.0下保存模型出现的bug,

 File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/saving/hdf5_format.py", line 103, in save_model_to_hdf5
    save_weights_to_hdf5_group(model_weights_group, model_layers)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/saving/hdf5_format.py", line 619, in save_weights_to_hdf5_group
    g = f.create_group(layer.name)
  File "/usr/local/lib/python3.6/dist-packages/h5py/_hl/group.py", line 68, in create_group
    gid = h5g.create(self.id, name, lcpl=lcpl, gcpl=gcpl)
  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/h5g.pyx", line 161, in h5py.h5g.create
ValueError: Unable to create group (name already exists)

解决方法

参考此链接 ,修改模型后缀为.tf/后者升级tf版本为2.0.0以上。采用修改模型后缀为.tf暂时解决。