Closed
Description
h5py released version 3.0.0 today and it causes this code to fail:
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/keras/saving/hdf5_format.py#L182
with error:
File "/databricks/python/lib/python3.7/site-packages/tensorflow_core/python/keras/saving/save.py", line 146, in load_model
return hdf5_format.load_model_from_hdf5(filepath, custom_objects, compile)
File "/databricks/python/lib/python3.7/site-packages/tensorflow_core/python/keras/saving/hdf5_format.py", line 166, in load_model_from_hdf5
model_config = json.loads(model_config.decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'
It looks like in version 2.1.0 the h5py
version is not pinned (it is pinned in master), which is causing the issue.
Activity
bhack commentedon Oct 30, 2020
I think it will be hard to expect a backport on 2.1.0.
danzafar commentedon Oct 30, 2020
the new h5py version just came out today: https://pypi.org/project/h5py/#history
Pinning it to a version <3.0.0 (or at least throwing a warning) is a very lightweight change with no risk.
bhack commentedon Oct 30, 2020
Yes but as you know generally we had very few patch releases (e.g. 2.1.x) so It Is quite hard to have wheels with these fixes on old versions.
danzafar commentedon Oct 31, 2020
@bhack I'm not going to add any more messages after this, but I think you can see based on these other issues the Keras API is essentially broken because h5py new release. I'm not sure why the version was not pinned as it is in master, but I strongly advise that you pin to h5py==2.10.0 this for all TF >= 2.1.
bhack commentedon Oct 31, 2020
/cc @mihaimaruseac @angerson there are many Dockerfile and other file not constrained.
yan12125 commentedon Nov 1, 2020
FWIW, I got a similar error message with h5py 3.0, and removing
.decode('utf-8')
fromtensorflow/python/keras/saving/hdf5_format.py
allows me to load Keras models as before.137 remaining items