rlightning.utils.config

class rlightning.utils.config.BufferConfig(**data: Any)[source]

Bases: Config

Configuration for the data buffer.

auto_truncate_episode: bool = False

Whether to automatically truncate episodes when they are done

capacity: int

Maximum number of transitions the buffer can store

node_affinity_env: bool = False

Whether to enable node affinity for environment workers

node_affinity_train: bool = False

Whether to enable node affinity for training workers

sampler: SamplerConfig | None = None

The sampler configuration

setup_default_sampler = MockModule('pydantic.model_validator')
storage: StorageConfig = MockModule('pydantic.Field')

The storage backend configuration

type: Literal['ReplayBuffer', 'RolloutBuffer']

The type of the buffer

class rlightning.utils.config.ClusterConfig(**data: Any)[source]

Bases: Config

Cluster configuration.

class PlacementConfig(**data: Any)[source]

Bases: Config

Placement configuration for cluster resources.

This is the single source of truth for placement behavior: - mode: auto/manual - strategy: default/disaggregate/colocate - env_strategy: default/device-colocate

env_strategy: Literal['default', 'device-colocate'] = 'default'
mode: Literal['auto', 'manual'] = 'auto'
strategy: Literal['default', 'disaggregate', 'colocate'] = 'default'
buffer_worker_num: int | Literal['auto'] = 1

Number of storage workers for data buffer, auto means automatically determined

enable_offload: bool = False

Whether to enable offload for the policy and env

eval_each_gpu_num: float = 1.0

Number of GPU per policy worker for evaluation

eval_worker_num: int = 1

Number of evaluation workers for eval policy

is_colocated: bool = False

Whether the train and eval policy is colocated

placement: PlacementConfig = MockModule('pydantic.Field')

Placement configuration for cluster resources

ray_address: str = 'auto'

The address of the Ray cluster, auto means connecting to an existing cluster

remote_env: bool = True

Whether to run the environment as remote actor

remote_eval: bool = True

Whether to run the eval policy as remote actor

remote_storage: bool = True

Whether to run the data buffer as remote actor

remote_train: bool = True

Whether to run the train policy as remote actor

resource_pool: List[ResourcePoolConfig] | None = None

Manual resource pool configuration list

rollout_env_interaction: Literal['batched', 'streaming', None] = None

The rollout environment interaction mode, batched or streaming

train_each_gpu_num: float = 1.0

Number of GPU per policy worker for training

train_worker_num: int = 1

Number of training workers for train policy

class rlightning.utils.config.Config(**data: Any)[source]

Bases: pydantic.BaseModel

A Config class based on Pydantic.

classmethod from_dict(data: dict) Config[source]

Create and validate a config instance from a standard Python dictionary.

classmethod from_omegaconf(om_cfg: MockModule('omegaconf.DictConfig')) Config[source]

Create and validate a config instance from an OmegaConf DictConfig.

get(name: str, default: Any = None) Any[source]

Get the value of a field by name, with an optional default if the field does not exist.

classmethod load_yaml(file_path: str = None) Config[source]

Load configuration from a YAML file.

Parameters:

file_path (str) – Path to the YAML configuration file. If None, returns an empty config.

Returns:

An instance of the Config class populated with data from the YAML file.

Return type:

Config

model_config = MockModule('pydantic.ConfigDict')
to_dict() dict[source]

Recursively convert the model instance to a standard Python dictionary.

to_yaml() str[source]

Recursively convert the model instance to a YAML-formatted string.

class rlightning.utils.config.EnvConfig(**data: Any)[source]

Bases: Config

Environment configuration.

backend: str

The simulator backend type of the environment

env_kwargs: Config = <rlightning.utils.config.config.Config object>

Configuration used to initialize

evaluate_cfg: Config | None = None

The evaluation configuration for the environment

init_params: Config | None = None

The initialization parameters for the environment

max_episode_steps: int | None = None

Maximum number of steps per episode

name: str

User defined name of the environment for identification purposes

num_cpus: int = 1

Number of CPUs to allocate for one environment instance, only valid when env is remote

num_envs: int = 1

Number of parallel vectorized environments in one environment instance

num_gpus: float = 0.0

Number of GPUs to allocate for one environment instance, only valid when env is remote

num_workers: int = 1

Number of environment workers with the same configuration

policy_setup: str = 'widowx'

The policy setup for the environment

sanity_check = MockModule('pydantic.model_validator')
setup_robot_control_mode_for_maniskill = MockModule('pydantic.model_validator')
task: str

The task name of the environment

class rlightning.utils.config.LogConfig(**data: Any)[source]

Bases: Config

Logging configuration. Including experiment manager and logging level.

backend: Literal['tensorboard', 'wandb', 'swanlab'] = 'tensorboard'

The experiment manager backend

level: Literal['DEBUG', 'INFO', 'WARINING', 'ERROR', 'CRITICAL'] = 'DEBUG'

The logging level

log_dir: str = './runs'

The directory to save experiment logs

mode: Literal['online', 'offline', 'shared', 'disabled', 'cloud', 'local'] | None = None

The mode for wandb, online or offline, not work for other backends

mode_sanity_check_and_setup_local_by_default = MockModule('pydantic.model_validator')
name: str = 'default_exp'

The experiment name

project: str = 'default_project'

The project name

class rlightning.utils.config.MainConfig(**data: Any)[source]

Bases: Config

Entry configuration class.

buffer: BufferConfig

Configuration for the data buffer

cluster: ClusterConfig | None = None

Configuration for the cluster

convert_single_env_cfg_to_list = MockModule('pydantic.model_validator')
debug: bool = True

debug mode

engine: Literal['asyncrl', 'async_rsl', 'rsl', 'syncrl', 'eval'] | None = None

Registered engine

env: List[EnvConfig] | EnvConfig

List of environment configurations

log: LogConfig = MockModule('pydantic.Field')

Configuration for logging

policy: PolicyConfig

Configuration for the policy

train: TrainConfig

Configuration for the training process

verbose: bool = True

verbose mode

class rlightning.utils.config.PolicyConfig(**data: Any)[source]

Bases: Config

Policy configuration.

backend: Config | None = None

The inference backend of eval policy

eval_num_gpus: float = 1.0

Number of GPUs to allocate for one evaluation policy instance, only valid when eval policy is remote

model_cfg: Config | None = None

The model configuration

optim_cfg: Config | None = None

The optimizer configuration

policy_kwargs: Config | None = None

Customized keyword arguments for policy initialization

rollout_mode: Literal['sync', 'async'] = 'sync'

The policy inference concurrency mode, sync or async

router_type: Literal['simple', 'node_affinity'] = 'simple'

Router type for async rollout mode. “simple” uses load balancing, “node_affinity” routes env requests to policies on the same node.

train_num_gpus: float = 1.0

Number of GPUs to allocate for one training policy instance, only valid when train policy is remote

type: str

The type of the policy, used it to find the policy cls

weight_buffer: WeightBufferConfig = MockModule('pydantic.Field')

Configuration for the weight buffer

class rlightning.utils.config.ResourcePoolConfig(**data: Any)[source]

Bases: Config

Manual resource pool definition, typically from cluster/manual.yaml.

Notes: - num_gpus is per-node GPU count (int), or a per-node list for explicit node_ids binding. - component keys like train/eval/env/buffer are allowed as extra fields (strings).

name: str
node_ids: List[str] | None = None
num_gpus: int | List[int]
num_node: int
class rlightning.utils.config.TrainConfig(**data: Any)[source]

Bases: Config

Training configuration.

batch_size: int = 64

The training batch size

eval_interval: int = -1

The evaluation interval (in epochs) during training

lr: float = 0.0003

The learning rate

max_epochs: int

The maximum number of training epochs

max_eval_rollout_steps: int = -1

The maximum number of rollout steps during once evaluation stage

max_rollout_steps: int = -1

The maximum number of rollout steps during once rollout stage

parallel: Literal['ddp', None] = None

The parallel mode for training, default is None, i.e., no parallel

save_dir: str = None

The directory to save checkpoints

save_interval: int = -1

The model saving interval (in epochs) during training

setup_default_ckpt_save_dir = MockModule('pydantic.model_validator')
class rlightning.utils.config.WeightBufferConfig(**data: Any)[source]

Bases: Config

Configuration for the weight buffer.

buffer_strategy: Literal['None', 'Double', 'Shared', 'Sharded'] = 'Double'

The buffer strategy to use

type: Literal['WeightBuffer', 'CPUWeightBuffer', 'ShardedWeightBuffer'] = 'WeightBuffer'

The type of the weight buffer

validate_strategy = MockModule('pydantic.model_validator')
rlightning.utils.config.validate_config_for_placement(config: MainConfig) MainConfig[source]

Validate the configuration for placement strategy.

Submodules