Tester
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) -> NoneTester 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; seeAgent.
Properties
env_states
env_states: list[TesterEnvironmentState]Get the environment states.
Returns:
list[TesterEnvironmentState]– The list of TesterEnvironmentState instances.
tester_model
tester_model: torch.nn.ModuleGet the tester model.
Returns:
Module– The model used for greedy action selection.
Methods
run
run() -> NoneMain loop for the Tester, running greedy evaluation episodes.
update_model
update_model(source_model: torch.nn.Module) -> NoneStage 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.