axon
axon copied to clipboard
Separate state parameters and actual parameters in parameter map
Related to #453 by grouping these together in the same part of the map we've run into lots of issues with state getting updated when it was not meant to be. I propose we make an adjustment to how Axon stores parameters by partitioning the map into parameters and state:
%{
parameters: %{...},
state: %{...}
}
Then it should be clear what works on what. This could even be a struct if we want additional strictness
Thinking about this I am considering doing the following:
Creating a struct %Axon.ModelState{parameters: ..., state: ...} and then adding methods:
def update_state(%ModelState{}, state) :: model_state
def update_parameters(%ModelState{}, parameters) :: model_state
And then those will replace what's currently in Axon.Updates and Axon.Loop.
cc @jonatanklosko because this would require Bumblebee changes
For more context, this would prevent model state from being passed through Axon.Updates as this is unnecessary. So you'd only pass parameters to those and then update the state elsewhere.
Resolved in #553