From 3f2ea4e40ee8ecec395988b1ce55d7c5d94abdcc Mon Sep 17 00:00:00 2001
From: DhairyaLGandhi <dhairya@juliacomputing.com>
Date: Mon, 29 Jul 2024 19:12:38 +0530
Subject: [PATCH] chore: update callbacks forward mode path to SciMLSensitivity

---
 src/concrete_solve.jl | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/concrete_solve.jl b/src/concrete_solve.jl
index 70977b932..14a915562 100644
--- a/src/concrete_solve.jl
+++ b/src/concrete_solve.jl
@@ -661,12 +661,15 @@ function DiffEqBase._concrete_solve_adjoint(prob::SciMLBase.AbstractODEProblem,
         args...;
         save_idxs = nothing,
         kwargs...)
-    if !(p isa Union{Nothing, SciMLBase.NullParameters, AbstractArray}) ||
-       (p isa AbstractArray && !Base.isconcretetype(eltype(p)))
-        throw(ForwardSensitivityParameterCompatibilityError())
+    if p === nothing || p isa SciMLBase.NullParameters
+        tunables, repack = p, identity
+    elseif isscimlstructure(p)
+        tunables, repack, _ = canonicalize(Tunable(), p)
+    else
+        throw(SciMLStructuresCompatibilityError())
     end
 
-    if p isa AbstractArray && eltype(p) <: ForwardDiff.Dual &&
+    if tunables isa AbstractArray && eltype(tunables) <: ForwardDiff.Dual &&
        !(eltype(u0) <: ForwardDiff.Dual)
         # Handle double differentiation case
         u0 = eltype(p).(u0)