Skip to content

get_initial_values does not forward kwargs properly #951

Closed
@DhairyaLGandhi

Description

@DhairyaLGandhi

Describe the bug 🐞

get_initial_values(..., ::OverrideInit, ...) does not pass in kwargs to the actual solve call. This can lead to falling back to automatic sensealg selection even if a sensealg is passed, causing extra latency. Ref

function get_initial_values(prob, valp, f, alg::OverrideInit,
and SciML/SciMLSensitivity.jl#1168

cc @SebastianM-C

Expected behavior

A clear and concise description of what you expected to happen.

Minimal Reproducible Example 👇

Without MRE, we would only be able to help you to a limited extent, and attention to the issue would be limited. to know more about MRE refer to wikipedia and stackoverflow.

using SciMLStructures
using SciMLBase
using SciMLSensitivity

_prob = ODEProblem(...)
tunables, repack, _ = canonicalize(Tunable(), parameter_values(_prob))
gradient(tunables) do tunables
    prob = remake(_prob, p = repack(tunables))
    new_u0, new_p, _ = SciMLBase.get_initial_values(prob, prob, prob.f, SciMLBase.OverrideInit(), Val(true); sensealg = GaussAdjoint(autojacvec = ZygoteVJP()))
    sum(new_u0) + sum(new_p.tunable)
end
┌ Warning: Potential performance improvement omitted. ReverseDiffVJP tried and failed in the automated AD choice algorithm. To show the stack trace, set SciMLSensitivity.STACKTRACE_WITH_VJPWARN[] = true. To turn off this printing, add `verbose = false` to the `solve` call.
└ @ SciMLSensitivity ~/Downloads/arpa/jsmo/t2/SciMLSensitivity.jl/src/concrete_solve.jl:67

Environment (please complete the following information):

  • Output of using Pkg; Pkg.status()
  • Output of using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
  • Output of versioninfo()

Additional context

Add any other context about the problem here.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions