unreal.LearningAgentsCommunicatorLibrary¶
- class unreal.LearningAgentsCommunicatorLibrary(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
BlueprintFunctionLibraryContains functions for starting external trainers and communicating with them.
C++ Source:
Plugin: LearningAgents
Module: LearningAgentsTraining
File: LearningAgentsCommunicator.h
Create a communicator which can be used to interact with a previously started shared memory trainer process.
- Parameters:
trainer_process (LearningAgentsSharedMemoryTrainerProcess) – The shared memory trainer process to communicate with.
trainer_process_settings (LearningAgentsTrainerProcessSettings) – Settings universal to all trainer processes.
shared_memory_settings (LearningAgentsSharedMemoryCommunicatorSettings)
- Return type:
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:
trainer_process_settings (LearningAgentsTrainerProcessSettings) – Settings universal to all trainer processes.
shared_memory_settings (LearningAgentsSharedMemoryCommunicatorSettings)
- Return type:
- 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:
trainer_process (LearningAgentsSocketTrainerProcess) – The socket trainer process to communicate with (optional).
socket_settings (LearningAgentsSocketCommunicatorSettings)
- Return type:
- 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:
trainer_process_settings (LearningAgentsTrainerProcessSettings) – Settings universal to all trainer processes.
socket_settings (LearningAgentsSocketCommunicatorSettings)
- Return type:
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:
trainer_process_settings (LearningAgentsTrainerProcessSettings) – Settings universal to all trainer processes.
shared_memory_settings (LearningAgentsSharedMemoryCommunicatorSettings)
- Return type:
- 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:
trainer_process_settings (LearningAgentsTrainerProcessSettings) – Settings universal to all trainer processes.
socket_settings (LearningAgentsSocketCommunicatorSettings)
- Return type: