Skip to content

remake is broken with Bool parameters #2866

Closed
@acertain

Description

@acertain

I think this is just an issue with the type of narrow_buffer_type_and_fallback_undefs, replacing oldbuf::Vector with oldbuf seems to fix it

Stacktrace:

typeof(paramater_values): ModelingToolkit.MTKParameters{Tuple{Vector{Float64}, BitVector}, Tuple{}, Tuple{}, Tuple{}, Tuple{}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x286de1e8, 0x5429cf97, 0xad711212, 0x61198482, 0x72e1544e), Nothing}, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋arg1, :ˍ₋arg2), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xa3eacb0b, 0xf0d43f15, 0x0892eac8, 0xcd118675, 0x41ae66ba), Nothing}}
paramater_values.tunable: ([13750.987083139758, 12.333333333333334, 20.35, 212400.0, 0.5, 0.00011666666666666667, 37.0, 9500.0, 0.032, 9500.0, 0.13, 100.0, 0.5, 0.4, 13750.987083139758, 0.5, 0.0016666666666666668, 87120.0, 86634.78025448967, 0.5, 36000.0], Bool[1])
ERROR: MethodError: no method matching narrow_buffer_type_and_fallback_undefs(::BitVector, ::Vector{Any})

Closest candidates are:
  narrow_buffer_type_and_fallback_undefs(::Vector, ::Vector)
   @ ModelingToolkit ~/.julia/packages/ModelingToolkit/U2JaS/src/systems/parameter_buffer.jl:427

Stacktrace:
  [1] _broadcast_getindex_evalf
    @ ./broadcast.jl:709 [inlined]
  [2] _broadcast_getindex
    @ ./broadcast.jl:682 [inlined]
  [3] (::Base.Broadcast.var"#31#32"{Base.Broadcast.Broadcasted{…}})(k::Int64)
    @ Base.Broadcast ./broadcast.jl:1118
  [4] ntuple
    @ ./ntuple.jl:49 [inlined]
  [5] copy
    @ ./broadcast.jl:1118 [inlined]
  [6] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.Style{…}, Nothing, typeof(ModelingToolkit.narrow_buffer_type_and_fallback_undefs), Tuple{…}})
    @ Base.Broadcast ./broadcast.jl:903
  [7] macro expansion
    @ ~/.julia/packages/Setfield/PdKfV/src/sugar.jl:197 [inlined]
  [8] remake_buffer(indp::SciMLBase.ODEProblem{…}, oldbuf::ModelingToolkit.MTKParameters{…}, vals::Dict{…})
    @ ModelingToolkit ~/.julia/packages/ModelingToolkit/U2JaS/src/systems/parameter_buffer.jl:520
  [9] _updated_u0_p_symmap(prob::SciMLBase.ODEProblem{…}, u0::Vector{…}, ::Val{…}, p::Dict{…}, ::Val{…})
    @ SciMLBase ~/.julia/packages/SciMLBase/rR75x/src/remake.jl:494
 [10] _updated_u0_p_internal(prob::SciMLBase.ODEProblem{…}, ::Missing, p::Vector{…}; interpret_symbolicmap::Bool, use_defaults::Bool)
    @ SciMLBase ~/.julia/packages/SciMLBase/rR75x/src/remake.jl:404
 [11] _updated_u0_p_internal
    @ ~/.julia/packages/SciMLBase/rR75x/src/remake.jl:393 [inlined]
 [12] #updated_u0_p#695
    @ ~/.julia/packages/SciMLBase/rR75x/src/remake.jl:556 [inlined]
 [13] updated_u0_p
    @ ~/.julia/packages/SciMLBase/rR75x/src/remake.jl:537 [inlined]
 [14] remake(prob::SciMLBase.ODEProblem{…}; f::Missing, u0::Missing, tspan::Missing, p::Vector{…}, kwargs::Missing, interpret_symbolicmap::Bool, use_defaults::Bool, _kwargs::@Kwargs{})
    @ SciMLBase ~/.julia/packages/SciMLBase/rR75x/src/remake.jl:100
 [15] simulate(__model__::DynamicPPL.Model{…}, __varinfo__::DynamicPPL.UntypedVarInfo{…}, __context__::DynamicPPL.DebugUtils.DebugContext{…}, events::Vector{…}, sys::ModelingToolkit.ODESystem, prob::SciMLBase.ODEProblem{…}; evaluate::Bool)
    @ QSelf ~/Sync/Code/scripts/qself/julia/src/QSelf.jl:71
 [16] simulate
    @ ~/Sync/Code/scripts/qself/julia/src/QSelf.jl:64 [inlined]
 [17] _evaluate!!
    @ ~/.julia/packages/DynamicPPL/Lj3Lu/src/model.jl:973 [inlined]
 [18] evaluate_threadunsafe!!
    @ ~/.julia/packages/DynamicPPL/Lj3Lu/src/model.jl:946 [inlined]
 [19] check_model_and_trace(rng::Random.TaskLocalRNG, model::DynamicPPL.Model{…}; varinfo::DynamicPPL.UntypedVarInfo{…}, context::DynamicPPL.SamplingContext{…}, error_on_failure::Bool, kwargs::@Kwargs{})
    @ DynamicPPL.DebugUtils ~/.julia/packages/DynamicPPL/Lj3Lu/src/debug_utils.jl:598
 [20] check_model_and_trace
    @ ~/.julia/packages/DynamicPPL/Lj3Lu/src/debug_utils.jl:581 [inlined]
 [21] #check_model_and_trace#8
    @ ~/.julia/packages/DynamicPPL/Lj3Lu/src/debug_utils.jl:579 [inlined]
 [22] check_model_and_trace
    @ ~/.julia/packages/DynamicPPL/Lj3Lu/src/debug_utils.jl:578 [inlined]
 [23] check_model
    @ ~/.julia/packages/DynamicPPL/Lj3Lu/src/debug_utils.jl:624 [inlined]
 [24] _check_model
    @ ~/.julia/packages/Turing/axR9Q/src/mcmc/Inference.jl:246 [inlined]
 [25] _check_model
    @ ~/.julia/packages/Turing/axR9Q/src/mcmc/Inference.jl:249 [inlined]
 [26] #sample#6
    @ ~/.julia/packages/Turing/axR9Q/src/mcmc/Inference.jl:299 [inlined]
 [27] sample
    @ ~/.julia/packages/Turing/axR9Q/src/mcmc/Inference.jl:289 [inlined]
 [28] #sample#5
    @ ~/.julia/packages/Turing/axR9Q/src/mcmc/Inference.jl:285 [inlined]
 [29] sample
    @ ~/.julia/packages/Turing/axR9Q/src/mcmc/Inference.jl:277 [inlined]
 [30] #run_inference#37
    @ ~/Sync/Code/scripts/qself/julia/src/QSelf.jl:129 [inlined]
 [31] run_inference(m::DynamicPPL.Model{typeof(QSelf.simulate), (:events, :sys, :prob), (:evaluate,), (), Tuple{…}, Tuple{…}, DynamicPPL.DefaultContext})
    @ QSelf ~/Sync/Code/scripts/qself/julia/src/QSelf.jl:127
 [32] main()
    @ QSelf ~/Sync/Code/scripts/qself/julia/src/QSelf.jl:148
 [33] top-level scope
    @ REPL[18]:1
Some type information was truncated. Use `show(err)` to see complete types.

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