I want to run a code. It is written in Python3 using Tensorflow. I could run the code, but when the code was running, I tried to run another code with some changes in a separate Anaconda Prompt. Then I stopped the code. Now, when I try to run the similar code again without any changes, it gives me the following error:
AttributeError: 'str' object has no attribute 'decode'
The error refers to the tensorflow\python\keras package as follow:
hdf5_format.py. line 711, in load_weights_from_hdf5_group
original_keras_version = f.attrs['keras_version'].decode('utf8')
This is some parts of my code which rises the error:
self.encoder.load_weights(weights_file, by_name = True)
I closed the program and reopened it, but the error still exits.
Does anyone know how to solve it?
The problem was solved by uninstalling h5py and installing h5py==2.10.0 as below:
pip uninstall h5py
pip install h5py==2.10.0
If h5py>3, the code shows the error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With