-
-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Neural adapter test is broken #412
Comments
@ChrisRackauckas I think this issue might be affecting more models actually (just wrote an unrelated model that errored with the exact same error). Might be worth figuring out what's causing it. |
Yeah, I've been pinging @DhairyaLGandhi that there's a few Zygote issues that seem to have recently popped up. This one doesn't even have DiffEq involved. |
It's best to isolate the issue here. There's plenty of unrelated code to Zygote which we can remove hopefully. Could you give me the full stacktrace? |
Here is the full stacktrace ERROR: LoadError: MethodError: no method matching *(::Tuple{Int64, Int64})
Closest candidates are:
*(::Any, ::ChainRulesCore.Tangent) at /Users/gabrielbirnbaum/.julia/packages/ChainRulesCore/1L9My/src/tangent_arithmetic.jl:151
*(::Any, ::ChainRulesCore.AbstractThunk) at /Users/gabrielbirnbaum/.julia/packages/ChainRulesCore/1L9My/src/tangent_arithmetic.jl:125
*(::Any, ::ChainRulesCore.ZeroTangent) at /Users/gabrielbirnbaum/.julia/packages/ChainRulesCore/1L9My/src/tangent_arithmetic.jl:104
...
Stacktrace:
[1] (::Cubature.var"#17#18"{Bool, Bool, Int64, Float64, Float64, Int64, Int32, Ptr{Nothing}, Cubature.IntegrandData{Quadrature.var"#88#100"{QuadratureProblem{false, Vector{Float64}, Quadrature.var"#48#59"{QuadratureProblem{false, Vector{Float64}, NeuralPDE.var"#_loss#331"{NeuralPDE.var"#175#176"{Nothing, Vector{NeuralPDE.var"#270#272"{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}, UnionAll}}, NeuralPDE.var"#276#277", NeuralPDE.var"#278#287"{QuadratureTraining, NeuralPDE.var"#278#279#288"{Vector{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}}, NeuralPDE.var"#276#277"}, Dict{Symbol, Int64}, Dict{Symbol, Int64}, Vector{Symbol}, Vector{Symbol}}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:cord, Symbol("##θ#257"), :phi, :derivative, :integral, :u, :p), NeuralPDE.var"#_RGF_ModTag", NeuralPDE.var"#_RGF_ModTag", (0x69e1735c, 0x34179182, 0x0039054c, 0xbe1ecdb6, 0x2d24e69f)}, NeuralPDE.var"#274#275"}, UnionAll}, Vector{Float64}, Vector{Float64}, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}}, Vector{Float64}, Vector{Float64}, Base.Iterators.Pairs{Symbol, Real, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:reltol, :abstol, :maxiters), Tuple{Float64, Float64, Int64}}}}, Vector{Float64}}}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Int64})()
@ Cubature ~/.julia/packages/Cubature/5zwuu/src/Cubature.jl:215
[2] disable_sigint(f::Cubature.var"#17#18"{Bool, Bool, Int64, Float64, Float64, Int64, Int32, Ptr{Nothing}, Cubature.IntegrandData{Quadrature.var"#88#100"{QuadratureProblem{false, Vector{Float64}, Quadrature.var"#48#59"{QuadratureProblem{false, Vector{Float64}, NeuralPDE.var"#_loss#331"{NeuralPDE.var"#175#176"{Nothing, Vector{NeuralPDE.var"#270#272"{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}, UnionAll}}, NeuralPDE.var"#276#277", NeuralPDE.var"#278#287"{QuadratureTraining, NeuralPDE.var"#278#279#288"{Vector{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}}, NeuralPDE.var"#276#277"}, Dict{Symbol, Int64}, Dict{Symbol, Int64}, Vector{Symbol}, Vector{Symbol}}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:cord, Symbol("##θ#257"), :phi, :derivative, :integral, :u, :p), NeuralPDE.var"#_RGF_ModTag", NeuralPDE.var"#_RGF_ModTag", (0x69e1735c, 0x34179182, 0x0039054c, 0xbe1ecdb6, 0x2d24e69f)}, NeuralPDE.var"#274#275"}, UnionAll}, Vector{Float64}, Vector{Float64}, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}}, Vector{Float64}, Vector{Float64}, Base.Iterators.Pairs{Symbol, Real, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:reltol, :abstol, :maxiters), Tuple{Float64, Float64, Int64}}}}, Vector{Float64}}}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Int64})
@ Base ./c.jl:458
[3] cubature(xscalar::Bool, fscalar::Bool, vectorized::Bool, padaptive::Bool, fdim::Int64, f::Quadrature.var"#88#100"{QuadratureProblem{false, Vector{Float64}, Quadrature.var"#48#59"{QuadratureProblem{false, Vector{Float64}, NeuralPDE.var"#_loss#331"{NeuralPDE.var"#175#176"{Nothing, Vector{NeuralPDE.var"#270#272"{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}, UnionAll}}, NeuralPDE.var"#276#277", NeuralPDE.var"#278#287"{QuadratureTraining, NeuralPDE.var"#278#279#288"{Vector{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}}, NeuralPDE.var"#276#277"}, Dict{Symbol, Int64}, Dict{Symbol, Int64}, Vector{Symbol}, Vector{Symbol}}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:cord, Symbol("##θ#257"), :phi, :derivative, :integral, :u, :p), NeuralPDE.var"#_RGF_ModTag", NeuralPDE.var"#_RGF_ModTag", (0x69e1735c, 0x34179182, 0x0039054c, 0xbe1ecdb6, 0x2d24e69f)}, NeuralPDE.var"#274#275"}, UnionAll}, Vector{Float64}, Vector{Float64}, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}}, Vector{Float64}, Vector{Float64}, Base.Iterators.Pairs{Symbol, Real, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:reltol, :abstol, :maxiters), Tuple{Float64, Float64, Int64}}}}, Vector{Float64}}, xmin_::Vector{Float64}, xmax_::Vector{Float64}, reqRelError::Float64, reqAbsError::Float64, maxEval::Int64, error_norm::Int32)
@ Cubature ~/.julia/packages/Cubature/5zwuu/src/Cubature.jl:169
[4] hcubature_v(fdim::Int64, f::Function, xmin::Vector{Float64}, xmax::Vector{Float64}; reltol::Float64, abstol::Float64, maxevals::Int64, error_norm::Int32)
@ Cubature ~/.julia/packages/Cubature/5zwuu/src/Cubature.jl:227
[5] __solvebp_call(::QuadratureProblem{false, Vector{Float64}, Quadrature.var"#48#59"{QuadratureProblem{false, Vector{Float64}, NeuralPDE.var"#_loss#331"{NeuralPDE.var"#175#176"{Nothing, Vector{NeuralPDE.var"#270#272"{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}, UnionAll}}, NeuralPDE.var"#276#277", NeuralPDE.var"#278#287"{QuadratureTraining, NeuralPDE.var"#278#279#288"{Vector{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}}, NeuralPDE.var"#276#277"}, Dict{Symbol, Int64}, Dict{Symbol, Int64}, Vector{Symbol}, Vector{Symbol}}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:cord, Symbol("##θ#257"), :phi, :derivative, :integral, :u, :p), NeuralPDE.var"#_RGF_ModTag", NeuralPDE.var"#_RGF_ModTag", (0x69e1735c, 0x34179182, 0x0039054c, 0xbe1ecdb6, 0x2d24e69f)}, NeuralPDE.var"#274#275"}, UnionAll}, Vector{Float64}, Vector{Float64}, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}}, Vector{Float64}, Vector{Float64}, Base.Iterators.Pairs{Symbol, Real, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:reltol, :abstol, :maxiters), Tuple{Float64, Float64, Int64}}}}, ::Quadrature.CubatureJLh, ::Quadrature.ReCallVJP{Quadrature.ZygoteVJP}, ::Vector{Float64}, ::Vector{Float64}, ::Vector{Float64}; reltol::Float64, abstol::Float64, maxiters::Int64, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Quadrature ~/.julia/packages/Quadrature/UCzIP/src/Quadrature.jl:370
[6] (::Quadrature.var"#quadrature_adjoint#54"{Base.Iterators.Pairs{Symbol, Real, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:reltol, :abstol, :maxiters), Tuple{Float64, Float64, Int64}}}, QuadratureProblem{false, Vector{Float64}, NeuralPDE.var"#_loss#331"{NeuralPDE.var"#175#176"{Nothing, Vector{NeuralPDE.var"#270#272"{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}, UnionAll}}, NeuralPDE.var"#276#277", NeuralPDE.var"#278#287"{QuadratureTraining, NeuralPDE.var"#278#279#288"{Vector{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}}, NeuralPDE.var"#276#277"}, Dict{Symbol, Int64}, Dict{Symbol, Int64}, Vector{Symbol}, Vector{Symbol}}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:cord, Symbol("##θ#257"), :phi, :derivative, :integral, :u, :p), NeuralPDE.var"#_RGF_ModTag", NeuralPDE.var"#_RGF_ModTag", (0x69e1735c, 0x34179182, 0x0039054c, 0xbe1ecdb6, 0x2d24e69f)}, NeuralPDE.var"#274#275"}, UnionAll}, Vector{Float64}, Vector{Float64}, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, Quadrature.CubatureJLh, Quadrature.ReCallVJP{Quadrature.ZygoteVJP}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Tuple{}})(Δ::Zygote.OneElement{Float64, 1, Tuple{Int64}, Tuple{Base.OneTo{Int64}}})
@ Quadrature ~/.julia/packages/Quadrature/UCzIP/src/Quadrature.jl:551
[7] ZBack
@ ~/.julia/packages/Zygote/Lw5Kf/src/compiler/chainrules.jl:168 [inlined]
[8] (::Zygote.var"#kw_zpullback#40"{Quadrature.var"#quadrature_adjoint#54"{Base.Iterators.Pairs{Symbol, Real, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:reltol, :abstol, :maxiters), Tuple{Float64, Float64, Int64}}}, QuadratureProblem{false, Vector{Float64}, NeuralPDE.var"#_loss#331"{NeuralPDE.var"#175#176"{Nothing, Vector{NeuralPDE.var"#270#272"{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}, UnionAll}}, NeuralPDE.var"#276#277", NeuralPDE.var"#278#287"{QuadratureTraining, NeuralPDE.var"#278#279#288"{Vector{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}}, NeuralPDE.var"#276#277"}, Dict{Symbol, Int64}, Dict{Symbol, Int64}, Vector{Symbol}, Vector{Symbol}}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:cord, Symbol("##θ#257"), :phi, :derivative, :integral, :u, :p), NeuralPDE.var"#_RGF_ModTag", NeuralPDE.var"#_RGF_ModTag", (0x69e1735c, 0x34179182, 0x0039054c, 0xbe1ecdb6, 0x2d24e69f)}, NeuralPDE.var"#274#275"}, UnionAll}, Vector{Float64}, Vector{Float64}, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, Quadrature.CubatureJLh, Quadrature.ReCallVJP{Quadrature.ZygoteVJP}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Tuple{}}})(dy::Zygote.OneElement{Float64, 1, Tuple{Int64}, Tuple{Base.OneTo{Int64}}})
@ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/compiler/chainrules.jl:194
[9] #203
@ ~/.julia/packages/Zygote/Lw5Kf/src/lib/lib.jl:203 [inlined]
[10] (::Zygote.var"#1733#back#205"{Zygote.var"#203#204"{Tuple{NTuple{8, Nothing}, Tuple{}}, Zygote.var"#kw_zpullback#40"{Quadrature.var"#quadrature_adjoint#54"{Base.Iterators.Pairs{Symbol, Real, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:reltol, :abstol, :maxiters), Tuple{Float64, Float64, Int64}}}, QuadratureProblem{false, Vector{Float64}, NeuralPDE.var"#_loss#331"{NeuralPDE.var"#175#176"{Nothing, Vector{NeuralPDE.var"#270#272"{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}, UnionAll}}, NeuralPDE.var"#276#277", NeuralPDE.var"#278#287"{QuadratureTraining, NeuralPDE.var"#278#279#288"{Vector{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}}, NeuralPDE.var"#276#277"}, Dict{Symbol, Int64}, Dict{Symbol, Int64}, Vector{Symbol}, Vector{Symbol}}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:cord, Symbol("##θ#257"), :phi, :derivative, :integral, :u, :p), NeuralPDE.var"#_RGF_ModTag", NeuralPDE.var"#_RGF_ModTag", (0x69e1735c, 0x34179182, 0x0039054c, 0xbe1ecdb6, 0x2d24e69f)}, NeuralPDE.var"#274#275"}, UnionAll}, Vector{Float64}, Vector{Float64}, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, Quadrature.CubatureJLh, Quadrature.ReCallVJP{Quadrature.ZygoteVJP}, Vector{Float64}, Vector{Float64}, Vector{Float64}, Tuple{}}}}})(Δ::Zygote.OneElement{Float64, 1, Tuple{Int64}, Tuple{Base.OneTo{Int64}}})
@ Zygote ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:67
[11] Pullback
@ ~/.julia/packages/Quadrature/UCzIP/src/Quadrature.jl:154 [inlined]
[12] (::typeof(∂(#solve#12)))(Δ::Zygote.OneElement{Float64, 1, Tuple{Int64}, Tuple{Base.OneTo{Int64}}})
@ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/compiler/interface2.jl:0
[13] #203
@ ~/.julia/packages/Zygote/Lw5Kf/src/lib/lib.jl:203 [inlined]
[14] (::Zygote.var"#1733#back#205"{Zygote.var"#203#204"{Tuple{NTuple{5, Nothing}, Tuple{}}, typeof(∂(#solve#12))}})(Δ::Zygote.OneElement{Float64, 1, Tuple{Int64}, Tuple{Base.OneTo{Int64}}})
@ Zygote ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:67
[15] Pullback
@ ~/.julia/packages/Quadrature/UCzIP/src/Quadrature.jl:153 [inlined]
[16] (::typeof(∂(solve##kw)))(Δ::Zygote.OneElement{Float64, 1, Tuple{Int64}, Tuple{Base.OneTo{Int64}}})
@ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/compiler/interface2.jl:0
[17] Pullback
@ ~/.julia/packages/NeuralPDE/HVA0c/src/pinns_pde_solve.jl:978 [inlined]
[18] (::typeof(∂(λ)))(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/compiler/interface2.jl:0
[19] Pullback
@ ~/.julia/packages/NeuralPDE/HVA0c/src/pinns_pde_solve.jl:984 [inlined]
[20] (::typeof(∂(λ)))(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/compiler/interface2.jl:0
[21] Pullback
@ ~/.julia/packages/NeuralPDE/HVA0c/src/pinns_pde_solve.jl:1164 [inlined]
[22] (::typeof(∂(λ)))(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/compiler/interface2.jl:0
[23] #547
@ ~/.julia/packages/Zygote/Lw5Kf/src/lib/array.jl:202 [inlined]
[24] (::Base.var"#4#5"{Zygote.var"#547#552"})(a::Tuple{Tuple{Float64, typeof(∂(λ))}, Float64})
@ Base ./generator.jl:36
[25] iterate
@ ./generator.jl:47 [inlined]
[26] collect(itr::Base.Generator{Base.Iterators.Zip{Tuple{Vector{Tuple{Float64, Zygote.Pullback}}, Vector{Float64}}}, Base.var"#4#5"{Zygote.var"#547#552"}})
@ Base ./array.jl:681
[27] map
@ ./abstractarray.jl:2383 [inlined]
[28] (::Zygote.var"#544#549"{NeuralPDE.var"#353#369"{Vector{Float64}}, 1, Tuple{Vector{NeuralPDE.var"#328#332"{loss_function, Vector{Float64}, Vector{Float64}, NeuralPDE.var"#327#330"{UnionAll, QuadratureTraining}, Float64} where loss_function}}, Vector{Tuple{Float64, Zygote.Pullback}}})(Δ::FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}})
@ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/lib/array.jl:202
[29] (::Zygote.var"#2575#back#553"{Zygote.var"#544#549"{NeuralPDE.var"#353#369"{Vector{Float64}}, 1, Tuple{Vector{NeuralPDE.var"#328#332"{loss_function, Vector{Float64}, Vector{Float64}, NeuralPDE.var"#327#330"{UnionAll, QuadratureTraining}, Float64} where loss_function}}, Vector{Tuple{Float64, Zygote.Pullback}}}})(Δ::FillArrays.Fill{Float64, 1, Tuple{Base.OneTo{Int64}}})
@ Zygote ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:67
[30] Pullback
@ ~/.julia/packages/NeuralPDE/HVA0c/src/pinns_pde_solve.jl:1164 [inlined]
[31] (::typeof(∂(λ)))(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/compiler/interface2.jl:0
[32] Pullback
@ ~/.julia/packages/NeuralPDE/HVA0c/src/pinns_pde_solve.jl:1165 [inlined]
[33] (::typeof(∂(λ)))(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/compiler/interface2.jl:0
[34] Pullback
@ ~/.julia/packages/NeuralPDE/HVA0c/src/pinns_pde_solve.jl:1169 [inlined]
[35] (::typeof(∂(λ)))(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/compiler/interface2.jl:0
[36] #203
@ ~/.julia/packages/Zygote/Lw5Kf/src/lib/lib.jl:203 [inlined]
[37] #1733#back
@ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:67 [inlined]
[38] Pullback
@ ~/.julia/packages/SciMLBase/NwvCY/src/problems/basic_problems.jl:107 [inlined]
[39] (::typeof(∂(λ)))(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/compiler/interface2.jl:0
[40] #203
@ ~/.julia/packages/Zygote/Lw5Kf/src/lib/lib.jl:203 [inlined]
[41] #1733#back
@ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:67 [inlined]
[42] Pullback
@ ~/.julia/packages/GalacticOptim/bEh06/src/function/zygote.jl:6 [inlined]
[43] (::typeof(∂(λ)))(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/compiler/interface2.jl:0
[44] (::Zygote.var"#203#204"{Tuple{Tuple{Nothing}, Tuple{}}, typeof(∂(λ))})(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/lib/lib.jl:203
[45] #1733#back
@ ~/.julia/packages/ZygoteRules/AIbCs/src/adjoint.jl:67 [inlined]
[46] Pullback
@ ~/.julia/packages/GalacticOptim/bEh06/src/function/zygote.jl:8 [inlined]
[47] (::typeof(∂(λ)))(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/compiler/interface2.jl:0
[48] (::Zygote.var"#50#51"{typeof(∂(λ))})(Δ::Float64)
@ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/compiler/interface.jl:41
[49] gradient(f::Function, args::Vector{Float64})
@ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/compiler/interface.jl:76
[50] (::GalacticOptim.var"#228#238"{GalacticOptim.var"#227#237"{OptimizationFunction{true, GalacticOptim.AutoZygote, NeuralPDE.var"#loss_function_#371"{NeuralPDE.var"#354#370"{NeuralPDE.var"#352#368", NeuralPDE.var"#350#366"}, Vector{NeuralPDE.var"#270#272"{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}, UnionAll}}, Nothing, Bool, Nothing}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}})(::Vector{Float64}, ::Vector{Float64})
@ GalacticOptim ~/.julia/packages/GalacticOptim/bEh06/src/function/zygote.jl:8
[51] (::GalacticOptim.var"#104#112"{GalacticOptim.var"#103#111"{OptimizationProblem{true, OptimizationFunction{true, GalacticOptim.AutoZygote, NeuralPDE.var"#loss_function_#371"{NeuralPDE.var"#354#370"{NeuralPDE.var"#352#368", NeuralPDE.var"#350#366"}, Vector{NeuralPDE.var"#270#272"{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}, UnionAll}}, Nothing, Bool, Nothing}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, OptimizationFunction{false, GalacticOptim.AutoZygote, OptimizationFunction{true, GalacticOptim.AutoZygote, NeuralPDE.var"#loss_function_#371"{NeuralPDE.var"#354#370"{NeuralPDE.var"#352#368", NeuralPDE.var"#350#366"}, Vector{NeuralPDE.var"#270#272"{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}, UnionAll}}, Nothing, Bool, Nothing}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, GalacticOptim.var"#228#238"{GalacticOptim.var"#227#237"{OptimizationFunction{true, GalacticOptim.AutoZygote, NeuralPDE.var"#loss_function_#371"{NeuralPDE.var"#354#370"{NeuralPDE.var"#352#368", NeuralPDE.var"#350#366"}, Vector{NeuralPDE.var"#270#272"{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}, UnionAll}}, Nothing, Bool, Nothing}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}}, GalacticOptim.var"#231#241"{GalacticOptim.var"#227#237"{OptimizationFunction{true, GalacticOptim.AutoZygote, NeuralPDE.var"#loss_function_#371"{NeuralPDE.var"#354#370"{NeuralPDE.var"#352#368", NeuralPDE.var"#350#366"}, Vector{NeuralPDE.var"#270#272"{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}, UnionAll}}, Nothing, Bool, Nothing}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}}, GalacticOptim.var"#236#246", Nothing, Nothing, Nothing}}, OptimizationFunction{false, GalacticOptim.AutoZygote, OptimizationFunction{true, GalacticOptim.AutoZygote, NeuralPDE.var"#loss_function_#371"{NeuralPDE.var"#354#370"{NeuralPDE.var"#352#368", NeuralPDE.var"#350#366"}, Vector{NeuralPDE.var"#270#272"{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}, UnionAll}}, Nothing, Bool, Nothing}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, GalacticOptim.var"#228#238"{GalacticOptim.var"#227#237"{OptimizationFunction{true, GalacticOptim.AutoZygote, NeuralPDE.var"#loss_function_#371"{NeuralPDE.var"#354#370"{NeuralPDE.var"#352#368", NeuralPDE.var"#350#366"}, Vector{NeuralPDE.var"#270#272"{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}, UnionAll}}, Nothing, Bool, Nothing}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}}, GalacticOptim.var"#231#241"{GalacticOptim.var"#227#237"{OptimizationFunction{true, GalacticOptim.AutoZygote, NeuralPDE.var"#loss_function_#371"{NeuralPDE.var"#354#370"{NeuralPDE.var"#352#368", NeuralPDE.var"#350#366"}, Vector{NeuralPDE.var"#270#272"{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}, UnionAll}}, Nothing, Bool, Nothing}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}}, GalacticOptim.var"#236#246", Nothing, Nothing, Nothing}})(G::Vector{Float64}, θ::Vector{Float64})
@ GalacticOptim ~/.julia/packages/GalacticOptim/bEh06/src/solve/optim.jl:44
[52] value_gradient!!(obj::TwiceDifferentiable{Float64, Vector{Float64}, Matrix{Float64}, Vector{Float64}}, x::Vector{Float64})
@ NLSolversBase ~/.julia/packages/NLSolversBase/GRQ1x/src/interface.jl:82
[53] initial_state(method::BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Nothing, Flat}, options::Optim.Options{Float64, GalacticOptim.var"#_cb#110"{var"#61#62", BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Nothing, Flat}, Base.Iterators.Cycle{Tuple{GalacticOptim.NullData}}}}, d::TwiceDifferentiable{Float64, Vector{Float64}, Matrix{Float64}, Vector{Float64}}, initial_x::Vector{Float64})
@ Optim ~/.julia/packages/Optim/3K7JI/src/multivariate/solvers/first_order/bfgs.jl:94
[54] optimize(d::TwiceDifferentiable{Float64, Vector{Float64}, Matrix{Float64}, Vector{Float64}}, initial_x::Vector{Float64}, method::BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Nothing, Flat}, options::Optim.Options{Float64, GalacticOptim.var"#_cb#110"{var"#61#62", BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Nothing, Flat}, Base.Iterators.Cycle{Tuple{GalacticOptim.NullData}}}})
@ Optim ~/.julia/packages/Optim/3K7JI/src/multivariate/optimize/optimize.jl:35
[55] __solve(prob::OptimizationProblem{true, OptimizationFunction{true, GalacticOptim.AutoZygote, NeuralPDE.var"#loss_function_#371"{NeuralPDE.var"#354#370"{NeuralPDE.var"#352#368", NeuralPDE.var"#350#366"}, Vector{NeuralPDE.var"#270#272"{FastChain{Tuple{FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(σ), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}, FastDense{typeof(identity), DiffEqFlux.var"#initial_params#82"{Vector{Float32}}}}}, UnionAll}}, Nothing, Bool, Nothing}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, opt::BFGS{LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Nothing, Nothing, Flat}, data::Base.Iterators.Cycle{Tuple{GalacticOptim.NullData}}; maxiters::Int64, cb::Function, progress::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ GalacticOptim ~/.julia/packages/GalacticOptim/bEh06/src/solve/optim.jl:55
[56] #solve#476
@ ~/.julia/packages/SciMLBase/NwvCY/src/solve.jl:3 [inlined]
in expression starting at /Users/gabrielbirnbaum/.julia/dev/Plasma/train/1D_electrostatic.jl:71 |
Oh, maybe the change to ChainRules https://github.com/SciML/Quadrature.jl/blob/master/src/Quadrature.jl#L557-L559 I would double check that the sizes here are correct. |
What is that tuple of ints then? |
I'm unsure as well. Will try to investigate. |
I also saw similar errors after updating my packages. Though the error is a bit different with this ticket. Mine is
These show up after the following line of code
Code worked before I updated my project packages. |
This may not narrow it down too much, but the issue doesn't occur if I revert to Zygote#v0.6.17. In fact this starts to error in v0.6.19 FluxML/Zygote.jl@v0.6.18...v0.6.19 |
That means it could be a ChainRules 1.0 issue |
Yeah that makes sense. The error mentions the A general question: how does one go about debugging issues like this? Zygote and ChainRules code flows are slightly hard to follow. Are there any best practices? |
the problem should be with boundary condition - expression like @parameters x y
@variables u(..)
Dxx = Differential(x)^2
Dyy = Differential(y)^2
eq = Dxx(u(x,y)) + Dyy(u(x,y)) ~ 0.
# Initial and boundary conditions
bcs = [u(x,y) ~ u(x,y)]
# Space and time domains
domains = [x ∈ Interval(0.0,1.0),
y ∈ Interval(0.0,1.0)]
quadrature_strategy = NeuralPDE.QuadratureTraining(reltol=1e-2,abstol=1e-2,
maxiters =50, batch=100)
inner = 8
af = Flux.tanh
chain1 = FastChain(FastDense(2,inner,af),
FastDense(inner,inner,af),
FastDense(inner,1))
initθ = Float64.(DiffEqFlux.initial_params(chain1))
discretization = NeuralPDE.PhysicsInformedNN(chain1,
quadrature_strategy;
init_params = initθ)
@named pde_system = PDESystem(eq,bcs,domains,[x,y],[u(x,y)])
prob = NeuralPDE.discretize(pde_system,discretization)
Zygote.gradient(prob.f.f.loss_function,initθ)
sym_prob = NeuralPDE.symbolic_discretize(pde_system,discretization)
res = GalacticOptim.solve(prob, ADAM(0.1); cb=cb, maxiters=20) I think that Zygote breaks down on processing this line when there is used u(x,0): (x, y) = (cord[[1], :], fill(0, size(cord[[1], :]))) this part fill(0, size(cord[[1], :])) |
Any clue why Zygote isn't processing this anymore? I see v0.6.19 of Zygote (the version where this started to fail) deleted an adjoint for fill statements (see line 109 here: FluxML/Zygote.jl@v0.6.18...v0.6.19) So maybe a fix would be to add it back? |
Xref JuliaDiff/ChainRules.jl#537 ? |
The linked changes in Zygote v0.6.19 widen the signature from julia> using Zygote
julia> gradient(x -> fill(x, 3)[1][1], (1,2))
# Zygote v0.6.0
# Zygote v0.6.19
ERROR: MethodError: no method matching +(::Tuple{Int64, Nothing}, ::Nothing)
# Zygote v0.6.28
((1.0, nothing),) Can you edit the example above so that it loads every package required? |
@mcabbott I edited the example above :) |
Thanks. Can reproduce, but don't get it as a LoadError, maybe that's irrelevant... Julia 1.7:
This does not call the It's also not fixed by FluxML/Zygote.jl#1103 (which fixes more CRC type leaks) right now. The obvious place to get
Adding another method:
|
@mcabbott this (1,15) is coming from NeuralPDE.jl/src/pinns_pde_solve.jl Line 968 in 23253b9
This is how the loss function is built. function get_loss_function(loss_function, lb,ub ,eltypeθ, parameterless_type_θ,strategy::QuadratureTraining;τ=nothing)
if length(lb) == 0
loss = (θ) -> mean(abs2,loss_function(rand(eltypeθ,1,10), θ))
return loss
end
area = eltypeθ(prod(abs.(ub .-lb)))
f_ = (lb,ub,loss_,θ) -> begin
# last_x = 1
function _loss(x,θ)
# last_x = x
# mean(abs2,loss_(x,θ), dims=2)
# size_x = fill(size(x)[2],(1,1))
x = adapt(parameterless_type_θ,x)
@show x
sum(abs2,loss_(x,θ), dims=2) #./ size_x
end
prob = QuadratureProblem(_loss,lb,ub,θ,batch = strategy.batch,nout=1)
solve(prob,
strategy.quadrature_alg,
reltol = strategy.reltol,
abstol = strategy.abstol,
maxiters = strategy.maxiters)[1]
end
loss = (θ) -> 1/area* f_(lb,ub,loss_function,θ) # errors here
return loss
end |
@ChrisRackauckas @mcabbott ~~ it seems like this error was fixed with the latest Zygote release~~ EDIT: it wasn't, it worked on my local environment for some unrelated reason. However, there is now a new error showing up in the NNPDEHAN_tests. This example errors with a using Flux, Zygote, LinearAlgebra, Statistics
using Test, StochasticDiffEq
using NeuralPDE
using Random
Random.seed!(100)
# one-dimensional heat equation
x0 = [11.0f0] # initial points
tspan = (0.0f0,5.0f0)
dt = 0.5 # time step
time_steps = div(tspan[2]-tspan[1],dt)
d = 1 # number of dimensions
m = 10 # number of trajectories (batch size)
g(X) = sum(X.^2) # terminal condition
f(X,u,σᵀ∇u,p,t) = 0.0 # function from solved equation
μ_f(X,p,t) = 0.0
σ_f(X,p,t) = 1.0
prob = TerminalPDEProblem(g, f, μ_f, σ_f, x0, tspan)
hls = 10 + d #hidden layer size
opt = Flux.ADAM(0.005) #optimizer
#sub-neural network approximating solutions at the desired point
u0 = Flux.Chain(Dense(d,hls,relu),
Dense(hls,hls,relu),
Dense(hls,1))
# sub-neural network approximating the spatial gradients at time point
σᵀ∇u = [Flux.Chain(Dense(d,hls,relu),
Dense(hls,hls,relu),
Dense(hls,d)) for i in 1:time_steps]
alg = NNPDEHan(u0, σᵀ∇u, opt = opt)
ans = solve(prob, alg, verbose = true, abstol=1e-8, maxiters = 200, dt=dt, trajectories=m)
u_analytical(x,t) = sum(x.^2) .+ d*t
analytical_ans = u_analytical(x0, tspan[end])
error_l2 = sqrt((ans-analytical_ans)^2/ans^2)
println("one-dimensional heat equation")
# println("numerical = ", ans)
# println("analytical = " ,analytical_ans)
println("error_l2 = ", error_l2, "\n")
@test error_l2 < 0.1 Here is the stacktrace:
|
That looks like some ChainRules types are still leaking. Might be worth trying with FluxML/Zygote.jl#1104 which fixes quite a few such bugs. [Just tried and can't seem to install these packages locally.] CI here https://github.com/FluxML/Zygote.jl/pull/1104/checks?check_run_id=3947057934 still gets the |
@mcabbott pardon me. Forget what I said above, it seems like the But curious that it still fails on your draft PR as well! I wonder where this bug comes from. |
@killah-t-cell could you try with TuringLang/DistributionsAD.jl#202 This issue should be fixed by the linked PR. All though I suspect I'll have to write them an adjoint to merge it. |
This is what I see with the MWE in OP, if you can confirm the results u: 105-element Vector{Float64}:
0.42959385822287316
0.8153385859558028
0.2956733117400115
-0.9269163896868351
-0.41610725052663394
0.788529007842906
-0.4672638062633594
0.42176117266919466
-0.5566936525899321
-0.939474974892133
0.2560851698580619
-0.8910921964785219
-0.46272037710100034
-0.8336165217105665
-0.49261447676319536
⋮
0.09034646876988914
-0.15117509289064127
-0.13851539974648314
0.23539589937145752
0.1614260435164039
0.6194577316570241
-0.2756485616495758
-0.595470033222552
0.31399084643840547
0.7212511996796783
-0.7670958923702983
0.7249731108112188
0.4991804995937005
0.07514818316204416 |
@DhairyaLGandhi yes the MWE seems to work for me as well. |
I also checked, TuringLang/DistributionsAD.jl#202 works for MWE |
The fix PR is being continued here I think TuringLang/DistributionsAD.jl#203 |
Any updates on FluxML/Zygote.jl#1104 @mcabbott @DhairyaLGandhi? Merging it would unblock TuringLang/DistributionsAD.jl#203 and solve this issue. |
Yeah let's merge this, so we can unbreak the ecosystem first, and fix zygote after. |
A new release of DistributionsAD with the fix is available. |
Works great! Thanks! |
Seems like the 2D Poisson equation with Neural adapter test is broken. I tested it in master and it failed. Seems to be related to ChainRulesCore.
The text was updated successfully, but these errors were encountered: