class_docstr: Build common distill model.
  Args:
      cfg: The student config.
      slim_cfg: The teacher and distill config.
class_docstr_tok: ["Build","common","distill","model",".","Args",":","cfg",":","The","student","config",".","slim_cfg",":","The","teacher","and","distill","config","."]
code: def __init__(self, cfg, slim_cfg):
      super(DistillModel, self).__init__()
      self.arch = cfg.architecture
  
      self.stu_cfg = cfg
      self.student_model = create(self.stu_cfg.architecture)
      if (
          "pretrain_weights" in self.stu_cfg
          and self.stu_cfg.pretrain_weights
      ):
          stu_pretrain = self.stu_cfg.pretrain_weights
      else:
          stu_pretrain = None
  
      slim_cfg = load_config(slim_cfg)
      self.tea_cfg = slim_cfg
      self.teacher_model = create(self.tea_cfg.architecture)
      if (
          "pretrain_weights" in self.tea_cfg
          and self.tea_cfg.pretrain_weights
      ):
          tea_pretrain = self.tea_cfg.pretrain_weights
      else:
          tea_pretrain = None
      self.distill_cfg = slim_cfg
  
      # load pretrain weights
      self.is_inherit = False
      if stu_pretrain:
          if self.is_inherit and tea_pretrain:
              load_pretrain_weight(self.student_model, tea_pretrain)
              logger.debug(
                  "Inheriting! loading teacher weights to student model!"
              )
          load_pretrain_weight(self.student_model, stu_pretrain)
          logger.info("Student model has loaded pretrain weights!")
      if tea_pretrain:
          load_pretrain_weight(self.teacher_model, tea_pretrain)
          logger.info("Teacher model has loaded pretrain weights!")
  
      self.teacher_model.eval()
      for param in self.teacher_model.parameters():
          param.trainable = False
  
      self.distill_loss = self.build_loss(self.distill_cfg)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import paddle
  import paddle.nn
  from ppdet.core.workspace import register, create, load_config
  from ppdet.utils.checkpoint import load_pretrain_weight
  from ppdet.utils.logger import setup_logger
label_desc: Use image node_id 1 to create a new DistillModel object from inherited base classes: nn with example: obj = DistillModel(cfg, slim_cfg)