ray.rllib.core.models.catalog.Catalog._get_encoder_config#

classmethod Catalog._get_encoder_config(observation_space: gymnasium.Space, model_config_dict: dict, action_space: gymnasium.Space = None, view_requirements=None) ModelConfig[source]#

Returns an EncoderConfig for the given input_space and model_config_dict.

Encoders are usually used in RLModules to transform the input space into a latent space that is then fed to the heads. The returned EncoderConfig objects correspond to the built-in Encoder classes in RLlib. For example, for a simple 1D-Box input_space, RLlib offers an MLPEncoder, hence this method returns the MLPEncoderConfig. You can overwrite this method to produce specific EncoderConfigs for your custom Models.

The following input spaces lead to the following configs: - 1D-Box: MLPEncoderConfig - 3D-Box: CNNEncoderConfig # TODO (Artur): Support more spaces here # …

Parameters:
  • observation_space – The observation space to use.

  • model_config_dict – The model config to use.

  • action_space – The action space to use if actions are to be encoded. This is commonly the case for LSTM models.

  • view_requirements – The view requirements to use if anything else than observation_space or action_space is to be encoded. This signifies an advanced use case.

Returns:

The encoder config.