class_docstr: Manages a PyTorch model for training.
class_docstr_tok: ["Manages","a","PyTorch","model","for","training","."]
code: def __init__(
      self,
      model_creator,
      optimizer_creator,
      loss_creator=None,
      metrics=None,
      scheduler_creator=None,
      config=None,
      sync_stats=True,
      log_level=logging.INFO,
  ):
      logging.basicConfig(
          level=log_level,
          format="[%(asctime)s] %(levelname)-8s %(message)s",
          datefmt="%Y-%m-%d %H:%M:%S",
      )
      self.logger = logging.getLogger(__name__)
      self.model_creator = model_creator
      self.optimizer_creator = optimizer_creator
      self.loss_creator = loss_creator
      self.scheduler_creator = scheduler_creator
      self.config = {} if config is None else config
  
      self.timers = utils.TimerCollection()
      self.epochs = 0
      self.global_step = 0
      self.models = None
      self.optimizers = None
      self.metrics = metrics
      self.criterion = None
      self.schedulers = None
      self.train_loader = None
      self.validation_loader = None
      self.sync_stats = sync_stats
      self.epoch_stats = None  # The state saved in every epoch
      self._mode = "val"  # By default we don't use ddp model
      self._pocket = dict()  # Used to store some customized attributes
      self.stop = False
  
imports: from filelock import FileLock
  import logging
  import os
  import copy
  import tempfile
  import math
  import torch
  import torch.nn
  import numpy
  from torch.utils.data import DataLoader, IterableDataset
  from bigdl.orca.learn.metrics import Metric
  from bigdl.orca import OrcaContext
  from bigdl.orca.learn.pytorch import utils
  from bigdl.orca.learn.pytorch.utils import AverageMeterCollection, NUM_SAMPLES, get_batchsize, index_concatenate, split_predict_cols
  from bigdl.orca.learn.pytorch.core import BaseRunner
  from bigdl.dllib.utils.log4Error import invalidInputError
label_desc: Use image node_id 1 to create a new TorchRunner object from inherited base classes: BaseRunner with example: obj = TorchRunner(model_creator, optimizer_creator, loss_creator, metrics, scheduler_creator, config, sync_stats, log_level)