2

I have a rather weird problem. When I save my model with

model = load_model(name)

I get the following error:

File "/home/drbunsen/Downloads/code/neural/imageClassification.py", line 52, in <module>
model = ms.loadModel("fashion")
File "/home/drbunsen/Downloads/code/neural/modelSaver.py", line 22, in loadModel
model = load_model(name)
File "/home/drbunsen/.local/lib/python3.7/site-packages/keras/engine/saving.py", line 492, in load_wrapper
return load_function(*args, **kwargs)
File "/home/drbunsen/.local/lib/python3.7/site-packages/keras/engine/saving.py", line 584, in load_model
model = _deserialize_model(h5dict, custom_objects, compile)
File "/home/drbunsen/.local/lib/python3.7/site-packages/keras/engine/saving.py", line 273, in _deserialize_model
model_config = json.loads(model_config.decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'

I am just following examples I found here and on the internet. Can anyone shed some light on this? Thanks in advance.

Debian stable
Keras 2.3.0
Python 3.7.3
Tensor2.0.0-beta1

Dr_Bunsen
  • 125
  • 1
  • 4
  • 1
    What is the version of h5py? `import h5py; print(h5py.__version__)`. And consider to upgrade keras and tensorflow. – Kaveh Jul 30 '21 at 08:46
  • @Kaveh my pip3 only goes to those version :'( Maybe a Debian thing. But the h5py worked. Thanks. – Dr_Bunsen Jul 30 '21 at 09:21
  • This issue has been asked many many times here, please search in the site before asking, as the answer might be already here. – Dr. Snoopy Jul 30 '21 at 10:44
  • I searched and read the first 7 results, which had all to do with other things. – Dr_Bunsen Jul 30 '21 at 10:56

1 Answers1

1

pip/pip3 install h5py==2.10.0 should solve the problem; also as @Kaveh mentioned consider upgrading to a bigger version of TF+Keras.

Timbus Calin
  • 13,809
  • 5
  • 41
  • 59