Monty.Frameworks.Models.NoResetEvidenceMatching.MontyForNoResetEvidenceGraphMatching (ExTbpMonty.Core v0.1.0)

Copy Markdown View Source

The model an unsupervised-inference run starts: one that is never told an episode has ended.

Mirrors frameworks/models/no_reset_evidence_matching.py::MontyForNoResetEvidenceGraphMatching. Monty's ordinary model begins an episode by resetting its modules, which throws away their hypotheses and the evidence behind them; this one begins an episode by resetting the counters — the step counts, the terminal states, the motor system's place in its policy — and empties the buffers. What the modules believe survives, because in the experiment this class was written for the object under the sensor changes with no signal announcing it, and the model has to discover the change from evidence falling away. It is intended for evaluation-only runs against a pretrained model, with Monty in the matching phase throughout.

What a run of this class keeps, and what it forgets

Kept across an object change: the hypothesis space of every module, the evidence of each hypothesis, the most likely hypothesis, the goal generator's schedule, each sensor's delta-filter memory, the record of what each sensor was on at every step (stepwise_targets_list), and where the sensor was — which is why NoResetEvidenceGraphLM remembers that itself.

Forgotten: the step counters, the modules' conclusions and the objects and poses they named, each module's buffer of observations, each sensor's processed observations, and the model's done?.

One difference from Monty, on purpose

Monty's class resets fully once and skips the full reset afterwards, because some of its modules' fields are only initialised by reset() and graphs are loaded after construction (__init__'s comment says so). Neither is true here: EvidenceGraphLM.new/2 ends in reset_stm/1, and a learning module is built with the memory it will match against, so a module is fully initialised before the first episode. The distinction therefore has no work to do, and every reset is the partial one — which is also what Monty's first reset amounts to on a module that is already initialised.

What is not carried

Monty's snapshot/0 and restore/1 copy the model's state_dict so a run can be forked and compared. This port has no state_dict for a model — the modules are processes and the memory they hold travels as a GraphMemory — so there is nothing here to copy; docs/training.md says where a learned memory is written instead.

Summary

Functions

The model as something a supervisor can start.

Whether the model has concluded this episode.

MontyForGraphMatching.fixme_set_ground_truth: what this episode is about.

Clears short-term memory for a new episode, as this class defines it.

reset/0, as this class means it: the episode starts again, what the modules believe does not.

MontyBase.set_experiment_mode: whether this episode trains or evaluates.

fixme_set_ground_truth: the object this episode is about, told to the modules without emptying their record of what the sensor was on.

The coordinator's state, which is where an episode's conclusion lives.

The four things a recognition policy may read off the model.

One timestep: what the modules were given and what they made of it.

Stops the model's processes.

MontySupervisedObjectPretrainingExperiment._pass_target_info_to_model.

Monty.switch_to_exploratory_step: what a recognition policy can ask for.

Monty.time_out_lms: what a recognition policy can ask for instead of stopping.

MontyBase.update_ltm: write the episode into long-term memory.

Functions

child_spec(spec)

@spec child_spec(map()) :: Supervisor.child_spec()

The model as something a supervisor can start.

Monty's constructor builds the model; here it is spec — what the config resolved to — and starting it is the runtime's.

done?(model_id)

@spec done?(atom() | String.t()) :: boolean()

Whether the model has concluded this episode.

fixme_set_ground_truth(model_id, primary_target, opts \\ [])

@spec fixme_set_ground_truth(atom() | String.t(), map() | nil, keyword()) :: :ok

MontyForGraphMatching.fixme_set_ground_truth: what this episode is about.

reset_episode(model_id)

@spec reset_episode(atom() | String.t()) :: :ok

Clears short-term memory for a new episode, as this class defines it.

reset_episode_state(state)

@spec reset_episode_state(Monty.Runtime.Step.State.t()) ::
  Monty.Runtime.Step.State.t()

reset/0, as this class means it: the episode starts again, what the modules believe does not.

Monty's _reset_terminal_states (lm.set_individual_ts(None)) and _reset_modules_buffers (lm.buffer.reset(), sm.processed_obs = []), after reset_episode_steps() and switch_to_matching_step(). The motor system is deliberately not reset: Monty's override does not reset it either, and a policy that forgot its last action would have to find the object again after every object change.

set_experiment_mode(model_id, mode)

MontyBase.set_experiment_mode: whether this episode trains or evaluates.

set_ground_truth_state(state, primary_target, opts)

@spec set_ground_truth_state(Monty.Runtime.Step.State.t(), map() | nil, keyword()) ::
  Monty.Runtime.Step.State.t()

fixme_set_ground_truth: the object this episode is about, told to the modules without emptying their record of what the sensor was on.

Monty's override writes lm.primary_target and lm.primary_target_rotation_quat itself instead of calling lm.fixme_reset_ground_truth, which would clear stepwise_targets_list — the only record of which object the sensor was on at every step of a run that never restarts.

state(model_id)

@spec state(atom() | String.t()) :: Monty.Runtime.Step.State.t()

The coordinator's state, which is where an episode's conclusion lives.

status(model_id)

The four things a recognition policy may read off the model.

step(model_id, observations, proprioceptive_state, ctx)

@spec step(atom() | String.t(), map(), map(), Monty.Context.t()) ::
  {:ok, [map()], map()}

One timestep: what the modules were given and what they made of it.

stop(model_id)

@spec stop(atom() | String.t()) :: :ok | {:error, :not_found}

Stops the model's processes.

supervise(model_id, target, location_on_model, supervised_ids)

@spec supervise(atom() | String.t(), map(), [number()], [String.t()]) :: :ok

MontySupervisedObjectPretrainingExperiment._pass_target_info_to_model.

switch_to_exploratory_step(model_id)

@spec switch_to_exploratory_step(atom() | String.t()) :: :ok

Monty.switch_to_exploratory_step: what a recognition policy can ask for.

time_out(model_id)

@spec time_out(atom() | String.t()) :: :ok

Monty.time_out_lms: what a recognition policy can ask for instead of stopping.

update_ltm(model_id)

@spec update_ltm(atom() | String.t()) :: :ok

MontyBase.update_ltm: write the episode into long-term memory.