.h5 weights to pth weights

I have parameters of retinanet in the format of h5 and I want to convert it .pth file because when I try to load parameters as h5 file to pytorch, I get this error : UnpicklingError: invalid load key, ‘H’.

What can I do ?

I don’t think you can unpickle a hdf5 file, so you would need read it e.g. via h5py.File('mytestfile.hdf5', 'r') before trying to convert it to any other format.

I did lots of things but none of them works. I think pytorch needs to read h5 file like pth. I moved the whole project from torch to keras. It is kind of strange solution but works :smiley: