ray.rllib.algorithms.algorithm_config.AlgorithmConfig.build_learner_group#

AlgorithmConfig.build_learner_group(*, env: Any | gymnasium.Env | None = None, spaces: Dict[str, Tuple[gymnasium.Space, gymnasium.Space]] | None = None, rl_module_spec: RLModuleSpec | MultiRLModuleSpec | None = None) LearnerGroup[source]#

Builds and returns a new LearnerGroup object based on settings in self.

Parameters:
  • env – An optional EnvType object (e.g. a gym.Env) useful for extracting space information for the to-be-constructed RLModule inside the LearnerGroup’s Learner workers. Note that if RLlib cannot infer any space information either from this env arg, from the optional spaces arg or from self, the LearnerGroup cannot be created.

  • spaces – An optional dict mapping ModuleIDs to (observation-space, action-space)-tuples for the to-be-constructed RLModule inside the LearnerGroup’s Learner workers. Note that if RLlib cannot infer any space information either from this spces arg, from the optional env arg or from self, the LearnerGroup cannot be created.

  • rl_module_spec – An optional (single-agent or multi-agent) RLModuleSpec to use for the constructed LearnerGroup. If None, RLlib tries to infer the RLModuleSpec using the other information given and stored in this AlgorithmConfig object.

Returns:

The newly created LearnerGroup object.