def load_networks(self, verbose=True): super(ResnetSupernet, self).load_networks() if hasattr(self, 'netG_student_tmp'): load_pretrained_weight(self.opt.student_netG.replace('super_', ''), self.opt.student_netG, self.netG_student_tmp, self.netG_student, self.opt.student_ngf, self.opt.student_ngf) del self.netG_student_tmp
def load_networks(self, verbose=True): if self.opt.restore_pretrained_G_path is not None: util.load_network(self.netG_pretrained, self.opt.restore_pretrained_G_path, verbose) load_pretrained_weight(self.opt.pretrained_netG, self.opt.student_netG, self.netG_pretrained, self.netG_student, self.opt.pretrained_ngf, self.opt.student_ngf) del self.netG_pretrained super(ResnetDistiller, self).load_networks()
def load_networks(self, model_weight=None): if self.cfgs.restore_pretrained_G_path != False: if self.cfgs.restore_pretrained_G_path != None: pretrained_G_path = self.cfgs.restore_pretrained_G_path util.load_network(self.netG_pretrained, pretrained_G_path) else: assert len( model_weight ) != 0, "restore_pretrained_G_path and model_weight can not be None at the same time" if self.cfgs.direction == 'AtoB': self.netG_pretrained.set_dict( model_weight['netG_A'] or model_weight['netG_teacher']) else: self.netG_pretrained.set_dict( model_weight['netG_B'] or model_weight['netG_teacher']) load_pretrained_weight(self.cfgs.pretrained_netG, self.cfgs.distiller_student_netG, self.netG_pretrained, self.netG_student, self.cfgs.pretrained_ngf, self.cfgs.student_ngf) del self.netG_pretrained super(ResnetDistiller, self).load_networks(model_weight)