code: def __init__(self, cfg, placement, load_path, world_size, rank):
      self.placement = placement
      self.load_path = load_path
      self.cfg = cfg
      self.world_size = world_size
      self.rank = rank
  
      # model
      self.backbone = get_model(
          cfg.network, dropout=0.0, num_features=cfg.embedding_size
      ).to("cuda")
      self.train_module = Train_Module(
          cfg, self.backbone, self.placement, world_size
      ).to("cuda")
      if cfg.resume:
          if load_path is not None:
              self.load_state_dict()
          else:
              logging.info("Model resume failed! load path is None ")
  
      # optimizer
      self.optimizer = make_optimizer(cfg, self.train_module)
  
      # data
      self.train_data_loader = make_data_loader(
          cfg, "train", self.cfg.graph, self.cfg.synthetic
      )
  
      # loss
      if cfg.loss == "cosface":
          self.margin_softmax = flow.nn.CombinedMarginLoss(
              1, 0.0, 0.4
          ).to("cuda")
      else:
          self.margin_softmax = flow.nn.CombinedMarginLoss(
              1, 0.5, 0.0
          ).to("cuda")
  
      self.of_cross_entropy = CrossEntropyLoss_sbp()
  
      # lr_scheduler
      self.decay_step = self.cal_decay_step()
      self.scheduler = flow.optim.lr_scheduler.MultiStepLR(
          optimizer=self.optimizer,
          milestones=self.decay_step,
          gamma=0.1,
      )
  
      # log
      self.callback_logging = CallBackLogging(
          50, rank, cfg.total_step, cfg.batch_size, world_size, None
      )
      # val
      self.callback_verification = CallBackVerification(
          600,
          rank,
          cfg.val_targets,
          cfg.ofrecord_path,
          is_consistent=cfg.graph,
      )
      # save checkpoint
      self.callback_checkpoint = CallBackModelCheckpoint(
          rank, cfg.output
      )
  
      self.losses = AverageMeter()
      self.start_epoch = 0
      self.global_step = 0
  
imports: import oneflow
  from oneflow.nn.parallel import DistributedDataParallel
  from utils.ofrecord_data_utils import OFRecordDataLoader, SyntheticDataLoader
  from utils.utils_logging import AverageMeter
  from utils.utils_callbacks import CallBackVerification, CallBackLogging, CallBackModelCheckpoint
  from backbones import get_model
  from graph import TrainGraph, EvalGraph
  from utils.losses import CrossEntropyLoss_sbp
  import logging
label_desc: Use image node_id 1 to create a new Trainer object from inherited base classes: object with example: obj = Trainer(cfg, placement, load_path, world_size, rank)