releso.agent.PretrainedAgent
- class releso.agent.PretrainedAgent(*, save_location: Path, logger_name: str | None = None, tensorboard_log: str | None = None, type: Literal['PPO', 'SAC', 'DDPG', 'A2C', 'DQN'], path: FilePath | Path, tesorboard_run_directory: str | Path | None = None)
Bases:
BaseAgentPretrained agent definition.
This class can be used to load pretrained agents, instead of using untrained agents. Can also be used to only validate this agent without training it further. Please see validation section for this use-case.
- __init__(**data: Any) None
Constructor for the ReLeSO basemodel object.
Methods
convert_to_pathlib_add_datetime(v)Add timestamp to save_location, of applicable.
get_agent(environment[, normalizer_divisor])Tries to locate the agent defined and to load it correctly.
get_logger()Gets the currently defined environment logger.
Return the name of the tensorboard experiment.
set_logger_name_recursively(logger_name)Set the logger_name variable for all child elements.
Attributes
What RL algorithm was used to train the agent.
Path to the save files of the pretrained agent.
tesorboard_run_directorytensorboard_logbase directory of the tensorboard logs if given an experiment name with a current timestamp is also added.
save_locationDefinition of the save location of the logs and validation results.
logger_namename of the logger.
- agent_type: Literal['PPO', 'SAC', 'DDPG', 'A2C', 'DQN']
What RL algorithm was used to train the agent. Needs to be know to correctly load the agent.
- get_agent(environment: GymEnvironment, normalizer_divisor: int = 1) BaseAlgorithm
Tries to locate the agent defined and to load it correctly.
- Parameters:
environment (GymEnvironment) – Environment with which the agent will
interact.
normalizer_divisor (int) – Currently not used in this function.
- Raises:
AgentUnknownException – Possible exception which can be
thrown. –
- Returns:
Return the correctly loaded agent.
- Return type:
BaseAlgorithm
- get_next_tensorboard_experiment_name() str | None
Return the name of the tensorboard experiment.
The tensorboard experiment name of the original training run if given else a new one with the current time stamp.
- Returns:
tensorboard experiment name
- Return type:
str
- path: FilePath | Path
Path to the save files of the pretrained agent.