pluskid / Mocha.jl

Deep Learning framework for Julia
Other
1.29k stars 254 forks source link

ERROR: TypeError: read_refs: in typeassert, expected Array{Array{T,N},1}, got Array{Array{T,N},1} #229

Open dryden3 opened 7 years ago

dryden3 commented 7 years ago

I'm getting an error loading a saved snapshot.I believe it is from the compose package.

Thanks for your help

dryden3 commented 7 years ago

LoadError: TypeError: read_refs: in typeassert, expected Array{Array{T,N},1}, got Array{Array{T,N},1} while loading /home/seniordesign/Documents/Benchmark.jl, in expression starting on line 24 in read_refs(::JLD.JldDataset, ::Type{Array{Array{T,N},1}}, ::Int32, ::Int32, ::Tuple{Int64}) at JLD.jl:486 in read_array(::JLD.JldDataset, ::HDF5.HDF5Datatype, ::Int32, ::Int32, ::Tuple{Int64}) at JLD.jl:422 in read(::JLD.JldDataset) at JLD.jl:387 in read_ref(::JLD.JldFile, ::HDF5.HDF5ReferenceObj) at JLD.jl:513 in macro expansion at jld_types.jl:451 [inlined] in jlconvert(::Type{JLD.AssociativeWrapper{AbstractString,Array{Array{T,N},1},Dict{AbstractString,Array{Array{T,N},1}}}}, ::JLD.JldFile, ::Ptr{UInt8}) at jld_types.jl:581 in read_scalar(::JLD.JldDataset, ::HDF5.HDF5Datatype, ::Type{T}) at JLD.jl:413 in read(::JLD.JldDataset) at JLD.jl:385 in read(::JLD.JldFile, ::String) at JLD.jl:361 in load_network(::JLD.JldFile, ::Mocha.Net{Mocha.CPUBackend}) at io.jl:89 in #218 at solvers.jl:158 [inlined] in #jldopen#11(::Array{Any,1}, ::Function, ::Mocha.##218#220{Mocha.Net{Mocha.CPUBackend}}, ::String, ::Vararg{String,N}) at JLD.jl:260 in load_snapshot(::Mocha.Net{Mocha.CPUBackend}, ::String, ::Void) at solvers.jl:157 in NN_Control(::Float64) at NN_Controller.jl:20 in macro expansion; at Benchmark.jl:38 [inlined] in anonymous at :? in include_string(::String, ::String) at loading.jl:441 in include_string(::Module, ::String, ::String) at eval.jl:32 in (::Atom.##59#62{String,String})() at eval.jl:73 in withpath(::Atom.##59#62{String,String}, ::String) at utils.jl:30 in withpath(::Function, ::String) at eval.jl:38 in macro expansion at eval.jl:71 [inlined] in (::Atom.##58#61{Dict{String,Any}})() at task.jl:60

arklian-zz commented 7 years ago

I have the same error. Wondering if you found a solution.

DilumAluthge commented 7 years ago

I am also getting the same error when trying to load a snapshot. It seems like the same error as #219.

This post on Discourse also seems to be the same error: https://discourse.julialang.org/t/mocha-type-assert-failure/3189

I haven't been able to find a solution. @pluskid do you have any ideas?

DilumAluthge commented 7 years ago

Hi all - I think I have a fix for this. Please see this pull request: https://github.com/JuliaIO/JLD.jl/pull/170

DilumAluthge commented 7 years ago

Until the pull request is reviewed, you can implement the fix on your machine as follows:

  1. Go to the "src" directory within the JLD package directory in your Julia install. The path is probably something like $HOME/.julia/v0.x/JLD/src. (For example, for me, the directory was located at "/Users/dilum/.julia/v0.5/JLD/src")
  2. In the "src" directory, open the "JLD.jl" file in your favorite text editor.
  3. Find the read_refs function. It should start on or near line 473.
  4. Find the line that reads out = Array{T}(dims). It should be on or near line 478.
  5. Change that line to instead read out = Array{Any}(dims).
  6. Save and close "JLD.jl"

You will need to quit any existing Julia sessions.