docstr: Trains a MMCV model given training and val data for several epochs.
  
  :param data_loaders_creators: Dataloader creators for training and validation.
  :param workflow: A list of (phase, epochs) to specify the
         running order and epochs. E.g, [('train', 2), ('val', 1)] means
         running 2 epochs for training and 1 epoch for validation,
         iteratively.
  :param max_epochs: Set max_epochs for MMCV runner is deprecated
  :param reduce_results: Whether to average all metrics across all workers into
         one dict. If a metric is a non-numerical value, the one value will be randomly
         selected among the workers. If False, returns a list of dicts for
         all workers. Default is True.
docstr_tok: ["Trains","a","MMCV","model","given","training","and","val","data","for","several","epochs",".",":","param","data_loaders_creators",":","Dataloader","creators","for","training","and","validation",".",":","param","workflow",":","A","list","of","(","phase",",","epochs",")","to","specify","the","running","order","and","epochs",".","E.g",",","[","(","'train","'",",","2",")",",","(","'val","'",",","1",")","]","means","running","2","epochs","for","training","and","1","epoch","for","validation",",","iteratively",".",":","param","max_epochs",":","Set","max_epochs","for","MMCV","runner","is","deprecated",":","param","reduce_results",":","Whether","to","average","all","metrics","across","all","workers","into","one","dict",".","If","a","metric","is","a","non-numerical","value",",","the","one","value","will","be","randomly","selected","among","the","workers",".","If","False",",","returns","a","list","of","dicts","for","all","workers",".","Default","is","True","."]
code: def fit(
      self,
      data_loaders_creators: List[Callable],
      workflow: List[Tuple[str, int]],
      max_epochs: Optional[int] = None,  # deprecated
      reduce_results: bool = True,
      **kwargs,
  ) -> List:
      """Trains a MMCV model given training and val data for several epochs.
  
      :param data_loaders_creators: Dataloader creators for training and validation.
      :param workflow: A list of (phase, epochs) to specify the
             running order and epochs. E.g, [('train', 2), ('val', 1)] means
             running 2 epochs for training and 1 epoch for validation,
             iteratively.
      :param max_epochs: Set max_epochs for MMCV runner is deprecated
      :param reduce_results: Whether to average all metrics across all workers into
             one dict. If a metric is a non-numerical value, the one value will be randomly
             selected among the workers. If False, returns a list of dicts for
             all workers. Default is True.
      """
      for creator in data_loaders_creators:
          if not (isinstance(creator, types.FunctionType)):
              invalidInputError(
                  False,
                  "Must provide a function for all dataloader creator",
              )
  
      params = dict(
          data_loaders_creators=data_loaders_creators,
          workflow=workflow,
          max_epochs=max_epochs,
          **kwargs,
      )
  
      self.setup_torch_ddp()
  
      success, worker_stats = self._train_epochs(**params)
  
      epoch_stats = list(map(list, zip(*worker_stats)))
      if reduce_results:
          for i in range(len(epoch_stats)):
              epoch_stats[i] = process_stats(epoch_stats[i])
          return epoch_stats
      else:
          return epoch_stats
  
file_path: BigDL/python/orca/src/bigdl/orca/learn/pytorch/experimential/mmcv/mmcv_ray_estimator.py
imports: import types
  import copy
  import ray
  from bigdl.dllib.utils.log4Error import invalidInputError
  from bigdl.orca.learn.pytorch.core.base_ray_estimator import BaseRayEstimator
  from bigdl.orca.learn.pytorch.experimential.mmcv.mmcv_ray_runner import MMCVRayEpochRunner
  from bigdl.orca.learn.pytorch.utils import process_stats
  from typing import Dict, List, Optional, Tuple, Callable, Union
label_desc: Use image node_id 2 for calling the MMCVRayEstimator obj's underlying member method code with example usage: obj.fit(data_loaders_creators, workflow, max_epochs, reduce_results) and returns: epoch_stats, epoch_stats