evorl.workflows.ec_workflow

Module Contents

Classes

DistributedInfo

Distributed information for multi-devices training.

ECWorkflow

Base Workflow for EC (Evolutionary Computation) algorithms.

ECWorkflowTemplate

Workflow template for EC algorithms.

MultiObjectiveECWorkflowTemplate

Workflow template for multi-objective EC algorithms.

API

class evorl.workflows.ec_workflow.DistributedInfo[source]

Bases: evorl.types.PyTreeData

Distributed information for multi-devices training.

rank: int

‘zeros(…)’

world_size: int

‘pytree_field(…)’

class evorl.workflows.ec_workflow.ECWorkflow(config: omegaconf.DictConfig)[source]

Bases: evorl.workflows.workflow.Workflow

Base Workflow for EC (Evolutionary Computation) algorithms.

classmethod build_from_config(config: omegaconf.DictConfig, enable_multi_devices: bool = False, enable_jit: bool = True)[source]

Build the ec workflow instance from the config.

Parameters:
  • config – Config of the workflow

  • enable_multi_devices – Whether multi-devices training is enabled

  • enable_jit – Whether jit is enabled

classmethod enable_jit() None[source]

Define which methods should be jitted.

By default, the workflow’s step() method is jitted.

property enable_multi_devices: bool

Whether multi-devices training is enabled.

classmethod enable_shmap(axis_name) None[source]

Define which methods should be shmaped.

This method defines the multi-device behavior. By default, the workflow’s step() method is shmaped.

class evorl.workflows.ec_workflow.ECWorkflowTemplate(*, env: evorl.envs.Env, agent: evorl.agent.Agent, ec_optimizer: evorl.ec.optimizers.EvoOptimizer, ec_evaluator: evorl.evaluators.Evaluator | evorl.evaluators.EpisodeCollector, agent_state_vmap_axes: evorl.agent.AgentStateAxis = 0, config: omegaconf.DictConfig)[source]

Bases: evorl.workflows.ec_workflow.ECWorkflow

Workflow template for EC algorithms.

Variables:
  • env – Environment object.

  • agent – Workflow-sepecific agent object.

  • ec_optimizer – EC Optimizer of the agent.

  • ec_evaluator – Evaluator object used in self.evaluation().

  • agent_state_vmap_axes – Vmap axis for the agent state.

  • config – Config of the workflow.

classmethod enable_jit() None[source]
classmethod enable_shmap(axis_name) None[source]
setup(key: chex.PRNGKey) evorl.types.State[source]
step(state: evorl.types.State) tuple[evorl.metrics.MetricBase, evorl.types.State][source]
class evorl.workflows.ec_workflow.MultiObjectiveECWorkflowTemplate(*, env: evorl.envs.Env, agent: evorl.agent.Agent, ec_optimizer: evorl.ec.optimizers.EvoOptimizer, ec_evaluator: evorl.evaluators.Evaluator | evorl.evaluators.EpisodeCollector, agent_state_vmap_axes: evorl.agent.AgentStateAxis = 0, config: omegaconf.DictConfig)[source]

Bases: evorl.workflows.ec_workflow.ECWorkflowTemplate

Workflow template for multi-objective EC algorithms.

step(state: evorl.types.State) tuple[evorl.metrics.MetricBase, evorl.types.State][source]