ray.rllib.core.learner.learner_group.LearnerGroup#

class ray.rllib.core.learner.learner_group.LearnerGroup(*, config: AlgorithmConfig = None, module_spec: SingleAgentRLModuleSpec | MultiAgentRLModuleSpec | None = None, max_queue_len: int = 20, learner_spec=None)[source]#

Coordinator of n (possibly remote) Learner workers.

Each Learner worker has a copy of the RLModule, the loss function(s), and one or more optimizers.

PublicAPI (alpha): This API is in alpha and may change before becoming stable.

Methods

__init__

Initializes a LearnerGroup instance.

add_module

Add a module to the Learners maintained by this LearnerGroup.

additional_update

Apply additional non-gradient based updates to the Learners.

foreach_learner

Calls the given function on each Learner L with the args: (L, **kwargs).

get_state

Get the states of this LearnerGroup.

get_stats

Returns the current stats for the input queue for this learner group.

get_weights

Get the weights of the MultiAgentRLModule maintained by each Learner.

load_module_state

Load the checkpoints of the modules being trained by this LearnerGroup.

load_state

Loads the state of the LearnerGroup.

remove_module

Remove a module from the Learners maintained by this LearnerGroup.

save_state

Saves the state of the LearnerGroup.

set_state

Sets the state of this LearnerGroup.

set_weights

Set the weights of the MultiAgentRLModule maintained by each Learner.

shutdown

Shuts down the LearnerGroup.

update_from_batch

Performs gradient based update(s) on the Learner(s), based on given batch.

update_from_episodes

Performs gradient based update(s) on the Learner(s), based on given episodes.

Attributes

is_local

is_remote