Hello everyone,
I’m running inference for my model using Turing.jl. I’m getting this warning and error but i’m not sure from where its coming and how can I get to that point.
Can someone explain what it is about? and how can I troubleshoot.
As it was a long error msg i trimmed it by removing some from middle.
┌ Warning: First function call produced NaNs. Exiting. Double check that none of the initial conditions, parameters, or timespan values are NaN.
└ @ OrdinaryDiffEq ~/.julia/packages/OrdinaryDiffEq/SUoOD/src/initdt.jl:131
ERROR: ArgumentError: matrix contains Infs or NaNs
Stacktrace:
[1] chkfinite
@ ~/.local/julia-1.9.0/share/julia/stdlib/v1.9/LinearAlgebra/src/lapack.jl:86 [inlined]
[2] generic_lufact!(A::Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}, pivot::RowMaximum; check::Bool)
@ LinearAlgebra ~/.local/julia-1.9.0/share/julia/stdlib/v1.9/LinearAlgebra/src/lu.jl:135
[3] generic_lufact!
@ ~/.local/julia-1.9.0/share/julia/stdlib/v1.9/LinearAlgebra/src/lu.jl:133 [inlined]
[4] do_factorization
@ ~/.julia/packages/LinearSolve/3dHoj/src/factorization.jl:97 [inlined]
[5] macro expansion
@ ~/.julia/packages/LinearSolve/3dHoj/src/LinearSolve.jl:96 [inlined]
[6] solve!(cache::LinearSolve.LinearCache{Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}, SciMLBase.NullParameters, LinearSolve.DefaultLinearSolver, LinearSolve.DefaultLinearSolverInit{LU{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}, Vector{Int64}}, LinearAlgebra.QRCompactWY{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}, Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, LU{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}, Vector{Int64}}, Tuple{LU{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}, Vector{Int64}}, Vector{Int64}}, Nothing, Nothing, Nothing, SVD{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}}, Cholesky{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}}, Cholesky{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}}}, LinearSolve.InvPreconditioner{Diagonal{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}}}, Diagonal{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}}, Float64, Bool}, alg::GenericLUFactorization{RowMaximum}; kwargs::Base.Pairs{Symbol, ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Tuple{Symbol}, NamedTuple{(:reltol,), Tuple{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}}})
@ LinearSolve ~/.julia/packages/LinearSolve/3dHoj/src/LinearSolve.jl:92
[7] solve!
@ ~/.julia/packages/LinearSolve/3dHoj/src/LinearSolve.jl:92 [inlined]
[8] macro expansion
@ ~/.julia/packages/LinearSolve/3dHoj/src/default.jl:313 [inlined]
[9] solve!(::LinearSolve.LinearCache{Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}, SciMLBase.NullParameters, LinearSolve.DefaultLinearSolver, LinearSolve.DefaultLinearSolverInit{LU{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}, Vector{Int64}}, LinearAlgebra.QRCompactWY{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}, Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, LU{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}, Vector{Int64}}, Tuple{LU{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}, Vector{Int64}}, Vector{Int64}}, Nothing, Nothing, Nothing, SVD{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}}, Cholesky{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}}, Cholesky{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Matrix{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}}}, LinearSolve.InvPreconditioner{Diagonal{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}}}, Diagonal{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}}, Float64, Bool}, ::LinearSolve.DefaultLinearSolver; assump::OperatorAssumptions{Nothing}, kwargs::Base.Pairs{Symbol, ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}, Tuple{Symbol}, NamedTuple{(:reltol,), Tuple{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 11}}}})
@ LinearSolve ~/.julia/packages/LinearSolve/3dHoj/src/default.jl:306
[10] solve!
@ ~/.julia/packages/LinearSolve/3dHoj/src/default.jl:306 [inlined]
[11] #solve!#6
@ ~/.julia/packages/LinearSolve/3dHoj/src/common.jl:197 [inlined]
[12] solve!
@ ~/.julia/packages/LinearSolve/3dHoj/src/common.jl:196 [inlined]
[13] #dolinsolve#3
@ ~/.julia/packages/OrdinaryDiffEq/SUoOD/src/misc_utils.jl:107 [inlined]
[14] dolinsolve
@ ~/.julia/packages/OrdinaryDiffEq/SUoOD/src/misc_utils.jl:83 [inlined]
[59] sample
@ ~/.julia/packages/Turing/FSBW7/src/inference/Inference.jl:242 [inlined]
[60] #sample#7
@ ~/.julia/packages/Turing/FSBW7/src/inference/Inference.jl:238 [inlined]
[61] sample
@ ~/.julia/packages/Turing/FSBW7/src/inference/Inference.jl:229 [inlined]
[62] #sample#6
@ ~/.julia/packages/Turing/FSBW7/src/inference/Inference.jl:225 [inlined]
[63] sample(model::DynamicPPL.Model{typeof(fit_CTL), (:data, :prob), (), (), Tuple{Vector{Matrix{Union{Missing, Float64}}}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, typeof(Affinity), UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}}, Tuple{}, DynamicPPL.DefaultContext}, alg::NUTS{Turing.Essential.ForwardDiffAD{0}, (), AdvancedHMC.DiagEuclideanMetric}, ensemble::MCMCSerial, N::Int64, n_chains::Int64)
@ Turing.Inference ~/.julia/packages/Turing/FSBW7/src/inference/Inference.jl:217