unreal.LearningAgentsImitationTrainer
¶
- class unreal.LearningAgentsImitationTrainer(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
ActorComponent
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)
asset_user_data
(Array[AssetUserData]): [Read-Write] Array of user data stored with the componentauto_activate
(bool): [Read-Write] Whether the component is activated at creation or must be explicitly activated.can_ever_affect_navigation
(bool): [Read-Write] Whether this component can potentially influence navigationcomponent_tags
(Array[Name]): [Read-Write] Array of tags that can be used for grouping and categorizing. Can also be accessed from scripting.editable_when_inherited
(bool): [Read-Write] True if this component can be modified when it was inherited from a parent actor classhas_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.is_editor_only
(bool): [Read-Write] If true, the component will be excluded from non-editor buildsis_training
(bool): [Read-Only] True if training is currently in-progress. Otherwise, false.on_component_activated
(ActorComponentActivatedSignature): [Read-Write] Called when the component has been activated, with parameter indicating if it was from a reseton_component_deactivated
(ActorComponentDeactivateSignature): [Read-Write] Called when the component has been deactivatedpolicy
(LearningAgentsPolicy): [Read-Only] The policy being trained.primary_component_tick
(ActorComponentTickFunction): [Read-Write] Main tick function for the Componentreplicate_using_registered_sub_object_list
(bool): [Read-Write] When true the replication system will only replicate the registered subobjects list When false the replication system will instead call the virtual ReplicateSubObjects() function where the subobjects need to be manually replicated.replicates
(bool): [Read-Write] Is this component currently replicating? Should the network code consider it for replication? Owning Actor must be replicating first!
- begin_training(policy, recording, imitation_trainer_settings=[], imitation_trainer_training_settings=[], imitation_trainer_path_settings=[], reinitialize_policy_network=True) None ¶
Begins the training process with the provided settings.
- Parameters:
policy (LearningAgentsPolicy) – The policy to train.
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.
reinitialize_policy_network (bool) – If true, reinitialize the policy. Set this to false if your policy is pre-trained.
- 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:
- run_training(policy, recording, imitation_trainer_settings=[], imitation_trainer_training_settings=[], imitation_trainer_path_settings=[], reinitialize_policy_network=True) 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:
policy (LearningAgentsPolicy) – The policy to train.
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.
reinitialize_policy_network (bool) – If true, reinitialize the policy. Set this to false if your policy is pre-trained.