ray.rllib.algorithms.algorithm_config.AlgorithmConfig.get_rl_module_spec#
- AlgorithmConfig.get_rl_module_spec(env: Any | gymnasium.Env | None = None, spaces: Dict[str, gymnasium.Space] | None = None, inference_only: bool | None = None) RLModuleSpec[source]#
 Returns the RLModuleSpec based on the given env/spaces.
- Parameters:
 env – An optional environment instance, from which to infer the observation- and action spaces for the RLModule. If not provided, tries to infer from
spaces, otherwise fromself.observation_spaceandself.action_space. Raises an error, if no information on spaces can be inferred.spaces – Optional dict mapping ModuleIDs to 2-tuples of observation- and action space that should be used for the respective RLModule. These spaces are usually provided by an already instantiated remote EnvRunner (call
EnvRunner.get_spaces()). If not provided, tries to infer fromenv, otherwise fromself.observation_spaceandself.action_space. Raises an error, if no information on spaces can be inferred.inference_only – If
True, the returned module spec is used in an inference-only setting (sampling) and the RLModule can thus be built in its light version (if available). For example, theinference_onlyversion of an RLModule might only contain the networks required for computing actions, but misses additional target- or critic networks.
- Returns:
 A new RLModuleSpec instance that can be used to build an RLModule.