def load_net_from_checkpoint(checkpoint):
    assert osp.isfile(checkpoint), 'checkpoint {:} does not exist'.format(checkpoint)
    checkpoint = torch.load(checkpoint)
    model_config = dict2config(checkpoint['model-config'], None)
    model = obtain_model(model_config)
    model.load_state_dict(checkpoint['base-model'])
    return model
def load_net_from_checkpoint(checkpoint):
    assert osp.isfile(checkpoint), 'checkpoint {:} does not exist'.format(checkpoint)
    checkpoint = torch.load(checkpoint)
    model_config = dict2config(checkpoint['model-config'], None)
    model = obtain_model(model_config)
    model.load_state_dict(checkpoint['base-model'])
    return model