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 component

  • auto_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 navigation

  • component_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 class

  • 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.

  • is_editor_only (bool): [Read-Write] If true, the component will be excluded from non-editor builds

  • is_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 reset

  • on_component_deactivated (ActorComponentDeactivateSignature): [Read-Write] Called when the component has been deactivated

  • policy (LearningAgentsPolicy): [Read-Only] The policy being trained.

  • primary_component_tick (ActorComponentTickFunction): [Read-Write] Main tick function for the Component

  • replicate_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:
end_training() None

Stops the training process.

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:

bool

is_training() bool

Returns true if the trainer is currently training; Otherwise, false.

Return type:

bool

iterate_training() None

Iterates the training process and gets the updated policy network.

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: