HDF5File cannot read files written by keras/tensorflow
I have just tried to train a model with keras/tensorflow, where I wanted to add some information to the HDF5 file. Unfortunately, an exception is raised when I try to open the file model.hdf5:
>>> import bob.io.base
>>> h = bob.io.base.HDF5File("model.hdf5")
RuntimeError: HDF5File - hdf5 constructor: C++ exception caught: 'empty HDF5 dataset'
In some cases (which I cannot reproduce here), I even get a Segmentation fault
crashing the Python console.
Note that the file is perfectly valid, you can open it with hdfview
and h5py
:
>>> import h5py
>>> h = h5py.File("model.hdf5")
>>> list(h.keys())
['model_weights', 'optimizer_weights']
I am not sure, what causes this issue. I haven't dug deeper into the code.