ray.rllib.core.rl_module.rl_module.SingleAgentRLModuleSpec#

class ray.rllib.core.rl_module.rl_module.SingleAgentRLModuleSpec(module_class: Type[RLModule] | None = None, observation_space: gymnasium.Space | None = None, action_space: gymnasium.Space | None = None, model_config_dict: Dict[str, Any] | None = None, catalog_class: Type[Catalog] | None = None, load_state_path: str | None = None)[source]#

Utility spec class to make constructing RLModules (in single-agent case) easier.

Parameters:
  • module_class – The RLModule class to use.

  • observation_space – The observation space of the RLModule. This may differ from the observation space of the environment. For example, a discrete observation space of an environment, would usually correspond to a one-hot encoded observation space of the RLModule because of preprocessing.

  • action_space – The action space of the RLModule.

  • model_config_dict – The model config dict to use.

  • catalog_class – The Catalog class to use.

  • load_state_path – The path to the module state to load from. NOTE: This must be an absolute path.

Methods

as_multi_agent

Returns a MultiAgentRLModuleSpec (self under DEFAULT_POLICY_ID key).

build

Builds the RLModule from this spec.

from_dict

Returns a single agent RLModule spec from a serialized representation.

get_rl_module_config

Returns the RLModule config for this spec.

to_dict

Returns a serialized representation of the spec.

update

Updates this spec with the given other spec.

Attributes

action_space

catalog_class

load_state_path

model_config_dict

module_class

observation_space