Closed liuyxpp closed 5 months ago
Just test that the file can be loaded in Julia 1.9.3. And resave it to jld2 file which still can not be loaded in Julia 1.10.0-rc1. There should be some tricky change of the Xoshiro in Julia 1.10.0-rc1.
I think this is due to
The error message already suggests what to define to fix it, so I think I will close this for now.
The error message already suggests what to define to fix it, so I think I will close this for now.
Can you explicitly explain how to do that?
You can define:
# Old xoshiro had 3 fields , new has 4 but has a constructor given only the first three fields.
JLD2.rconvert(::Type{Xoshiro}, nt) = Xoshiro(nt...)
In your case that should already be enough.
In my test case, I generated the file as jldsave("rng.jld2"; rng=Xoshiro(42)
on julia 1.9
Then
julia> load("rng.jld2")
┌ Warning: saved type Xoshiro is missing field s4 in workspace type; reconstructing
└ @ JLD2 ~/.julia/dev/JLD2.jl/src/data/reconstructing_datatypes.jl:207
Dict{String, Any} with 1 entry:
"rng" => Reconstruct@Xoshiro((0xa379de7eeeb2a4e8, 0x953dccb6b532b3af, 0xf597b8ff8cfd652a, 0xccd7337c571680d1))
julia> load("rng.jld2"; typemap=Dict("Random.Xoshiro"=>JLD2.Upgrade(Xoshiro)))
Dict{String, Any} with 1 entry:
"rng" => Xoshiro(0xa379de7eeeb2a4e8, 0x953dccb6b532b3af, 0xf597b8ff8cfd652a, 0xccd7337c571680d1, 0xc90c4a0730db3f7e)
The JLD2 file is a Lux.jl model (ps + st) with many Random.Xoshiro instances, which is saved in Julia 1.10.0-beta3. When I tried to load it in Julia 1.10.0-rc1, the error mesasge is