unreal.LearningAgentsCommunicatorLibrary

class unreal.LearningAgentsCommunicatorLibrary(outer: Object | None = None, name: Name | str = 'None')

Bases: BlueprintFunctionLibrary

Contains functions for starting external trainers and communicating with them.

C++ Source:

  • Plugin: LearningAgents

  • Module: LearningAgentsTraining

  • File: LearningAgentsCommunicator.h

classmethod make_shared_memory_communicator(trainer_process, trainer_process_settings=[], shared_memory_settings=[]) LearningAgentsCommunicator

Create a communicator which can be used to interact with a previously started shared memory trainer process.

Parameters:
Return type:

LearningAgentsCommunicator

classmethod make_shared_memory_training_process(trainer_process_settings=[], shared_memory_settings=[]) LearningAgentsCommunicator

Start and connect to a training sub-process which will communicate via shared memory. Shared memory has the least communication overhead so prefer this for local development.

This must be called on game thread!

You can use this in place of calling “SpawnSharedMemoryTrainingProcess” followed by “MakeSharedMemoryCommunicator” for most use-cases.

If you wish to connect to an externally launched trainer (for debugging or scale-out reasons, etc.), you can use the following command-line options to override some settings:

-LearningAgentsUseExternalTrainingProcess

If present, spawning a sub-process will be skipped.

-LearningAgentsControlsGuid={guid} This optional guid will override the SharedMemorySettings, so you

can attach to shared memory control created by the trainer.

Parameters:
Return type:

LearningAgentsCommunicator

classmethod make_socket_communicator(trainer_process, socket_settings=[]) LearningAgentsCommunicator

Create a communicator which can be used to interact with a previously started socket trainer process.

Parameters:
Return type:

LearningAgentsCommunicator

classmethod make_socket_training_process(trainer_process_settings=[], socket_settings=[]) LearningAgentsCommunicator

Start and connect to a training sub-process which will communicate via sockets. Sockets have some overhead compared to shared memory but can work over networked connects. This provides no encryption so do not use on public internet if privacy is a concern.

This must be called on game thread!

If you wish to connect to an externally launched trainer (for debugging or scale-out reasons, etc.), you can use the following command-line options to override some settings:

-LearningAgentsUseExternalTrainingProcess

If present, spawning a sub-process will be skipped.

-LearningAgentsIpAddress= This optional IP address will override the SocketSettings -LearningAgentsPort= This optional Port will override the SocketSettings

Parameters:
Return type:

LearningAgentsCommunicator

classmethod spawn_shared_memory_training_process(trainer_process_settings=[], shared_memory_settings=[]) LearningAgentsSharedMemoryTrainerProcess

Start a local python training sub-process which will communicate via shared memory. Shared memory has the least communication overhead so prefer this for local development.

This must be called on game thread!

Parameters:
Return type:

LearningAgentsSharedMemoryTrainerProcess

classmethod spawn_socket_training_process(trainer_process_settings=[], socket_settings=[]) LearningAgentsSocketTrainerProcess

Start a local python training sub-process which will communicate via sockets. Sockets have some overhead compared to shared memory but can work over networked connects. This provides no encryption so do not use on public internet if privacy is a concern.

This must be called on game thread!

Parameters:
Return type:

LearningAgentsSocketTrainerProcess