Skip to content

Tester ​

python
Tester(context: RuntimeContext[ConfigT], tester_model: torch.nn.Module, action_selector: ActionSelector, episode_observer: Callable[[dict[str, float], int], None] | None = None, milestone_observer: Callable[[dict[str, float], int, bool], None] | None = None, env_factory: Callable[[], OakEmuMultiEnv] | None = None) -> None

Tester component responsible for evaluating the current model with pure greedy inference.

Unlike the Trainer, the Tester does not use exploration or a replay buffer. It provides unbiased performance metrics by running episodes with greedy action selection only. When the model is updated, the Tester drains all in-progress episodes before syncing the new weights to ensure no episode straddles a model update.

Initialize the Tester.

Parameters:

  • context (RuntimeContext[[Tester[ConfigT]](#mrkwatkins.oakemu_rl.framework.agents.Tester.Tester[ConfigT])]) – The shared runtime context.
  • tester_model (Module) – The model for greedy action selection (separate copy).
  • action_selector (ActionSelector) – The action selector for choosing actions.
  • episode_observer (Callable[[dict[str, float], int], None] | None) – Optional callback notified after each completed tester episode.
  • milestone_observer (Callable[[dict[str, float], int, bool], None] | None) – Optional callback notified after each completed tester episode with win state.
  • env_factory (Callable[[], OakEmuMultiEnv] | None) – Optional multi-environment factory; see Agent.

Source

Properties ​

env_states ​

python
env_states: list[TesterEnvironmentState]

Get the environment states.

Returns:

  • list[TesterEnvironmentState] – The list of TesterEnvironmentState instances.

Source

tester_model ​

python
tester_model: torch.nn.Module

Get the tester model.

Returns:

  • Module – The model used for greedy action selection.

Source

Methods ​

run ​

python
run() -> None

Main loop for the Tester, running greedy evaluation episodes.

Source

update_model ​

python
update_model(source_model: torch.nn.Module) -> None

Stage the source model's weights for the tester model and signal a pending update.

Called by the learner loop after model update. The weights are applied once every in-progress tester episode has finished, so no episode straddles the swap.

Parameters:

  • source_model (Module) – The updated model to copy weights from.

Source