ray.rllib.algorithms.algorithm_config.AlgorithmConfig.overrides#

classmethod AlgorithmConfig.overrides(**kwargs)[source]#

Generates and validates a set of config key/value pairs (passed via kwargs).

Validation whether given config keys are valid is done immediately upon construction (by comparing against the properties of a default AlgorithmConfig object of this class). Allows combination with a full AlgorithmConfig object to yield a new AlgorithmConfig object.

Used anywhere, we would like to enable the user to only define a few config settings that would change with respect to some main config, e.g. in multi-agent setups and evaluation configs.

from ray.rllib.algorithms.ppo import PPOConfig
from ray.rllib.policy.policy import PolicySpec
config = (
    PPOConfig()
    .multi_agent(
        policies={
            "pol0": PolicySpec(config=PPOConfig.overrides(lambda_=0.95))
        },
    )
)
from ray.rllib.algorithms.algorithm_config import AlgorithmConfig
from ray.rllib.algorithms.ppo import PPOConfig
config = (
    PPOConfig()
    .evaluation(
        evaluation_num_env_runners=1,
        evaluation_interval=1,
        evaluation_config=AlgorithmConfig.overrides(explore=False),
    )
)
Returns:

A dict mapping valid config property-names to values.

Raises:

KeyError – In case a non-existing property name (kwargs key) is being passed in. Valid property names are taken from a default AlgorithmConfig object of cls.