savingload_weights_from_hdf5_group_by_namef layers File CUsersThinkAppDataLocalProgramsPythonPython36libsite-packageskerasenginesavingpy line 1262 in load_weights_from_hdf5_group_by_name original_
This error occurs when trying to load weights from an HDF5 file using the load_weights_from_hdf5_group_by_name function in Keras. The error message suggests that the attribute keras_version in the HDF5 file is of type str and does not have a decode method.
To fix this issue, you can modify the load_weights_from_hdf5_group_by_name function in the Keras source code. Locate the line that reads original_keras_version = f.attrs['keras_version'].decode('utf8') and change it to original_keras_version = str(f.attrs['keras_version']). This will convert the str attribute to a string before assigning it to original_keras_version.
After making this change, you can try loading the weights again
原文地址: https://www.cveoy.top/t/topic/iynK 著作权归作者所有。请勿转载和采集!