class_docstr: Baseclass of ES training master runners (serves as basis for dev and other runners).
class_docstr_tok: ["Baseclass","of","ES","training","master","runners","(","serves","as","basis","for","dev","and","other","runners",")","."]
docstr: Setup the training master node.
docstr_tok: ["Setup","the","training","master","node","."]
code: def setup(self, cfg: DictConfig) -> None:
      """
      Setup the training master node.
      """
  
      super().setup(cfg)
  
      # --- init the shared noise table ---
      print("********** Init Shared Noise Table **********")
      self.shared_noise = SharedNoiseTable(
          count=self.shared_noise_table_size
      )
  
      # --- initialize policies ---
  
      torch_policy = TorchPolicy(
          networks=self._model_composer.policy.networks,
          distribution_mapper=self._model_composer.distribution_mapper,
          device="cpu",
      )
      torch_policy.seed(self.maze_seeding.global_seed)
  
      # support policy wrapping
      if self._cfg.algorithm.policy_wrapper:
          policy = Factory(Policy).instantiate(
              self._cfg.algorithm.policy_wrapper,
              torch_policy=torch_policy,
          )
          assert isinstance(policy, Policy) and isinstance(
              policy, TorchModel
          )
          torch_policy = policy
  
      print("********** Trainer Setup **********")
      self._trainer = ESTrainer(
          algorithm_config=cfg.algorithm,
          torch_policy=torch_policy,
          shared_noise=self.shared_noise,
          normalization_stats=self._normalization_statistics,
      )
  
      # initialize model from input_dir
      self._init_trainer_from_input_dir(
          trainer=self._trainer,
          state_dict_dump_file=self.state_dict_dump_file,
          input_dir=cfg.input_dir,
      )
  
      self._model_selection = BestModelSelection(
          dump_file=self.state_dict_dump_file,
          model=torch_policy,
          dump_interval=self.dump_interval,
      )
  
imports: import dataclasses
  from abc import abstractmethod, ABC
  from typing import Union, Optional
  from maze.core.agent.policy import Policy
  from maze.core.agent.torch_model import TorchModel
  from maze.core.utils.factory import Factory
  from omegaconf import DictConfig
  from maze.core.agent.torch_policy import TorchPolicy
  from maze.core.annotations import override
  from maze.core.env.structured_env import StructuredEnv
  from maze.core.env.structured_env_spaces_mixin import StructuredEnvSpacesMixin
  from maze.train.trainers.common.model_selection.best_model_selection import BestModelSelection
  from maze.train.trainers.common.model_selection.model_selection_base import ModelSelectionBase
  from maze.train.trainers.common.training_runner import TrainingRunner
  from maze.train.trainers.es.distributed.es_distributed_rollouts import ESDistributedRollouts
  from maze.train.trainers.es.distributed.es_dummy_distributed_rollouts import ESDummyDistributedRollouts
  from maze.train.trainers.es.distributed.es_subproc_distributed_rollouts import ESSubprocDistributedRollouts
  from maze.train.trainers.es.es_shared_noise_table import SharedNoiseTable
  from maze.train.trainers.es.es_trainer import ESTrainer
  from maze.utils.bcolors import BColors
label_desc: Use image node_id 1 for calling the ESMasterRunner obj's underlying member method code with example usage: obj.setup(cfg) without return types