Hi,
I have saved the chain that generated using Turing package as below:
using JLD2, FileIO
using Turing
# Set the true probability of heads in a coin.
p_true = 0.5
# Iterate from having seen 0 observations to 100 observations.
Ns = 0:100;
# Draw data from a Bernoulli distribution, i.e. draw heads or tails.
Random.seed!(12)
data = rand(Bernoulli(p_true), last(Ns))
# g_data = CuArray(data)
# Declare our Turing model.
@model coinflip(y) = begin
# Our prior belief about the probability of heads in a coin.
p ~ Beta(1, 1)
# The number of observations.
N = length(y)
for n in 1:N
# Heads or tails of a coin are drawn from a Bernoulli distribution.
y[n] ~ Bernoulli(p)
end
end;
# Settings of the Hamiltonian Monte Carlo (HMC) sampler.
# iterations = 1000
ϵ = 0.05
Ď„ = 10
iterations = 1000
# Start sampling.
chain = sample(coinflip(data), HMC(ϵ, τ), iterations);
@save "data\\test.jld2" chain
After that I cleared the chain and tried to load as below:
chain = 0
@load "data\\test.jld2" chain
But I got error as below:
ERROR: UndefRefError: access to undefined reference
Stacktrace:
[1] getindex at .\array.jl:744 [inlined]
[2] #86 at .\none:0 [inlined]
[3] iterate at .\generator.jl:47 [inlined]
[4] collect(::Base.Generator{UnitRange{Int64},MCMCChains.var"#86#87"{Array{ChainDataFrame,N} where N,Array{ChainDataFrame,1}}}) at .\array.jl:622
[5] convert at C:\Users\z5168736\.julia\packages\MCMCChains\YabhG\src\summarize.jl:92 [inlined]
[6] construct_array(::JLD2.MmapIO, ::Type{ChainDataFrame}, ::Int64) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\datasets.jl:291
[7] read_array(::JLD2.JLDFile{JLD2.MmapIO}, ::JLD2.ReadDataspace, ::JLD2.ReadRepresentation{ChainDataFrame,JLD2.RelOffset}, ::Int64, ::UInt16, ::JLD2.RelOffset, ::Array{JLD2.ReadAttribute,1}) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\datasets.jl:316
[8] read_data(::JLD2.JLDFile{JLD2.MmapIO}, ::JLD2.ReadRepresentation{Any,JLD2.RelOffset}, ::Array{JLD2.ReadAttribute,1}) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\datasets.jl:198
[9] macro expansion at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\datasets.jl:156 [inlined]
[10] macro expansion at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\datatypes.jl:76 [inlined]
[11] read_data(::JLD2.JLDFile{JLD2.MmapIO}, ::JLD2.ReadDataspace, ::UInt8, ::Int64, ::Int64, ::Int64, ::UInt16, ::JLD2.RelOffset, ::Array{JLD2.ReadAttribute,1}) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\datasets.jl:152
[12] load_dataset(::JLD2.JLDFile{JLD2.MmapIO}, ::JLD2.RelOffset) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\datasets.jl:92
[13] jlconvert at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\data.jl:674 [inlined]
[14] macro expansion at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\data.jl:1322 [inlined]
[15] jlconvert(::JLD2.ReadRepresentation{Tuple{UInt64,Array{ChainDataFrame,1}},JLD2.OnDiskRepresentation{(0, 8),Tuple{UInt64,Array{ChainDataFrame,1}},Tuple{UInt64,JLD2.RelOffset}}()}, ::JLD2.JLDFile{JLD2.MmapIO}, ::Ptr{Nothing}, ::JLD2.RelOffset) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\data.jl:1269
[16] read_data(::JLD2.JLDFile{JLD2.MmapIO}, ::JLD2.ReadRepresentation{Tuple{UInt64,Array{ChainDataFrame,1}},JLD2.OnDiskRepresentation{(0, 8),Tuple{UInt64,Array{ChainDataFrame,1}},Tuple{UInt64,JLD2.RelOffset}}()}, ::Array{JLD2.ReadAttribute,1}) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\dataio.jl:37
[17] read_data(::JLD2.JLDFile{JLD2.MmapIO}, ::JLD2.ReadDataspace, ::UInt8, ::Int64, ::Int64, ::Int64, ::UInt16, ::JLD2.RelOffset, ::Array{JLD2.ReadAttribute,1}) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\datasets.jl:149
[18] load_dataset(::JLD2.JLDFile{JLD2.MmapIO}, ::JLD2.RelOffset) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\datasets.jl:92
[19] jlconvert at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\data.jl:674 [inlined]
[20] macro expansion at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\data.jl:1322 [inlined]
[21] jlconvert(::JLD2.ReadRepresentation{Base.RefValue{Tuple{UInt64,Array{ChainDataFrame,1}}},JLD2.OnDiskRepresentation{(0,),Tuple{Tuple{UInt64,Array{ChainDataFrame,1}}},Tuple{JLD2.RelOffset}}()}, ::JLD2.JLDFile{JLD2.MmapIO}, ::Ptr{Nothing}, ::JLD2.RelOffset) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\data.jl:1269
[22] read_data(::JLD2.JLDFile{JLD2.MmapIO}, ::JLD2.ReadRepresentation{Base.RefValue{Tuple{UInt64,Array{ChainDataFrame,1}}},JLD2.OnDiskRepresentation{(0,),Tuple{Tuple{UInt64,Array{ChainDataFrame,1}}},Tuple{JLD2.RelOffset}}()}, ::Array{JLD2.ReadAttribute,1}) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\dataio.jl:37
[23] read_data(::JLD2.JLDFile{JLD2.MmapIO}, ::JLD2.ReadDataspace, ::UInt8, ::Int64, ::Int64, ::Int64, ::UInt16, ::JLD2.RelOffset, ::Array{JLD2.ReadAttribute,1}) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\datasets.jl:149
[24] load_dataset(::JLD2.JLDFile{JLD2.MmapIO}, ::JLD2.RelOffset) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\datasets.jl:92
[25] jlconvert at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\data.jl:674 [inlined]
[26] macro expansion at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\data.jl:1322 [inlined]
[27] jlconvert(::JLD2.ReadRepresentation{NamedTuple{(:range, :model, :spl, :vi, :hashedsummary),Tuple{Random._GLOBAL_RNG,DynamicPPL.Model{var"##inner_function#608#24",NamedTuple{(:y,),Tuple{Array{Int64,1}}},DynamicPPL.ModelGen{(:y,),var"###coinflip#622",NamedTuple{(),Tuple{}}},Val{()}},DynamicPPL.Sampler{HMC{Turing.Core.ZygoteAD,(),AdvancedHMC.Adaptation.UnitEuclideanMetric},Turing.Inference.HMCState{DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},AdvancedHMC.StaticTrajectory{AdvancedHMC.EndPointTS,AdvancedHMC.Leapfrog{Float64}},AdvancedHMC.Adaptation.NoAdaptation,AdvancedHMC.PhasePoint{Array{Float64,1},AdvancedHMC.DualValue{Float64,Array{Float64,1}}}}},DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},Base.RefValue{Tuple{UInt64,Array{ChainDataFrame,1}}}}},JLD2.OnDiskRepresentation{(0, 0, 8, 16, 96),Tuple{Random._GLOBAL_RNG,DynamicPPL.Model{var"##inner_function#608#24",NamedTuple{(:y,),Tuple{Array{Int64,1}}},DynamicPPL.ModelGen{(:y,),var"###coinflip#622",NamedTuple{(),Tuple{}}},Val{()}},Any,DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},Any},Tuple{nothing,JLD2.OnDiskRepresentation{(0, 0, 8, 8),Tuple{var"##inner_function#608#24",NamedTuple{(:y,),Tuple{Array{Int64,1}}},DynamicPPL.ModelGen{(:y,),var"###coinflip#622",NamedTuple{(),Tuple{}}},Val{()}},Tuple{nothing,JLD2.OnDiskRepresentation{(0,),Tuple{Array{Int64,1}},Tuple{JLD2.RelOffset}}(),nothing,nothing}}(),JLD2.RelOffset,JLD2.OnDiskRepresentation{(0, 64, 72),Tuple{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Any,Any},Tuple{JLD2.OnDiskRepresentation{(0,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}},Tuple{JLD2.OnDiskRepresentation{(0, 8, 16, 24, 32, 40, 48, 56),Tuple{Dict{DynamicPPL.VarName{:p},Int64},Any,Any,Any,Any,Any,Any,Dict{String,BitArray{1}}},Tuple{JLD2.CustomSerialization{Array,JLD2.RelOffset},JLD2.RelOffset,JLD2.RelOffset,JLD2.RelOffset,JLD2.RelOffset,JLD2.RelOffset,JLD2.RelOffset,JLD2.CustomSerialization{Array,JLD2.RelOffset}}}()}}(),JLD2.RelOffset,JLD2.RelOffset}}(),JLD2.RelOffset}}()}, ::JLD2.JLDFile{JLD2.MmapIO}, ::Ptr{Nothing}, ::JLD2.RelOffset) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\data.jl:1269
[28] jlconvert(::JLD2.ReadRepresentation{Chains{Real,Missing,NamedTuple{(:internals, :parameters),Tuple{Array{String,1},Array{String,1}}},NamedTuple{(:range, :model, :spl, :vi, :hashedsummary),Tuple{Random._GLOBAL_RNG,DynamicPPL.Model{var"##inner_function#608#24",NamedTuple{(:y,),Tuple{Array{Int64,1}}},DynamicPPL.ModelGen{(:y,),var"###coinflip#622",NamedTuple{(),Tuple{}}},Val{()}},DynamicPPL.Sampler{HMC{Turing.Core.ZygoteAD,(),AdvancedHMC.Adaptation.UnitEuclideanMetric},Turing.Inference.HMCState{DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},AdvancedHMC.StaticTrajectory{AdvancedHMC.EndPointTS,AdvancedHMC.Leapfrog{Float64}},AdvancedHMC.Adaptation.NoAdaptation,AdvancedHMC.PhasePoint{Array{Float64,1},AdvancedHMC.DualValue{Float64,Array{Float64,1}}}}},DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},Base.RefValue{Tuple{UInt64,Array{ChainDataFrame,1}}}}}},JLD2.OnDiskRepresentation{(0, 8, 8, 24),Tuple{Any,Missing,NamedTuple{(:internals, :parameters),Tuple{Array{String,1},Array{String,1}}},NamedTuple{(:range, :model, :spl, :vi, :hashedsummary),Tuple{Random._GLOBAL_RNG,DynamicPPL.Model{var"##inner_function#608#24",NamedTuple{(:y,),Tuple{Array{Int64,1}}},DynamicPPL.ModelGen{(:y,),var"###coinflip#622",NamedTuple{(),Tuple{}}},Val{()}},DynamicPPL.Sampler{HMC{Turing.Core.ZygoteAD,(),AdvancedHMC.Adaptation.UnitEuclideanMetric},Turing.Inference.HMCState{DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},AdvancedHMC.StaticTrajectory{AdvancedHMC.EndPointTS,AdvancedHMC.Leapfrog{Float64}},AdvancedHMC.Adaptation.NoAdaptation,AdvancedHMC.PhasePoint{Array{Float64,1},AdvancedHMC.DualValue{Float64,Array{Float64,1}}}}},DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},Base.RefValue{Tuple{UInt64,Array{ChainDataFrame,1}}}}}},Tuple{JLD2.RelOffset,nothing,JLD2.OnDiskRepresentation{(0, 8),Tuple{Array{String,1},Array{String,1}},Tuple{JLD2.RelOffset,JLD2.RelOffset}}(),JLD2.OnDiskRepresentation{(0, 0, 8, 16, 96),Tuple{Random._GLOBAL_RNG,DynamicPPL.Model{var"##inner_function#608#24",NamedTuple{(:y,),Tuple{Array{Int64,1}}},DynamicPPL.ModelGen{(:y,),var"###coinflip#622",NamedTuple{(),Tuple{}}},Val{()}},Any,DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},Any},Tuple{nothing,JLD2.OnDiskRepresentation{(0, 0, 8, 8),Tuple{var"##inner_function#608#24",NamedTuple{(:y,),Tuple{Array{Int64,1}}},DynamicPPL.ModelGen{(:y,),var"###coinflip#622",NamedTuple{(),Tuple{}}},Val{()}},Tuple{nothing,JLD2.OnDiskRepresentation{(0,),Tuple{Array{Int64,1}},Tuple{JLD2.RelOffset}}(),nothing,nothing}}(),JLD2.RelOffset,JLD2.OnDiskRepresentation{(0, 64, 72),Tuple{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Any,Any},Tuple{JLD2.OnDiskRepresentation{(0,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}},Tuple{JLD2.OnDiskRepresentation{(0, 8, 16, 24, 32, 40, 48, 56),Tuple{Dict{DynamicPPL.VarName{:p},Int64},Any,Any,Any,Any,Any,Any,Dict{String,BitArray{1}}},Tuple{JLD2.CustomSerialization{Array,JLD2.RelOffset},JLD2.RelOffset,JLD2.RelOffset,JLD2.RelOffset,JLD2.RelOffset,JLD2.RelOffset,JLD2.RelOffset,JLD2.CustomSerialization{Array,JLD2.RelOffset}}}()}}(),JLD2.RelOffset,JLD2.RelOffset}}(),JLD2.RelOffset}}()}}()}, ::JLD2.JLDFile{JLD2.MmapIO}, ::Ptr{Nothing}, ::JLD2.RelOffset) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\data.jl:1322
[29] read_data(::JLD2.JLDFile{JLD2.MmapIO}, ::JLD2.ReadRepresentation{Chains{Real,Missing,NamedTuple{(:internals, :parameters),Tuple{Array{String,1},Array{String,1}}},NamedTuple{(:range, :model, :spl, :vi, :hashedsummary),Tuple{Random._GLOBAL_RNG,DynamicPPL.Model{var"##inner_function#608#24",NamedTuple{(:y,),Tuple{Array{Int64,1}}},DynamicPPL.ModelGen{(:y,),var"###coinflip#622",NamedTuple{(),Tuple{}}},Val{()}},DynamicPPL.Sampler{HMC{Turing.Core.ZygoteAD,(),AdvancedHMC.Adaptation.UnitEuclideanMetric},Turing.Inference.HMCState{DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},AdvancedHMC.StaticTrajectory{AdvancedHMC.EndPointTS,AdvancedHMC.Leapfrog{Float64}},AdvancedHMC.Adaptation.NoAdaptation,AdvancedHMC.PhasePoint{Array{Float64,1},AdvancedHMC.DualValue{Float64,Array{Float64,1}}}}},DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},Base.RefValue{Tuple{UInt64,Array{ChainDataFrame,1}}}}}},JLD2.OnDiskRepresentation{(0, 8, 8, 24),Tuple{Any,Missing,NamedTuple{(:internals, :parameters),Tuple{Array{String,1},Array{String,1}}},NamedTuple{(:range, :model, :spl, :vi, :hashedsummary),Tuple{Random._GLOBAL_RNG,DynamicPPL.Model{var"##inner_function#608#24",NamedTuple{(:y,),Tuple{Array{Int64,1}}},DynamicPPL.ModelGen{(:y,),var"###coinflip#622",NamedTuple{(),Tuple{}}},Val{()}},DynamicPPL.Sampler{HMC{Turing.Core.ZygoteAD,(),AdvancedHMC.Adaptation.UnitEuclideanMetric},Turing.Inference.HMCState{DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},AdvancedHMC.StaticTrajectory{AdvancedHMC.EndPointTS,AdvancedHMC.Leapfrog{Float64}},AdvancedHMC.Adaptation.NoAdaptation,AdvancedHMC.PhasePoint{Array{Float64,1},AdvancedHMC.DualValue{Float64,Array{Float64,1}}}}},DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},Base.RefValue{Tuple{UInt64,Array{ChainDataFrame,1}}}}}},Tuple{JLD2.RelOffset,nothing,JLD2.OnDiskRepresentation{(0, 8),Tuple{Array{String,1},Array{String,1}},Tuple{JLD2.RelOffset,JLD2.RelOffset}}(),JLD2.OnDiskRepresentation{(0, 0, 8, 16, 96),Tuple{Random._GLOBAL_RNG,DynamicPPL.Model{var"##inner_function#608#24",NamedTuple{(:y,),Tuple{Array{Int64,1}}},DynamicPPL.ModelGen{(:y,),var"###coinflip#622",NamedTuple{(),Tuple{}}},Val{()}},Any,DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},Any},Tuple{nothing,JLD2.OnDiskRepresentation{(0, 0, 8, 8),Tuple{var"##inner_function#608#24",NamedTuple{(:y,),Tuple{Array{Int64,1}}},DynamicPPL.ModelGen{(:y,),var"###coinflip#622",NamedTuple{(),Tuple{}}},Val{()}},Tuple{nothing,JLD2.OnDiskRepresentation{(0,),Tuple{Array{Int64,1}},Tuple{JLD2.RelOffset}}(),nothing,nothing}}(),JLD2.RelOffset,JLD2.OnDiskRepresentation{(0, 64, 72),Tuple{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Any,Any},Tuple{JLD2.OnDiskRepresentation{(0,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}},Tuple{JLD2.OnDiskRepresentation{(0, 8, 16, 24, 32, 40, 48, 56),Tuple{Dict{DynamicPPL.VarName{:p},Int64},Any,Any,Any,Any,Any,Any,Dict{String,BitArray{1}}},Tuple{JLD2.CustomSerialization{Array,JLD2.RelOffset},JLD2.RelOffset,JLD2.RelOffset,JLD2.RelOffset,JLD2.RelOffset,JLD2.RelOffset,JLD2.RelOffset,JLD2.CustomSerialization{Array,JLD2.RelOffset}}}()}}(),JLD2.RelOffset,JLD2.RelOffset}}(),JLD2.RelOffset}}()}}()}, ::Array{JLD2.ReadAttribute,1}) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\dataio.jl:37
[30] read_data(::JLD2.JLDFile{JLD2.MmapIO}, ::JLD2.ReadDataspace, ::UInt8, ::Int64, ::Int64, ::Int64, ::UInt16, ::JLD2.RelOffset, ::Array{JLD2.ReadAttribute,1}) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\datasets.jl:149
[31] load_dataset(::JLD2.JLDFile{JLD2.MmapIO}, ::JLD2.RelOffset) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\datasets.jl:92
[32] getindex(::JLD2.Group{JLD2.JLDFile{JLD2.MmapIO}}, ::String) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\groups.jl:108
[33] read(::JLD2.JLDFile{JLD2.MmapIO}, ::String) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\JLD2.jl:326
[34] #27 at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\loadsave.jl:112 [inlined]
[35] #jldopen#31(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(jldopen), ::var"#27#28", ::String) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\loadsave.jl:4
[36] jldopen(::Function, ::String) at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\loadsave.jl:2
[37] top-level scope at C:\Users\z5168736\.julia\packages\JLD2\hB4ya\src\loadsave.jl:111
Moreover, I tried to write and read the file using commands mentioned in MCMCChains.j documentation as below:
write("chain_i.jls", chain)
When I tried to read using below commands,
chn2 = read("chain_i.jls", chain)
, I got error like below,
ERROR: MethodError: no method matching read(::IOStream, ::Chains{Real,Missing,NamedTuple{(:internals, :parameters),Tuple{Array{String,1},Array{String,1}}},NamedTuple{(:range, :model, :spl, :vi, :hashedsummary),Tuple{Random._GLOBAL_RNG,DynamicPPL.Model{var"##inner_function#608#24",NamedTuple{(:y,),Tuple{Array{Int64,1}}},DynamicPPL.ModelGen{(:y,),var"###coinflip#622",NamedTuple{(),Tuple{}}},Val{()}},DynamicPPL.Sampler{HMC{Turing.Core.ZygoteAD,(),AdvancedHMC.Adaptation.UnitEuclideanMetric},Turing.Inference.HMCState{DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},AdvancedHMC.StaticTrajectory{AdvancedHMC.EndPointTS,AdvancedHMC.Leapfrog{Float64}},AdvancedHMC.Adaptation.NoAdaptation,AdvancedHMC.PhasePoint{Array{Float64,1},AdvancedHMC.DualValue{Float64,Array{Float64,1}}}}},DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},Base.RefValue{Tuple{UInt64,Array{ChainDataFrame,1}}}}}})
Closest candidates are:
read(::IOStream) at iostream.jl:453
read(::IOStream, ::Type{UInt8}) at iostream.jl:348
read(::IOStream, ::Union{Type{Int16}, Type{Int32}, Type{Int64}, Type{UInt16}, Type{UInt32}, Type{UInt64}}) at iostream.jl:357
...
Stacktrace:
[1] (::Base.var"#278#279"{Tuple{Chains{Real,Missing,NamedTuple{(:internals, :parameters),Tuple{Array{String,1},Array{String,1}}},NamedTuple{(:range, :model, :spl, :vi, :hashedsummary),Tuple{Random._GLOBAL_RNG,DynamicPPL.Model{var"##inner_function#608#24",NamedTuple{(:y,),Tuple{Array{Int64,1}}},DynamicPPL.ModelGen{(:y,),var"###coinflip#622",NamedTuple{(),Tuple{}}},Val{()}},DynamicPPL.Sampler{HMC{Turing.Core.ZygoteAD,(),AdvancedHMC.Adaptation.UnitEuclideanMetric},Turing.Inference.HMCState{DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},AdvancedHMC.StaticTrajectory{AdvancedHMC.EndPointTS,AdvancedHMC.Leapfrog{Float64}},AdvancedHMC.Adaptation.NoAdaptation,AdvancedHMC.PhasePoint{Array{Float64,1},AdvancedHMC.DualValue{Float64,Array{Float64,1}}}}},DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},Base.RefValue{Tuple{UInt64,Array{ChainDataFrame,1}}}}}}}})(::IOStream) at .\io.jl:379
[2] #open#271(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(open), ::Base.var"#278#279"{Tuple{Chains{Real,Missing,NamedTuple{(:internals, :parameters),Tuple{Array{String,1},Array{String,1}}},NamedTuple{(:range, :model, :spl, :vi, :hashedsummary),Tuple{Random._GLOBAL_RNG,DynamicPPL.Model{var"##inner_function#608#24",NamedTuple{(:y,),Tuple{Array{Int64,1}}},DynamicPPL.ModelGen{(:y,),var"###coinflip#622",NamedTuple{(),Tuple{}}},Val{()}},DynamicPPL.Sampler{HMC{Turing.Core.ZygoteAD,(),AdvancedHMC.Adaptation.UnitEuclideanMetric},Turing.Inference.HMCState{DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},AdvancedHMC.StaticTrajectory{AdvancedHMC.EndPointTS,AdvancedHMC.Leapfrog{Float64}},AdvancedHMC.Adaptation.NoAdaptation,AdvancedHMC.PhasePoint{Array{Float64,1},AdvancedHMC.DualValue{Float64,Array{Float64,1}}}}},DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},Base.RefValue{Tuple{UInt64,Array{ChainDataFrame,1}}}}}}}}, ::String) at .\io.jl:298
[3] open(::Function, ::String) at .\io.jl:296
[4] read(::String, ::Chains{Real,Missing,NamedTuple{(:internals, :parameters),Tuple{Array{String,1},Array{String,1}}},NamedTuple{(:range, :model, :spl, :vi, :hashedsummary),Tuple{Random._GLOBAL_RNG,DynamicPPL.Model{var"##inner_function#608#24",NamedTuple{(:y,),Tuple{Array{Int64,1}}},DynamicPPL.ModelGen{(:y,),var"###coinflip#622",NamedTuple{(),Tuple{}}},Val{()}},DynamicPPL.Sampler{HMC{Turing.Core.ZygoteAD,(),AdvancedHMC.Adaptation.UnitEuclideanMetric},Turing.Inference.HMCState{DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},AdvancedHMC.StaticTrajectory{AdvancedHMC.EndPointTS,AdvancedHMC.Leapfrog{Float64}},AdvancedHMC.Adaptation.NoAdaptation,AdvancedHMC.PhasePoint{Array{Float64,1},AdvancedHMC.DualValue{Float64,Array{Float64,1}}}}},DynamicPPL.VarInfo{NamedTuple{(:p,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:p},Int64},Array{Beta{Float64},1},Array{DynamicPPL.VarName{:p},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},Base.RefValue{Tuple{UInt64,Array{ChainDataFrame,1}}}}}}) at .\io.jl:379
[5] top-level scope at REPL[146]:1
How can I solve this error?
Thanks in advance
Manu