class_docstr: Manages a PyTorch model for training.
code: def setup_components_horovod(self):
      import horovod.torch as hvd
  
      self.logger.debug("Creating model")
      self.models = self.model_creator(self.config)
      if not isinstance(self.models, Iterable):
          self.models = [self.models]
      else:
          invalidInputError(False, "only support single model for now")
  
      invalidInputError(
          all(isinstance(model, nn.Module) for model in self.models),
          (
              "All models must be PyTorch models: {}.".format(
                  self.models
              )
          ),
      )
  
      self.logger.debug("Creating optimizer.")
      self.optimizers = self.optimizer_creator(
          self.given_models, self.config
      )
      if not isinstance(self.optimizers, Iterable):
          hvd.broadcast_parameters(
              self.models[0].state_dict(), root_rank=0
          )
          hvd.broadcast_optimizer_state(self.optimizers, root_rank=0)
          parameters = self.models[0].named_parameters()
          self.optimizers = hvd.DistributedOptimizer(
              self.optimizers, named_parameters=parameters
          )
          self.optimizers = [self.optimizers]
      else:
          invalidInputError(False, "only support one optimizer for now")
  
      self._create_schedulers_if_available()
      self._create_loss()
  
file_path: BigDL/python/orca/src/bigdl/orca/learn/pytorch/pytorch_ray_worker.py
imports: import ray
  import copy
  from bigdl.orca.learn.pytorch.utils import find_free_port
  from bigdl.orca.learn.pytorch.torch_runner import TorchRunner
  import torch.nn
  from torch.utils.data import IterableDataset
  import logging
  from bigdl.dllib.utils.log4Error import *
label_desc: Use image node_id 5 for calling the PytorchRayWorker obj's underlying member method code with example usage: obj.setup_components_horovod() without return types