Hello people,
I am trying to get into the DiffEqFlux package and neural ODE networks, but the example code from the documentation of the package is not working for me. It raises the error:
LoadError: ArgumentError: tuple must be non-empty
Stacktrace:
[1] first(#unused#::Tuple{})
@ Base .\tuple.jl:134
[2] _unapply(t::Nothing, xs::Tuple{})
@ Zygote C:\Users\aspec.julia\packages\Zygote\zowrf\src\lib\lib.jl:163
[3] _unapply(t::Tuple{Nothing}, xs::Tuple{}) (repeats 2 times)
@ Zygote C:\Users\aspec.julia\packages\Zygote\zowrf\src\lib\lib.jl:167
[4] _unapply(t::Tuple{NTuple{6, Nothing}, Tuple{Nothing}}, xs::Tuple{Nothing, Nothing, Nothing, Vector{Float32}, Vector{Float32}, Nothing})
@ Zygote C:\Users\aspec.julia\packages\Zygote\zowrf\src\lib\lib.jl:168
[5] unapply(t::Tuple{NTuple{6, Nothing}, Tuple{Nothing}}, xs::Tuple{Nothing, Nothing, Nothing, Vector{Float32}, Vector{Float32}, Nothing})
@ Zygote C:\Users\aspec.julia\packages\Zygote\zowrf\src\lib\lib.jl:177
[6] (::Zygote.var"#188#189"{Tuple{NTuple{6, Nothing}, Tuple{Nothing}}, Zygote.var"#kw_zpullback#40"{DiffEqSensitivity.var"#adjoint_sensitivity_backpass#179"{Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, Tsit5, InterpolatingAdjoint{0, true, Val{:central}, Bool, Bool}, Vector{Float32}, Vector{Float32}, Tuple{}, Colon, NamedTuple{(), Tuple{}}}}})(Δ::Matrix{Float32})
@ Zygote C:\Users\aspec.julia\packages\Zygote\zowrf\src\lib\lib.jl:195
[7] (::Zygote.var"#1689#back#190"{Zygote.var"#188#189"{Tuple{NTuple{6, Nothing}, Tuple{Nothing}}, Zygote.var"#kw_zpullback#40"{DiffEqSensitivity.var"#adjoint_sensitivity_backpass#179"{Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, Tsit5, InterpolatingAdjoint{0, true, Val{:central}, Bool, Bool}, Vector{Float32}, Vector{Float32}, Tuple{}, Colon, NamedTuple{(), Tuple{}}}}}})(Δ::Matrix{Float32})
@ Zygote C:\Users\aspec.julia\packages\ZygoteRules\OjfTt\src\adjoint.jl:59
[8] Pullback
@ C:\Users\aspec.julia\packages\DiffEqBase\dCe5g\src\solve.jl:70 [inlined]
[9] (::typeof(∂(#solve#59)))(Δ::Matrix{Float32})
@ Zygote C:\Users\aspec.julia\packages\Zygote\zowrf\src\compiler\interface2.jl:0
[10] (::Zygote.var"#188#189"{Tuple{NTuple{6, Nothing}, Tuple{Nothing}}, typeof(∂(#solve#59))})(Δ::Matrix{Float32})
@ Zygote C:\Users\aspec.julia\packages\Zygote\zowrf\src\lib\lib.jl:194
[11] (::Zygote.var"#1689#back#190"{Zygote.var"#188#189"{Tuple{NTuple{6, Nothing}, Tuple{Nothing}}, typeof(∂(#solve#59))}})(Δ::Matrix{Float32})
@ Zygote C:\Users\aspec.julia\packages\ZygoteRules\OjfTt\src\adjoint.jl:59
[12] Pullback
@ C:\Users\aspec.julia\packages\DiffEqBase\dCe5g\src\solve.jl:68 [inlined]
[13] (::typeof(∂(solve##kw)))(Δ::Matrix{Float32})
@ Zygote C:\Users\aspec.julia\packages\Zygote\zowrf\src\compiler\interface2.jl:0
[14] Pullback
@ D:\Users\aspec\Desktop\Juno\test.jl:23 [inlined]
[15] (::typeof(∂(predict_n_ode)))(Δ::Matrix{Float32})
@ Zygote C:\Users\aspec.julia\packages\Zygote\zowrf\src\compiler\interface2.jl:0
[16] Pullback
@ D:\Users\aspec\Desktop\Juno\test.jl:27 [inlined]
[17] (::typeof(∂(loss_n_ode)))(Δ::Float32)
@ Zygote C:\Users\aspec.julia\packages\Zygote\zowrf\src\compiler\interface2.jl:0
[18] #188
@ C:\Users\aspec.julia\packages\Zygote\zowrf\src\lib\lib.jl:194 [inlined]
[19] #1689#back
@ C:\Users\aspec.julia\packages\ZygoteRules\OjfTt\src\adjoint.jl:59 [inlined]
[20] Pullback
@ C:\Users\aspec.julia\packages\Flux\0c9kI\src\optimise\train.jl:102 [inlined]
[21] (::Zygote.var"#69#70"{Params, typeof(∂(#38)), Zygote.Context})(Δ::Float32)
@ Zygote C:\Users\aspec.julia\packages\Zygote\zowrf\src\compiler\interface.jl:255
[22] gradient(f::Function, args::Params)
@ Zygote C:\Users\aspec.julia\packages\Zygote\zowrf\src\compiler\interface.jl:59
[23] macro expansion
@ C:\Users\aspec.julia\packages\Flux\0c9kI\src\optimise\train.jl:101 [inlined]
[24] macro expansion
@ C:\Users\aspec.julia\packages\Juno\n6wyj\src\progress.jl:119 [inlined]
[25] train!(loss::Function, ps::Params, data::Base.Iterators.Take{Base.Iterators.Repeated{Tuple{}}}, opt::ADAM; cb::var"#78#80")
@ Flux.Optimise C:\Users\aspec.julia\packages\Flux\0c9kI\src\optimise\train.jl:99
[26] top-level scope
@ D:\Users\aspec\Desktop\Juno\test.jl:48
[27] eval
@ .\boot.jl:360 [inlined]
[28] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)
@ Base .\loading.jl:1094
I also tried to run this code from this nice blog post and at first I get UndefVarError: param not defined
, so I change p = param([2.2, 1.0, 2.0, 0.4])
to p = Flux.params([2.2, 1.0, 2.0, 0.4])
and I get BoundsError: attempt to access Params at index [2]
.
I am aware of this post. I used Pkg.update() and after updating, my versions are julia 1.6.1, Diff EqFlux 1.39, Flux 0.12.4, Zygote 0.6.12 and DiffEqSensitivity 6.49.1.
There are brand new versions for Zygote (6.14) and DiffEqSensitivity (6.50.1) but Pkg does not download these yet for me. Is this a problem of my package versions?
I think there is something wrong with the parameters in both cases?