Loading models using HDF5 in R

I am working with TensorFlow and Keras in R. I have already trained a neural network and model was exported in HDF5 format.

I save some models with this command:

    name1 = paste0("/projects/apog/work/input/test/","M",p,".hdf5")
    save_model_hdf5(Best_model, name1)

Now, I am loading one of them in another script with this command

M50 = load_model_hdf5("path/M9050.hdf5", custom_objects = NULL, compile = TRUE)

but I get this error:
Error in py_call_impl(callable, dots$args, dots$keywords) :
AttributeError: 'str' object has no attribute 'decode'

How can I fix it?

Thanks in advance

While it's hard to know for sure without a reproducible example, it seems like this may be related to your h5py install. What version of h5py do you have installed? If greater than 2.10.0, re-running keras::install_keras() should downgrade your h5py for you. :slight_smile:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.