(model, model_path)
return model
加载模型
    :param model:
    :param model_name:
    :param model_path:
    :param only_param:
    :return:
加载模型
    :param model:
    :param model_name:
    :param model_path:
    :param only_param:
    :return:
加载模型 : param model : : param model_name : : param model_path : : param only_param : : return :
def load_model(model, model_path):
    '''
    加载模型
    :param model:
    :param model_name:
    :param model_path:
    :param only_param:
    :return:
    '''
    if isinstance(model_path, Path):
        model_path = str(model_path)
    logging.info(f"loading model from {str(model_path)} .")
    states = torch.load(model_path)
    state = states['state_dict']
    if isinstance(model, nn.DataParallel):
        model.module.load_state_dict(state)
    else:
        model.load_state_dict(state)
    return model
def load_model ( model , model_path ) : if isinstance ( model_path , Path ) : model_path = str ( model_path ) logging . info ( f"loading model from {str(model_path)} ." ) states = torch . load ( model_path ) state = states [ 'state_dict' ] if isinstance ( model , nn . DataParallel ) : model . module . load_state_dict ( state ) else : model . load_state_dict ( state ) return model