def distill(teacher_model, student_model, train_sampler, train_data_loader, val_data_loader, device, distributed, distill_backbone_only, config, args):
    train_config = config['train']
    student_config = config['student_model']
    distillation_box = DistillationBox(teacher_model, student_model, train_config['criterion'], student_config)
    ckpt_file_path = config['student_model']['ckpt']
    optim_config = train_config['optimizer']
    optimizer = func_util.get_optimizer(student_model, optim_config['type'], optim_config['params'])
    scheduler_config = train_config['scheduler']
    lr_scheduler = func_util.get_scheduler(optimizer, scheduler_config['type'], scheduler_config['params'])
    if file_util.check_if_exists(ckpt_file_path):
        (best_val_map, _, _) = load_ckpt(ckpt_file_path, optimizer=optimizer, lr_scheduler=lr_scheduler)
        save_ckpt(student_model, optimizer, lr_scheduler, best_val_map, config, args, ckpt_file_path)
def distill(teacher_model, student_model, train_sampler, train_data_loader, val_data_loader, device, distributed, distill_backbone_only, config, args):
    train_config = config['train']
    student_config = config['student_model']
    distillation_box = DistillationBox(teacher_model, student_model, train_config['criterion'], student_config)
    ckpt_file_path = config['student_model']['ckpt']
    optim_config = train_config['optimizer']
    optimizer = func_util.get_optimizer(student_model, optim_config['type'], optim_config['params'])
    scheduler_config = train_config['scheduler']
    lr_scheduler = func_util.get_scheduler(optimizer, scheduler_config['type'], scheduler_config['params'])
    if file_util.check_if_exists(ckpt_file_path):
        (best_val_map, _, _) = load_ckpt(ckpt_file_path, optimizer=optimizer, lr_scheduler=lr_scheduler)
        save_ckpt(student_model, optimizer, lr_scheduler, best_val_map, config, args, ckpt_file_path)