unreal.LearningAgentsImitationTrainer
¶
- class unreal.LearningAgentsImitationTrainer(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
LearningAgentsManagerListener
The ULearningAgentsImitationTrainer enable imitation learning, i.e. learning from human/AI demonstrations. Imitation training is typically much faster than reinforcement learning, but requires gathering large amounts of data in order to generalize. This can be used to initialize a reinforcement learning policy to speed up initial exploration. see: ULearningAgentsInteractor to understand how observations and actions work. see: ULearningAgentsController to understand how we can manually perform actions via a human or AI. see: ULearningAgentsRecorder to understand how to make new recordings.
C++ Source:
Plugin: LearningAgents
Module: LearningAgentsTraining
File: LearningAgentsImitationTrainer.h
Editor Properties: (see get_editor_property/set_editor_property)
has_training_failed
(bool): [Read-Only] True if trainer encountered an unrecoverable error during training (e.g. the trainer process timed out). Otherwise, false. This exists mainly to keep the editor from locking up if something goes wrong during training.interactor
(LearningAgentsInteractor): [Read-Only] The interactor being trained.is_setup
(bool): [Read-Only] True if this object has been setup. Otherwise, false.is_training
(bool): [Read-Only] True if training is currently in-progress. Otherwise, false.manager
(LearningAgentsManager): [Read-Only] The manager this object is associated with.policy
(LearningAgentsPolicy): [Read-Only] The policy being trained.visual_logger_objects
(Map[Name, LearningAgentsVisualLoggerObject]): [Read-Only] The visual logger objects associated with this listener.
- begin_training(recording, imitation_trainer_settings=[], imitation_trainer_training_settings=[], imitation_trainer_path_settings=[]) None ¶
Begins the training process with the provided settings.
- Parameters:
recording (LearningAgentsRecording) – The data to train on.
imitation_trainer_settings (LearningAgentsImitationTrainerSettings) – The settings for this trainer.
imitation_trainer_training_settings (LearningAgentsImitationTrainerTrainingSettings) – The training settings for this network.
imitation_trainer_path_settings (LearningAgentsTrainerPathSettings) – The path settings used by the imitation trainer.
- has_training_failed() bool ¶
Returns true if the trainer has failed to communicate with the external training process. This can be used in combination with RunTraining to avoid filling the logs with errors.
- Returns:
True if the training has failed. Otherwise, false.
- Return type:
- is_training() bool ¶
Returns true if the trainer is currently training; Otherwise, false.
- Return type:
- classmethod make_imitation_trainer(manager, interactor, policy, class_=None) LearningAgentsImitationTrainer ¶
Constructs the imitation trainer and runs the setup functions.
- Parameters:
manager (LearningAgentsManager) – The agent manager we are using.
interactor (LearningAgentsInteractor) – The agent interactor we are recording with.
policy (LearningAgentsPolicy) – The policy we are using.
- Return type:
- run_training(recording, imitation_trainer_settings=[], imitation_trainer_training_settings=[], imitation_trainer_path_settings=[]) None ¶
Convenience function that runs a basic training loop. If training has not been started, it will start it. On each following call to this function, it will call IterateTraining.
- Parameters:
recording (LearningAgentsRecording) – The data to train on.
imitation_trainer_settings (LearningAgentsImitationTrainerSettings) – The settings for this trainer.
imitation_trainer_training_settings (LearningAgentsImitationTrainerTrainingSettings) – The training settings for this network.
imitation_trainer_path_settings (LearningAgentsTrainerPathSettings) – The path settings used by the imitation trainer.