-
Notifications
You must be signed in to change notification settings - Fork 19.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error while loading saved model #14265
Comments
I had the same issue and was able to fix this by setting Note: The h5py file I tried to load was wirtten with h5py version |
The |
Thanks Stephan. I was able to fix it by setting to a lower h5py version. |
hey, I have the same issue, can you tell me what command did you use in command prompt to set the h5py to lower versions? |
Depends on how you installed keras in the first place. Typically it is done via pip, so the command to downgrade is: |
Summary: See keras-team/keras#14265 Ref T29519 TF1.15 Only Test Plan: CI Reviewers: hakons, jakeh, jackh, vladimirm, markf, alfiee, #tensorflow, #framework_ip_review_-_any_oss_or_third-party_code_use_has_been_approved Reviewed By: jakeh, #tensorflow, #framework_ip_review_-_any_oss_or_third-party_code_use_has_been_approved Maniphest Tasks: T29519 Differential Revision: https://phabricator.sourcevertex.net/D35262
Summary: See keras-team/keras#14265 Ref T29519 TF2.1 Only Test Plan: CI Reviewers: jakeh, hakons, alfiee, vladimirm, markf, jackh, #tensorflow, #framework_ip_review_-_any_oss_or_third-party_code_use_has_been_approved Reviewed By: jakeh, #tensorflow, #framework_ip_review_-_any_oss_or_third-party_code_use_has_been_approved Maniphest Tasks: T29519 Differential Revision: https://phabricator.sourcevertex.net/D35263
force h5py version per keras-team/keras#14265
See keras-team/keras#14265 for more details.
The solution for me was not only to downgrade |
it works for me!
it works for me! |
Has anyone got this solution to work on M1? I'm not able to downgrade h5py. |
Solution: |
I am using Keras 2.2.4 with Tensorflow 1.14.0, Python 3.6.12. While loading model from architecture and json file as show below, I am getting error given below. Please help.
with open(model_architecture_file, 'r') as f: model = model_from_json(f.read()) model.load_weights(model_weights_file)
Stacktrace:
File "/home/hadoop/run_inference.py", line 58, in
model.load_weights(model_weights_file) ##Issue here!
File "/usr/local/lib64/python3.6/site-packages/keras/engine/saving.py", line 458, in load_wrapper
return load_function(*args, **kwargs)
File "/usr/local/lib64/python3.6/site-packages/keras/engine/network.py", line 1217, in load_weights
f, self.layers, reshape=reshape)
File "/usr/local/lib64/python3.6/site-packages/keras/engine/saving.py", line 1145, in load_weights_from_hdf5_group
original_keras_version = f.attrs['keras_version'].decode('utf8')
AttributeError: 'str' object has no attribute 'decode'
The text was updated successfully, but these errors were encountered: