JLD/JLD2 and HDF5

Hello,

I noticed a few libraries were using the .jld2 extension which led me to discover https://github.com/JuliaIO/JLD2.jl which seems to be a native Julia implementation of HDF5.

Now I just want to ask, are .h5 files encoded any different from .jdl2 files? Is changing the extension good enough to load, say a machine learning model ending in .h5, or do I have to convert it?

1 Like

The short answer to your question is maybe. The JLD2 readme states

other HDF5 implementations supporting HDF5 File Format Specification Version 3.0 (i.e. libhdf5 1.10 or later) should be able to read the files that JLD2 produces

but the package was not designed as a pure julia implementation of the HDF5 library and as far as I know, the compatibility of the files it produces with other HDF5 implementations has not been heavily tested.

So I would say, you can experiment with loading files produced by JLD2 using a non julia HDF5 implementation but if you need a strong guarantee that your files will be compatible, I would go with HDF5.jl, which just wraps the HDF5 c library.

4 Likes