rlightning.policy.supervised_policy

class rlightning.policy.supervised_policy.SimpleSupervisedPolicy(config, role_type)[source]

Bases: BasePolicy

A simple supervised policy with a CNN encoder for testing purposes.

construct_network(env_meta=None, *args, **kwargs)[source]

Construct the neural network architecture.

Parameters:
  • env_meta – Environment metadata for network configuration.

  • *args – Variable positional arguments.

  • **kwargs – Variable keyword arguments.

eval(obs)[source]
forward(obs)[source]
get_action(obs)[source]
get_action_mean(obs)[source]
get_action_value(obs)[source]
get_trainable_parameters()[source]

Return a dict of module state dicts.

get_value(obs)[source]
init_train(train_config=None, env_meta=None)[source]

Initialize the policy for training.

Sets up the network, finds trainable models, wraps with DDP if needed, and initializes the optimizer.

Parameters:
  • train_config – Training configuration.

  • env_meta – Environment metadata.

is_ready()[source]
load_state_dict(state_dict, strict=True, assign=False)[source]

Load trainable parameters from state_dict.

postprocess(env_ret=None, policy_resp=None)[source]
rollout_step(env_ret, **kwargs)[source]
setup_optimizer(optim_cfg)[source]

Set up the optimizer for training.

Parameters:

optim_cfg – Optimizer configuration.

train(sl_buffer: DataBuffer)[source]

Run a training step for the policy.

update_dataset(data)[source]

Update internal dataset from sampled buffer data.