opto.trainer.algorithms.algorithm¶
AbstractAlgorithm ¶
Trainer ¶
Bases: AbstractAlgorithm
We define the API of algorithms to train an agent from a dataset of (x, info) pairs.
agent: trace.Module (e.g. constructed by @trace.model) teacher: (question, student_answer, info) -> score, feedback (e.g. info can contain the true answer) train_dataset: dataset of (x, info) pairs
save_agent ¶
Save the agent to the specified path.
Args: save_path: Path to save the agent to. iteration: Current iteration number (for logging purposes).
Returns: str: The path where the agent was saved.