JuliaIO / BSON.jl

Other
158 stars 39 forks source link

ERROR: too many parameters for type when loading Flux model #105

Closed jarroyoe closed 2 years ago

jarroyoe commented 2 years ago

I'm following this tutorial to generate a CNN in Julia and it succeeds, but when I try to run

BSON.@load "mnist_conv.bson" model

I get the following error

ERROR: too many parameters for type
Stacktrace:
  [1] constructtype(T::Type, Ts::Vector{Any})
    @ BSON ~/.julia/packages/BSON/N216E/src/extensions.jl:61
  [2] (::BSON.var"#35#36")(d::Dict{Symbol, Any}, init::Module)
    @ BSON ~/.julia/packages/BSON/N216E/src/extensions.jl:64
  [3] _raise_recursive(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module)
    @ BSON ~/.julia/packages/BSON/N216E/src/read.jl:80
  [4] raise_recursive(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module)
    @ BSON ~/.julia/packages/BSON/N216E/src/read.jl:93
  [5] (::BSON.var"#23#24"{IdDict{Any, Any}, Module})(x::Dict{Symbol, Any})
    @ BSON ~/.julia/packages/BSON/N216E/src/read.jl:98
  [6] applychildren!(f::BSON.var"#23#24"{IdDict{Any, Any}, Module}, x::Vector{Any})
    @ BSON ~/.julia/packages/BSON/N216E/src/BSON.jl:28
  [7] raise_recursive
    @ ~/.julia/packages/BSON/N216E/src/read.jl:98 [inlined]
  [8] (::BSON.var"#17#20"{IdDict{Any, Any}, Module})(x::Vector{Any})
    @ BSON ~/.julia/packages/BSON/N216E/src/read.jl:80
  [9] applychildren!(f::BSON.var"#17#20"{IdDict{Any, Any}, Module}, x::Dict{Symbol, Any})
    @ BSON ~/.julia/packages/BSON/N216E/src/BSON.jl:21
 [10] _raise_recursive(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module)
    @ BSON ~/.julia/packages/BSON/N216E/src/read.jl:80
 [11] raise_recursive(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module)
    @ BSON ~/.julia/packages/BSON/N216E/src/read.jl:93
 [12] (::BSON.var"#23#24"{IdDict{Any, Any}, Module})(x::Dict{Symbol, Any})
    @ BSON ~/.julia/packages/BSON/N216E/src/read.jl:98
 [13] applychildren!(f::BSON.var"#23#24"{IdDict{Any, Any}, Module}, x::Vector{Any})
    @ BSON ~/.julia/packages/BSON/N216E/src/BSON.jl:28
 [14] raise_recursive
    @ ~/.julia/packages/BSON/N216E/src/read.jl:98 [inlined]
 [15] (::BSON.var"#17#20"{IdDict{Any, Any}, Module})(x::Vector{Any})
    @ BSON ~/.julia/packages/BSON/N216E/src/read.jl:80
 [16] applychildren!(f::BSON.var"#17#20"{IdDict{Any, Any}, Module}, x::Dict{Symbol, Any})
    @ BSON ~/.julia/packages/BSON/N216E/src/BSON.jl:21
 [17] _raise_recursive(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module)
    @ BSON ~/.julia/packages/BSON/N216E/src/read.jl:80
 [18] raise_recursive(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module)
    @ BSON ~/.julia/packages/BSON/N216E/src/read.jl:93
 [19] (::BSON.var"#23#24"{IdDict{Any, Any}, Module})(x::Dict{Symbol, Any})
    @ BSON ~/.julia/packages/BSON/N216E/src/read.jl:98
 [20] applychildren!(f::BSON.var"#23#24"{IdDict{Any, Any}, Module}, x::Vector{Any})
    @ BSON ~/.julia/packages/BSON/N216E/src/BSON.jl:28
 [21] raise_recursive
    @ ~/.julia/packages/BSON/N216E/src/read.jl:98 [inlined]
 [22] (::BSON.var"#17#20"{IdDict{Any, Any}, Module})(x::Vector{Any})
    @ BSON ~/.julia/packages/BSON/N216E/src/read.jl:80
 [23] applychildren!(f::BSON.var"#17#20"{IdDict{Any, Any}, Module}, x::Dict{Symbol, Any})
    @ BSON ~/.julia/packages/BSON/N216E/src/BSON.jl:21
 [24] _raise_recursive(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module)
    @ BSON ~/.julia/packages/BSON/N216E/src/read.jl:80
 [25] raise_recursive(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module)
    @ BSON ~/.julia/packages/BSON/N216E/src/read.jl:93
 [26] (::BSON.var"#49#50")(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module)
    @ BSON ~/.julia/packages/BSON/N216E/src/extensions.jl:147
 [27] raise_recursive(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module)
    @ BSON ~/.julia/packages/BSON/N216E/src/read.jl:92
 [28] (::BSON.var"#19#22"{IdDict{Any, Any}, Module})(x::Dict{Symbol, Any})
    @ BSON ~/.julia/packages/BSON/N216E/src/read.jl:86
 [29] applychildren!(f::BSON.var"#19#22"{IdDict{Any, Any}, Module}, x::Dict{Symbol, Any})
    @ BSON ~/.julia/packages/BSON/N216E/src/BSON.jl:21
 [30] _raise_recursive(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module)
    @ BSON ~/.julia/packages/BSON/N216E/src/read.jl:86
 [31] raise_recursive(d::Dict{Symbol, Any}, cache::IdDict{Any, Any}, init::Module)
    @ BSON ~/.julia/packages/BSON/N216E/src/read.jl:93
 [32] raise_recursive
    @ ~/.julia/packages/BSON/N216E/src/read.jl:103 [inlined]
 [33] load (repeats 2 times)
    @ ~/.julia/packages/BSON/N216E/src/read.jl:108 [inlined]
 [34] top-level scope
    @ ~/.julia/packages/BSON/N216E/src/BSON.jl:52

When I use BSON.parse it gets loaded but it's interpreted as a weird struct which I'm not sure if it's possible to reconstruct into a Flux model.

DhairyaLGandhi commented 2 years ago

What version of bson and flux are you using?

jarroyoe commented 2 years ago

I'm using the most recent versions of BSON (0.3.4) and Flux (0.12.8)

jarroyoe commented 2 years ago

Update: It seems to be a problem of my computer. I reinstalled the CUDA drivers and the loading worked correctly.