# MethodError: ADgradient(::Val{:ForwardDiff}, ::LogDensityFunction{DynamicPPL.TypedVarInfo

**URL:** https://discourse.julialang.org/t/methoderror-adgradient-val-forwarddiff-logdensityfunction-dynamicppl-typedvarinfo/103509
**Category:** General Usage
**Tags:** ode, turing
**Created:** [September 4, 2023, 1:26pm UTC](https://discourse.julialang.org/t/methoderror-adgradient-val-forwarddiff-logdensityfunction-dynamicppl-typedvarinfo/103509 "2023-09-04T13:26:09Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![99dB](https://avatars.discourse-cdn.com/v4/letter/9/838e76/32.png) [@99dB](https://discourse.julialang.org/u/99dB)
#### Post date: [September 4, 2023, 1:26pm UTC](https://discourse.julialang.org/t/methoderror-adgradient-val-forwarddiff-logdensityfunction-dynamicppl-typedvarinfo/103509/1 "2023-09-04T13:26:09Z")

</div>

Hello all,

When sampling a Turing problem involving an ode I got, the following error message:

```julia
MethodError: ADgradient(::Val{:ForwardDiff}, ::LogDensityFunction{DynamicPPL.TypedVarInfo

Closest candidates are:
  ADgradient(::Val{:ForwardDiff}, ::Any; chunk, tag, x) at ~/.julia/packages/LogDensityProblemsAD/pwc6T/ext/LogDensityProblemsADForwardDiffExt.jl:98 got unsupported keyword argument "gradientconfig"
  ADgradient(::Val{kind}, ::Any; kwargs...) where kind at ~/.julia/packages/LogDensityProblemsAD/pwc6T/src/LogDensityProblemsAD.jl:68
  ADgradient(::ADTypes.AutoForwardDiff{C}, ::Any) where C at ~/.julia/packages/LogDensityProblemsAD/pwc6T/ext/LogDensityProblemsADADTypesExt.jl:31 got unsupported keyword argument "gradientconfig"

```

I am not sure to understand because I have a version that is working well and the only thing that I am doing in this new version is adding a new parameter in the ode model and I can solve the ode correctly outside Turing.

Any ideas are welcome 🙂

Thanks a lot.

---

<div class="post-metadata">

### Author: ![sethaxen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sethaxen/32/35604_2.png) [@sethaxen](https://discourse.julialang.org/u/sethaxen)
#### Post date: [September 4, 2023, 1:32pm UTC](https://discourse.julialang.org/t/methoderror-adgradient-val-forwarddiff-logdensityfunction-dynamicppl-typedvarinfo/103509/2 "2023-09-04T13:32:22Z")

</div>

Can you share a minimal working example?

---

<div class="post-metadata">

### Author: ![99dB](https://avatars.discourse-cdn.com/v4/letter/9/838e76/32.png) [@99dB](https://discourse.julialang.org/u/99dB)
#### Post date: [September 4, 2023, 2:25pm UTC](https://discourse.julialang.org/t/methoderror-adgradient-val-forwarddiff-logdensityfunction-dynamicppl-typedvarinfo/103509/3 "2023-09-04T14:25:21Z")

</div>

So I am using VSC to edit my code in Julia and I installed an extensions called `latex-input`: [latex-input - Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=yellpika.latex-input)

Now even my other codes are not working anymore so I think it may come from it. I disabled the package but it looks like it does not help. Do you think it can come from this?

---

<div class="post-metadata">

### Author: ![99dB](https://avatars.discourse-cdn.com/v4/letter/9/838e76/32.png) [@99dB](https://discourse.julialang.org/u/99dB)
#### Post date: [September 4, 2023, 2:34pm UTC](https://discourse.julialang.org/t/methoderror-adgradient-val-forwarddiff-logdensityfunction-dynamicppl-typedvarinfo/103509/4 "2023-09-04T14:34:03Z")

</div>

If you run this example from the Turing tutorials: [https://turing.ml/v0.22/tutorials/10-bayesian-differential-equations/](https://turing.ml/v0.22/tutorials/10-bayesian-differential-equations/)

I got now this error and then it looks like it is from my local Julia because the tutorial is usually working well …

> ERROR: MethodError: no method matching ADgradient(::Val{:ForwardDiff}, ::LogDensityFunction{DynamicPPL.TypedVarInfo{NamedTuple{(:σ, :α, :β, :γ, :δ), Tuple{DynamicPPL.Metadata{Dict{AbstractPPL.VarName{:σ, Setfield.IdentityLens}, Int64}, Vector{InverseGamma{Float64}}, Vector{AbstractPPL.VarName{:σ, Setfield.IdentityLens}}, Vector{Float64}, Vector{Set{DynamicPPL.Selector}}}, DynamicPPL.Metadata{Dict{AbstractPPL.VarName{:α, Setfield.IdentityLens}, Int64}, Vector{Truncated{Normal{Float64}, Continuous, Float64}}, Vector{AbstractPPL.VarName{:α, Setfield.IdentityLens}}, Vector{Float64}, Vector{Set{DynamicPPL.Selector}}}, DynamicPPL.Metadata{Dict{AbstractPPL.VarName{:β, Setfield.IdentityLens}, Int64}, Vector{Truncated{Normal{Float64}, Continuous, Float64}}, Vector{AbstractPPL.VarName{:β, Setfield.IdentityLens}}, Vector{Float64}, Vector{Set{DynamicPPL.Selector}}}, DynamicPPL.Metadata{Dict{AbstractPPL.VarName{:γ, Setfield.IdentityLens}, Int64}, Vector{Truncated{Normal{Float64}, Continuous, Float64}}, Vector{AbstractPPL.VarName{:γ, Setfield.IdentityLens}}, Vector{Float64}, Vector{Set{DynamicPPL.Selector}}}, DynamicPPL.Metadata{Dict{AbstractPPL.VarName{:δ, Setfield.IdentityLens}, Int64}, Vector{Truncated{Normal{Float64}, Continuous, Float64}}, Vector{AbstractPPL.VarName{:δ, Setfield.IdentityLens}}, Vector{Float64}, Vector{Set{DynamicPPL.Selector}}}}}, Float64}, DynamicPPL.Model{typeof(fitlv), (:data, :prob), (), (), Tuple{Matrix{Float64}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, typeof(lotka\_volterra), 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}, DynamicPPL.SamplingContext{DynamicPPL.Sampler{NUTS{Turing.Essential.ForwardDiffAD{0}, (), AdvancedHMC.DiagEuclideanMetric}}, DynamicPPL.DefaultContext, Random.\_GLOBAL\_RNG}}; gradientconfig=ForwardDiff.GradientConfig{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 5, Vector{ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 5}}}((Partials(1.0, 0.0, 0.0, 0.0, 0.0), Partials(0.0, 1.0, 0.0, 0.0, 0.0), Partials(0.0, 0.0, 1.0, 0.0, 0.0), Partials(0.0, 0.0, 0.0, 1.0, 0.0), Partials(0.0, 0.0, 0.0, 0.0, 1.0)), ForwardDiff.Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}, Float64, 5}[Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}}(2.3546804574e-314,2.3546663153e-314,0.0,2.3546663627e-314,2.96e-322,2.3546804574e-314), Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}}(2.3546663153e-314,0.0,2.3546804574e-314,2.3546663153e-314,0.0,2.3546804574e-314), Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}}(2.3546663153e-314,0.0,5.685154233e-314,5.685154233e-314,0.0,2.3546804574e-314), Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}}(2.3546663153e-314,0.0,2.3546804574e-314,2.3546663153e-314,0.0,2.3546804574e-314), Dual{ForwardDiff.Tag{Turing.TuringTag, Float64}}(2.3546663153e-314,0.0,2.3546804574e-314,2.3546663153e-314,0.0,2.3546804574e-314)]))  
> Closest candidates are:  
> ADgradient(::Val{:ForwardDiff}, ::Any; chunk, tag, x) at ~/.julia/packages/LogDensityProblemsAD/pwc6T/ext/LogDensityProblemsADForwardDiffExt.jl:98 got unsupported keyword argument “gradientconfig”  
> ADgradient(::Val{kind}, ::Any; kwargs…) where kind at ~/.julia/packages/LogDensityProblemsAD/pwc6T/src/LogDensityProblemsAD.jl:68  
> ADgradient(::ADTypes.AutoForwardDiff{C}, ::Any) where C at ~/.julia/packages/LogDensityProblemsAD/pwc6T/ext/LogDensityProblemsADADTypesExt.jl:31 got unsupported keyword argument “gradientconfig”

---

<div class="post-metadata">

### Author: ![99dB](https://avatars.discourse-cdn.com/v4/letter/9/838e76/32.png) [@99dB](https://discourse.julialang.org/u/99dB)
#### Post date: [September 4, 2023, 3:12pm UTC](https://discourse.julialang.org/t/methoderror-adgradient-val-forwarddiff-logdensityfunction-dynamicppl-typedvarinfo/103509/5 "2023-09-04T15:12:25Z")

</div>

I updated my Julia to version 1.9.3 and it resolved the problem, but if someone understand what was the issue it would be nice to know.
